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
| #include "xshelper.h" | |
| #define IsObject(sv) (SvROK(sv) && SvOBJECT(SvRV(sv))) | |
| #define IsArrayRef(sv) (SvROK(sv) && !SvOBJECT(SvRV(sv)) && SvTYPE(SvRV(sv)) == SVt_PVAV) | |
| #define IsHashRef(sv) (SvROK(sv) && !SvOBJECT(SvRV(sv)) && SvTYPE(SvRV(sv)) == SVt_PVHV) | |
| #define IsCodeRef(sv) (SvROK(sv) && !SvOBJECT(SvRV(sv)) && SvTYPE(SvRV(sv)) == SVt_PVCV) | |
| #define XSCON_xc_stash(a) ( (HV*)XSCON_av_at((a), XSCON_XC_STASH) ) | |
| static HV* |
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
| Program received signal SIGSEGV, Segmentation fault. | |
| 0x0000555555616f00 in Perl_hv_common () | |
| (gdb) bt | |
| #0 0x0000555555616f00 in Perl_hv_common () | |
| #1 0x0000555555618144 in Perl_hv_common_key_len () | |
| #2 0x00007ffff69060a9 in XS_Class__XSConstructor_new () | |
| from /home/tai/src/p5/p5-class-xsconstructor/Class-XSConstructor-0.001/blib/arch/auto/Class/XSConstructor/XSConstructor.so | |
| #3 0x0000555555623e09 in Perl_pp_entersub () | |
| #4 0x000055555561bf33 in Perl_runops_standard () | |
| #5 0x00005555555a7b74 in perl_run () |
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 Types::Standard -types; | |
| use Template::Compiled; | |
| my $template = Template::Compiled->new( | |
| signature => [ | |
| name => Str, | |
| age => Int->plus_coercions(Num, sub { int $_ } ), | |
| ], | |
| template => '<p>Hi <?= $name ?>. You are <?= $age ?> years old.</p>', | |
| escape => 'html', |
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 strict; | |
| use warnings; | |
| { | |
| package Widget; | |
| use Moose; | |
| has identifier => ( | |
| is => 'ro', | |
| isa => 'Int', | |
| required => !!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
| use strict; | |
| use warnings; | |
| use Data::Dumper; | |
| { | |
| package My::Example; | |
| use Moose; | |
| use Scalar::Util qw(weaken); | |
| use Hash::Util::FieldHash::Compat qw(fieldhash); | |
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 v5.16; | |
| package Person { | |
| use Moo; | |
| use MooseX::MungeHas { has => [], lazy => [qw/is_lazy/] }; | |
| lazy name => sub { "Bob" }; | |
| } | |
| say Person->new->name; |
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 My::Person; | |
| use Moo; | |
| use MooX::Press; | |
| has name => RO REQUIRED Str, documentation => 'Full name'; | |
| has favourite_number => RO DEFAULT { 7 } Int; | |
| 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
| use strict; | |
| use warnings; | |
| use Benchmark qw( cmpthese ); | |
| { | |
| package Example::Base; | |
| use Moo; | |
| use MooX::ValidateSubs; | |
| use Types::Standard qw/Str ArrayRef HashRef/; | |
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 strict; | |
| use warnings; | |
| use Benchmark qw( cmpthese ); | |
| { | |
| package Example::Base; | |
| use Moo; | |
| use MooX::ValidateSubs; | |
| use Types::Standard qw/Str ArrayRef HashRef/; | |
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
| # The old way | |
| use v5.10; | |
| use strict; | |
| use warnings; | |
| use Test::More; | |
| use Type::Tiny; | |
| use Types::Standard qw( Int ); |