Skip to content

Instantly share code, notes, and snippets.

View jjn1056's full-sized avatar

John Napiorkowski jjn1056

View GitHub Profile

Moose Hackathon Agenda

This is a list of topics/ideas/wishes/dreams that we will discuss during the Moose hackathon at YAPC::NA this year. They are in no particular order, nor does inclusion of this list imply any type of endorsement of the idea, these are just ideas, so please feel free to add yours in.


  • Traits/Roles in Class::MOP
    • A low-level trait/role type primitive
  • removing Test::Exception from Moose/MOP
## grabbed from the docs
# root action - captures one argument after it
sub foo_setup : Chained('/') PathPart('foo') CaptureArgs(1) {
my ( $self, $c, $foo_arg ) = @_;
...
}
# child action endpoint - takes one argument
sub bar : Chained('foo_setup') Args(1) {
use CatalystX::Declare; {
controller MyApp::Web::Controller::Error {
action start under '/start' as 'error' {
## I'd think this action would get called in a go but no!
}
under start {
final action not_found(@) is private {
$ctx->stash(missing => $ctx->request->uri);
$ctx->response->status(404);
}
use MooseX::Declare;
class MyApp::Library {
use MyApp::Album;
use MooseX::Types::Moose qw(HashRef ClassName);
has album_class => (
is => 'ro',
isa => ClassName,
required =>1,
default => 'MyApp::Album',
handles => {
use MooseX::Declare;
class MyApp::Library {
with MooseX::Role::XX_SOME_REASONABLE_NAMEXX
=> {target => 'MyApp::Album'};
}
use MyApp::Library;
my $library = MyApp::Libary->new(album_args=>{...});
my $fun_pictures = $libary->album->search_for_fun_pictures;
package Catalyst::ActionRole::FindDBICResult;
use Moose::Role;
use namespace::autoclean;
## Lots of unwritten code :)
1;
=head1 NAME
package Catalyst::ActionRole::FindDBICResult;
use Moose::Role;
use namespace::autoclean;
## Lots of unwritten code :)
1;
=head1 NAME
subtype Varchar(Int $length)
as Str
with [@Traits]
{
constraint check_length {
$length >= length($value);
}
}
while(%type_constraints) {
my($key, $type_constraint) = each %type_constraints;
delete $type_constraints{$key};
if(exists $values{$key}) {
my $value = $values{$key};
delete $values{$key};
unless($type_constraint->check($value)) {
my $message = $type_constraint->get_message($value);
warn "check $value for ".$type_constraint->name;