Skip to content

Instantly share code, notes, and snippets.

View jjn1056's full-sized avatar

John Napiorkowski jjn1056

View GitHub Profile
John-Napiorkowski-MacBook-Pro:MooseX-Types-Structured johnn$ perl -Ilib benchmark/basic.pl
Couldn't load class (MooseX::Declare::Syntax::MooseSetup) because: Couldn't load class (MooseX::Declare::Syntax::MethodDeclaration) because: MooseX::Types::Structured does not define $MooseX::Types::Structured::VERSION--version check failed at /Users/johnn/locallib510/lib/perl5/MooseX/Method/Signatures/Types.pm line 11.
BEGIN failed--compilation aborted at /Users/johnn/locallib510/lib/perl5/MooseX/Method/Signatures/Types.pm line 11.
Compilation failed in require at /Users/johnn/locallib510/lib/perl5/MooseX/Method/Signatures/Meta/Method.pm line 21.
BEGIN failed--compilation aborted at /Users/johnn/locallib510/lib/perl5/MooseX/Method/Signatures/Meta/Method.pm line 21.
......and on and on
# building the dist for real
my $ok = eval {
my $wd = File::pushd::pushd($target);
$builders[0]->build;
my $extralibs =
join $Config::Config{path_sep},
map { $abstarget->subdir('blib', $_) } qw{ arch lib };
local $ENV{PERL5LIB} = $extralibs .$Config::Config{path_sep}. $ENV{PERL5LIB};
system(@$cmd) and die "error while running: @$cmd";
1;
use CatalystX::Declare;
namespace TestApp;
role hasActionParams {
has [qw/p1 p2/] => (is=>'ro', lazy_build=>1);
method _build_p1 {
join ',', @{$self->attributes->{p1}};
}
method _build_p2 {
package Plack::Middleware::Debug::W3CValidate;
our $VERSION = '0.01';
use 5.008;
use strict;
use warnings;
use parent qw(Plack::Middleware::Debug::Base);
use WebService::Validator::HTML::W3C;
use Plack::Util::Accessor qw(validator_uri);
## in base class
has 'force_drop_table' => (
traits=>['ENV'],
is=>'rw',
isa=>'Bool',
required=>1,
default=>0,
);
## in a role
| photo_exif_values | CREATE TABLE `photo_exif_values` (
`id` int(10) unsigned NOT NULL auto_increment,
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY `value` (`value`(128))
) ENGINE=MyISAM AUTO_INCREMENT=153362543 DEFAULT CHARSET=latin1 |
#!/usr/bin/env perl
use strict;
use warnings;
my @core_requires = (
'Data::UUID' => '1.215',
'DateTime' => '0.61',
'Moose' => '1.12',
'MooseX::Types' => '0.23',
use CatalystX::Declare;
namespace MyApp::Web::Controller;
controller ::API::Photos {
extends 'Catalyst::Controller::DBIC::API::REST';
$CLASS->config(
default => 'text/xml',
class => 'Schema::Photo',
page_arg => 'page',
count_arg => 'count',
ordered_by_arg => 'sort',
under start {
final action landing as '';
final action gallery(Str $name) as ''
with BuildDBICResult(
store=>'category_rs',
find_condition=>[{columns=>['name']}],
) {
if(my $category = $ctx->stash->{category_rs}->find({name=>$name})) {
my %params = %{$ctx->req->query_parameters};
package Catalyst::TraitFor::Model::DBIC::Schema::QueryLog::PlackDebugPanel;
use Moose::Role;
our $VERSION = "0.01";
around 'ACCEPT_CONTEXT', sub {
my ($orig, $self, $ctx) = @_;
$self = $self->$orig($ctx);
$ctx->engine->env->{'plack.middleware.querylog'} = $self->querylog
if defined $ctx->engine->env;