[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Collection.pm



I wrote this object class for a program of mine. Just thought it might
be interesting.

package Collection;
use strict;
use vars qw($AUTOLOAD);

sub new {
  my $class = shift;
  my $self = bless [@_], $class;
  return $self;
}

sub AUTOLOAD {
  my $self = shift;
  my ($method) = $AUTOLOAD =~ /::([^:]+)$/;
  return if $method eq 'DESTROY';
  foreach my $thing (@$self) {
    $thing->$method(@_);
  }
  return;
}

1;
__END__

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe