AI::FreeHAL::Class

Support for creating standard "inside-out" classes
Download

AI::FreeHAL::Class Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Tobias Schulz
  • Publisher web site:
  • http://search.cpan.org/~tschulz/

AI::FreeHAL::Class Tags


AI::FreeHAL::Class Description

Support for creating standard "inside-out" classes AI::FreeHAL::Class is a Perl module that offers support for creating standard "inside-out" classes.SYNOPSIS package MyClass; use AI::FreeHAL::Class; # Create storage for object attributes... my %name : ATTR; my %rank : ATTR; my %snum : ATTR; my %public_data : ATTR; # Handle initialization of objects of this class... sub BUILD { my ($self, $obj_ID, $arg_ref) = @_; $name{$obj_ID} = check_name( $arg_ref->{name} ); $rank{$obj_ID} = check_rank( $arg_ref->{rank} ); $snum{$obj_ID} = _gen_uniq_serial_num(); } # Handle cleanup of objects of this class... sub DEMOLISH { my ($self, $obj_ID) = @_; _recycle_serial_num( $snum{$obj_ID} ); } # Handle unknown method calls... sub AUTOMETHOD { my ($self, $obj_ID, @other_args) = @_; # Return any public data... if ( m/A get_(.*)/ ) { # Method name passed in $_ my $get_what = $1; return sub { return $public_data{$obj_ID}{$get_what}; } } warn "Can't call $method_name on ", ref $self, " object"; return; # The call is declined by not returning a sub ref }This module provides tools that help to implement the "inside out object" class structure in a convenient and standard way.Portions of the following code and documentation from "Perl Best Practices" copyright (c) 2005 by O'Reilly Media, Inc. and reprinted with permission. Requirements: · Perl


AI::FreeHAL::Class Related Software