Object::MultiType

Perl Objects as Hash, Array, Scalar, Code and Glob at the same time
Download

Object::MultiType Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Graciliano Monteiro Passos
  • Publisher web site:
  • http://search.cpan.org/~gmpassos/

Object::MultiType Tags


Object::MultiType Description

Perl Objects as Hash, Array, Scalar, Code and Glob at the same time Object::MultiType is a Perl module to return an object that works like a Hash, Array, Scalar, Code and Glob object at the same time.The usual way is to call it from your module at new(): package FOO ; use Object::MultiType ; use vars qw(@ISA) ; @ISA = qw(Object::MultiType) ; ## Is good to 'Object::MultiType' be the last in @ISA! sub new { my $class = shift ; my $this = Object::MultiType->new() ; bless($this,$class) ; }SYNOPSIS use Object::MultiType ; my $scalar = 'abc' ; my @array = qw(x y z); my %hash = (A => 1 , B => 2) ; my $obj = Object::MultiType->new( scalar => \$scalar , array => \@array , hash => \%hash , code => sub{ return("I'm a sub ref!") ; } glob => \*STDOUT , ) ; print "Me as scalar: $obj\n" ; my $array_1 = $obj-> ; print "$array_1\n" ; my $hash_B = $obj->{B} ; print "$hash_B\n" ; my $hash = $$obj->hash ; foreach my $Key (sort keys %$hash ) { print "$Key = $$hash{$Key}\n" ; } &$obj(args) ; Requirements: · Perl


Object::MultiType Related Software