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
my $c = { | |
foo => { | |
bar => { | |
baz => 123 | |
} | |
} | |
}; |
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 CatalystX::RequestRole::StrictParams; | |
use Moose::Role; | |
use Carp qw/croak confess carp cluck/; | |
=head1 NAME | |
CatalystX::RequestRole::StrictParams - Insist users specify HTTP method for form parameters | |
=head1 DESCRIPTION |
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 Point; | |
use Moose; | |
has 'x' => (isa => 'Int', is => 'rw', required => 1); | |
has 'y' => (isa => 'Int', is => 'rw', required => 1); | |
# And then later, somewhere else... | |
my $point = Point->new({ x => 3, y => 5 }); | |
$point->y( 7 ); |
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
use strict; use warnings; | |
use List::Util qw(reduce); | |
use File::Slurp qw(read_file); | |
# Given a list of filenames, return a hash of each word and the number of times | |
# it occurs. | |
sub word_count { | |
reduce { $a->{$b}++; $a } {}, |
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
use strict; | |
use warnings; | |
use Test::More; | |
use constant NEXT => 0; | |
use constant VALUE => 1; | |
sub make_list { | |
my ( $head, @tail ) = @_; | |
return [ undef, $head ] unless @tail; |
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 multiply { | |
my ( $x, $y ) = @_; | |
return $x * $y; | |
} eg { | |
is( $_->( 2, 5 ), 10, "2 and 5 equal 10" ); | |
} | |
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 CatalystX::PSGIApp; | |
use strict; | |
use warnings; | |
use Catalyst; | |
=head1 NAME | |
CatalystX::PSGIApp - Get a psgi_app in a unified way across different Catalyst versions |
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 CatalystX::PSGIApp; | |
use strict; | |
use warnings; | |
use Catalyst; | |
sub psgi_app { | |
my $class = shift; | |
my $target = shift; |
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
around 'simple_request' => sub { | |
my ( $original_method, $self, $request, @args ) = @_; | |
if ( $self->http_debug ) { | |
note "Request:"; | |
note $request->as_string; | |
} | |
my $response = $self->$original_method( $request, @args ); |
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
# Table parsing, old friend... We have spent many long evenings together, | |
# working through your broken tables, talking about your issues with | |
# implicit thead elements, and your quirky tr/th heuristics. But ... but | |
# but it's time for us to move on. We can't keep doing this. It's not you, | |
# it's me... | |
# | |
# I've ... I've met someone new. She's beautiful, she's modern, and she's | |
# elegant. She's logical, she's clean, and she's well-structured, if you | |
# know what I mean... | |
# |