Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* アトリビュート生成 (has)[#e94855b7]
hasを使う。
*** User.pm [#q43981cb]
package User;
use Mouse;
use URI;
has 'name' => ( is => 'rw', isa => 'Str' );
has 'age' => ( is => 'rw', isa => 'Int' );
has 'uri' => ( is => 'rw', isa => 'URI' );
__PACKAGE__->meta->make_immutable();
1;
*** main.pl [#c15804a5]
use User;
use URI;
my $user = User->new( name => 'taro', age => 10, uri => ...
say $user->name;
say $user->age;
say $user->uri;
終了行:
* アトリビュート生成 (has)[#e94855b7]
hasを使う。
*** User.pm [#q43981cb]
package User;
use Mouse;
use URI;
has 'name' => ( is => 'rw', isa => 'Str' );
has 'age' => ( is => 'rw', isa => 'Int' );
has 'uri' => ( is => 'rw', isa => 'URI' );
__PACKAGE__->meta->make_immutable();
1;
*** main.pl [#c15804a5]
use User;
use URI;
my $user = User->new( name => 'taro', age => 10, uri => ...
say $user->name;
say $user->age;
say $user->uri;
ページ名: