This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub FETCH{shift ,qq;@_,\n;}sub TIEHASH | |
{bless[@_]}sub SCALAR{pop@{+shift}}tie | |
%==>main=>hacker=>Perl=>another=>Just; | |
print qq;$={qq(@{[map$_=%==>k..n]})};; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub _(&@){$_=shift;@_<2?shift:$_->(shift,_($_,@_))}$_=_{shift().shift}split/ | |
\s{2}/x=><<__END__;print# Mirko Westermeier <mail@memowe.de> Key: 0x730E195D | |
J u s t a n o t h e r P e r l h a c k e r , | |
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Blog::Post; | |
use Moose; | |
use Moose::Util::TypeConstraints; | |
use File::stat; | |
use File::Slurp; | |
use DateTime; | |
class_type 'DateTime'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawProgress (factor) { | |
var progress = $('#progress'); | |
var bar = progress.children('#bar'); | |
var maxwidth = progress.width(); | |
factor = factor > 1 ? 1 : factor < 0 ? 0 : factor; | |
bar.width( maxwidth * factor ); | |
} | |
function calculate (params) { | |
var schwarze = new Array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
ladder sub { | |
my $self = shift; | |
$self->stash( navi => { | |
index => { name => 'Index page', sort => 0 }, | |
foo => { name => 'First page', sort => 1 }, | |
bar => { name => 'Another page', sort => 2 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
package Mojolicious::Lite::Auth; | |
use base Mojolicious::Controller; | |
sub check { | |
my $self = shift; | |
return 1 if $self->param('password') eq 42; | |
$self->flash( message => 'Go away!' ); | |
$self->redirect_to('message'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -nal | |
next if$.==1;print'Case #'.($.-1).': '.(($F[1]&2**$F[0]-1)==2**$F[0]-1?'ON':'OFF') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Duck; | |
use strict; | |
use warnings; | |
use base qw( Class::Accessor ); | |
__PACKAGE__->mk_accessors(qw( name age )); | |
sub duck_age { | |
my ( $self ) = @_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojolicious/Plugin/DefaultHelpers.pm b/lib/Mojolicious/Plugin/DefaultHelpers.pm | |
index 77717a8..e807bf5 100644 | |
--- a/lib/Mojolicious/Plugin/DefaultHelpers.pm | |
+++ b/lib/Mojolicious/Plugin/DefaultHelpers.pm | |
@@ -7,6 +7,7 @@ use warnings; | |
use base 'Mojolicious::Plugin'; | |
+use Mojo::ByteStream; | |
require Data::Dumper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojolicious/Controller.pm b/lib/Mojolicious/Controller.pm | |
index 55d556d..afb944f 100644 | |
--- a/lib/Mojolicious/Controller.pm | |
+++ b/lib/Mojolicious/Controller.pm | |
@@ -88,6 +88,9 @@ sub redirect_to { | |
# Location header | |
$self->res->headers->location($self->url_for(@_)->to_abs); | |
+ # Redirect body | |
+ $self->res->body('Redirecting!'); |
OlderNewer