This file contains hidden or 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 RouteTest; | |
use Mojo::Base 'Mojolicious'; | |
# This method will run once at server start | |
sub startup { | |
my $self = shift; | |
# Documentation browser under "/perldoc" | |
$self->plugin('PODRenderer'); |
This file contains hidden or 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 EventTest; | |
use Mojo::Base 'Mojolicious'; | |
#use EV; | |
use AnyEvent; | |
# Call /wait1 and /wait2, both block but both get handled asynchronously | |
# Call /wait1 and another /wait1, the first request blocks the second | |
# Regardless of above, calling /nowait always works |
This file contains hidden or 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
use Mojolicious::Lite; | |
use EV; | |
use AnyEvent; | |
hook after_build_tx => sub { | |
print "AFTER BUILD TX\n"; | |
}; | |
get '/' => sub { | |
my $self = shift; |
This file contains hidden or 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
use Mojolicious::Lite; | |
use EV; | |
use AnyEvent; | |
hook after_build_tx => sub { | |
print "AFTER BUILD TX\n"; | |
}; | |
get '/' => sub { | |
my $self = shift; |
This file contains hidden or 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
use Mojolicious::Lite; | |
use POSIX qw( strftime ); | |
use Test::Mojo; | |
use Data::Dumper; | |
use Test::More; | |
hook after_build_tx => sub { | |
# print "AFTER BUILD TX\n"; | |
}; |
This file contains hidden or 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 helper; | |
sub new { | |
my ($package, %args) = @_; | |
return bless { | |
%args | |
}, 'helper'; | |
} | |
sub test { |
This file contains hidden or 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 helper; | |
sub new { | |
my ($package, %args) = @_; | |
return bless { | |
%args | |
}, 'helper'; | |
} | |
sub test { |
This file contains hidden or 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 main; | |
use Data::Dumper; | |
use Text::Xslate; | |
my $count = 0; | |
my $macro = undef; | |
my $xslate = Text::Xslate->new( | |
cache => 1, | |
function => { |
This file contains hidden or 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 main; | |
use Data::Dumper; | |
use Text::Xslate; | |
my $count = 0; | |
my $macro = undef; | |
my $xslate = Text::Xslate->new( | |
path => { | |
'test.tx' => qq{ |
This file contains hidden or 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 obj2; | |
sub new { my ($package, %args) = @_; bless { %args }, 'obj2' }; | |
sub render { shift->{obj}->() }; | |
package obj; | |
sub new { bless {}, 'obj' }; | |
sub capture { return obj2->new(obj => pop) } | |
package main; |
OlderNewer