Help for this page

Select Code to Download


  1. or download this
    package Bar;
    use Data::Dumper;
    ...
    sub bar
    {
        my $arg = shift;
    
  2. or download this
        if(ref($arg) eq 'ARRAY') {
            return map {
                $_->bar;
            } @{ $arg };
        }
    
  3. or download this
        print "bar\n";
    }
    ...
    }
    
    package main;
    
  4. or download this
    use autobox ARRAY => 'Bar';
    
  5. or download this
    
    Foo->new->foo->bar; 
    #no more "Can't call method "bar" on unblessed reference"
    #because now ->bar is a native method of ARRAYREFs.
    #actually all the methods of Bar are native methods on ARRAYREFs now.