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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use IO::Pipe; | |
my $pipe = IO::Pipe->new; | |
if( my $pid = fork ) { | |
print show_eol("From parent\n"), "\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 Dancer::Logger::Capture; | |
use strict; | |
use warnings; | |
=head1 NAME | |
Dancer::Logger::Capture - Capture dancer logs |
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
dancer_request( GET => "/", { params => { foofer => 54321 } }, sub { | |
is params->{foofer}, 54321; | |
}); | |
sub dancer_request { | |
require Dancer::Request; | |
require Dancer::SharedData; | |
my $method = 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
# What's best practice for setting up many sites with the same handlers | |
# but different configs? | |
# | |
# Example, having lots of surveys each under a separate /<survey_name> | |
# like /<survey_name>/login and /<survey_name>/questions | |
use Dancer; | |
my @surveys = get_surveys; |
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 Test::More import => ["!pass"]; | |
use Dancer ':moose', ':tests', ":syntax"; | |
my @keywords = (qw/before after pass/); | |
plan tests => scalar(@keywords) + 2; | |
foreach my $symbol (@keywords) { | |
ok( !exists( $::{$symbol} ), "symbol `$symbol' is not exported" ); | |
} |
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 Net::GitHub::V2::Issues; | |
use URI; | |
# Examples: | |
# http://github.com/schwern/test-more/tree/master | |
# http://github.com/sukria/Dancer | |
sub num_github_issues { | |
my $url = URI->new(shift); | |
return unless $url->host =~ m{\.?github.com$}; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Test::More import => ["!pass"]; | |
plan skip_all => "Test::TCP required" unless eval { | |
require Test::TCP; Test::TCP->import; 1; | |
}; |
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
my %moose; | |
sub init_moose { | |
require Any::Moose; | |
Any::Moose->import('::Util::TypeConstraints'); | |
{ | |
no strict 'refs'; | |
my $moose = any_moose('::Util::TypeConstraints'); | |
$moose{class} = $moose; | |
$moose{find_or_parse_type_constraint} = \&{$moose."::find_or_parse_type_constraint"}; |
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 Foo; | |
# use Mouse; | |
use Moose; | |
# use MooseX::Method::Signatures; | |
use Method::Signatures; | |
method say (Str $msg) {} |
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
Attribute::Handlers | |
B::Concise | |
CGI::Util | |
Class::ISA | |
Devel::PPPort | |
Digest | |
Digest::MD5 | |
Encode | |
Encode::Alias | |
Encode::Byte |