Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Perl 6
- class Foo {
- has Hash $.args;
- method init (Array @args){
- $.args(@args);
- }
- }
- #Perl 5
- package Foo {
- sub new { return bless {}, $_[0]}
- sub args {
- my $self = shift;
- $self->{args} = @_;
- return $self->{args};
- }
- sub run {
- my ($self, @args) = @_;
- $self = $self->new() unless ref $self;
- $self->args(@args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement