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
| # this works | |
| use Class::Load 0.20 'load_class'; | |
| my $var = 'baz'; | |
| my $class = 'Foo::Bar'; | |
| my $result = load_class( $class )->class_method( $var ); # works wonders with ->new |
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
| sub _build_cybs_wsdl { | |
| my $self = shift; | |
| my $dir = $self->_production ? 'production' : 'test'; | |
| load 'File::ShareDir::ProjectDistDir', 'dist_file'; | |
| return load_class('Path::Class::File')->new( | |
| dist_file( | |
| 'Business-CyberSource', | |
| $dir |
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
| # impossible | |
| package Trace { | |
| use Moose::Role; | |
| has trace => ( | |
| isa => 'TraceObject', | |
| is => 'ro', | |
| ); | |
| } | |
| package Request { |
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
| { | |
| Boolean => "N", | |
| FooBar => "Baz", | |
| MyMessagePart => { | |
| SomeColonDelimitedArray => "1:2:3:4" | |
| } | |
| } |
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 MessagePart { | |
| use Moose 2; | |
| use MooseX::RemoteHelper; | |
| has array => ( | |
| remote_name => 'SomeColonDelimitedArray', | |
| isa => 'ArrayRef', | |
| is => 'ro', | |
| serializer => sub { | |
| my ( $attr, $instance ) = @_; |
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 5.014; | |
| use warnings; | |
| use Data::Dumper; | |
| package MessagePart { | |
| use Moose; | |
| use MooseX::RemoteHelper; | |
| with 'MooseX::RemoteHelper::CompositeSerialization'; | |
| has array => ( |
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 5.014; | |
| use warnings; | |
| use Try::Tiny; | |
| use Exception::Base ( | |
| 'My::Exception' => { | |
| has => [ qw( usermsg logmsg attr ) ], | |
| string_attributes => [ qw( usermsg logmsg ) ], | |
| }, | |
| ); |
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 5.014; | |
| use warnings; | |
| use Try::Tiny; | |
| use Exception::Base; | |
| try { | |
| if ( 0 ) { | |
| Exception::Base->throw( message => 'this sucks', value => 0 ); | |
| } |
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 MyRole { | |
| sub foo { return 'test' } | |
| } | |
| package MyClass { | |
| with 'MyRole'; | |
| ... | |
| } | |
| MyClass->new->foo; |
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
| class MyClass { | |
| method foo { return $self->{foo} } | |
| method info { return load_class('Class::Info')->new } | |
| } | |
| MyClass->new->foo; | |
| # to be the equivalent of | |
| { |