Advertisement
Guest User

Untitled

a guest
Aug 26th, 2014
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.41 KB | None | 0 0
  1. #Perl 6
  2. class Foo {
  3.     has Hash $.args;
  4.  
  5.     method init (Array @args){
  6.         $.args(@args);
  7.     }
  8. }
  9.  
  10. #Perl 5
  11. package Foo {
  12.     sub new { return bless {}, $_[0]}
  13.  
  14.     sub args {
  15.     my $self = shift;
  16.         $self->{args} = @_;
  17.         return $self->{args};
  18.     }
  19.  
  20.     sub run {
  21.          my ($self, @args) = @_;
  22.          $self = $self->new() unless ref $self;
  23.  
  24.      $self->args(@args);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement