Skip to content

Instantly share code, notes, and snippets.

View jjn1056's full-sized avatar

John Napiorkowski jjn1056

View GitHub Profile
my $deep_tuple = subtype 'deep_tuple',
as Tuple[
Int,
HashRef,
Dict[
name=>Str,
age=>Int,
],
];
my $deep_tuple = subtype 'deep_tuple',
as Tuple[
Int,
HashRef,
Dict[
name=>Str,
age=>Int,
],
];
use strict;
use warnings;
use Test::More;
use Moose::Util::TypeConstraints;
use MooseX::Types::Structured qw(Dict Tuple);
use MooseX::Types::Moose qw(Int);
my $deeper_tc = subtype
as Dict[
use MooseX::Declare;
class MyClass {
method mymethod(Str $aaa) {
return $aaa;
}
}
my $aaa = MyClass->new;
warn $aaa->mymethod(['aaa']);
use MooseX::Declare;
class MyClass {
method mymethod(Str $aaa) {
return $aaa;
}
}
my $aaa = MyClass->new;
warn $aaa->mymethod(['aaa']);
## doesn't seem to work
class MyClass with MyRole => {prefix=>"hello"} {
method mymethod(Str $aaa) {
return $aaa;
}
}
## Seems to work
method method_with_two_is_param_traits () is Moody
is Label(label => 'happy') {
return 1;
}
## Label looks like:
use Moose::Role;
has label => (
use MooseX::Declare;
role MyRole(Str :$prefix = "test") {
around mymethod($aaa) {
return $prefix .":". $self->$orig($aaa);
}
}
use MooseX::Declare;
role MyMethodTrait {
has repeat => (is=>'ro', isa=>'Int', required=>1, default=>2);
subtype PStr,
as Parameterizable[Str, Int),
where { length(shift) < shift) };
method(Int $length = 10)
my_name(PStr[$length] $name)
{
return "Hello $name!";
}
John-Napiorkowski-MacBook-Pro:~ johnn$ ssh 192.168.3.8
[email protected]'s password:
Last login: Fri Jul 9 10:05:40 2010 from 192.168.1.154
[johnn@lvs2-QA ~]$ ssh fs1
johnn@fs1's password:
Permission denied, please try again.
johnn@fs1's password:
Permission denied, please try again.
johnn@fs1's password:
Permission denied (publickey,gssapi-with-mic,password).