Attribute::Method::Typeable

Attribute::Method::Typeable is a Perl module that implements a series of attribute handler methods.
Download

Attribute::Method::Typeable Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jeremiah Jordan
  • Publisher web site:
  • http://search.cpan.org/~jjordan/Attribute-Method-Typeable-1.09/lib/Attribute/Method/Typeable.pm

Attribute::Method::Typeable Tags


Attribute::Method::Typeable Description

Attribute::Method::Typeable is a Perl module that implements a series of attribute handler methods. Attribute::Method::Typeable is a Perl module that implements a series of attribute handler methods for use with function and method argument checking.SYNOPSIS package MyClass; use mixin qw{ Attribute::Method::Typeable }; #or use base qw{ Attribute::Method::Typeable }; sub myMethod :Public( int int ) { my $self = shift; my ($a, $b) = @_; return $a + $b; } sub otherMethod :Public( OtherClass SomeClass ) { my $self = shift; my ($obj1, $obj2) = @_; # methody stuff here. } sub privateMethod :Private( scalar, Scalar, SCALAR ) { my $self = shift; my $literal = shift; my $litOrRef = shift; my $scalarRef = shift; # methody stuff. } sub protectedMethod :Protected( other ) { my $self = shift; my $anything = shift; # methody stuff. } sub functiony :Function( ARRAY, CODE, HASH ) { # functiony stuff here. my ($arrayRef, $codeRef, $hashRef) = @_; } sub functionz :Function( float ARRAY o list ) { my ($arg1, $arg2, @else) = @_; $arg2-> = $arg1; if(scalar(@else)) {} # other functiony stuff. } ### In your code: # okay: $object->myMethod( 1, 2 ); # throws an Exception::ParamError exception: $object->myMethod( 1, "apple" ); # also throws an Exception::ParamError exception: $object->myMethod( 7 ); # throws an Exception::MethodError exception: myMethod('MyClass', 3, 4 ); # also throws an Exception::MethodError exception # unless it's in MyClass: $object->privateMethod( OtherClass->new, SomeClass->new ); # also throws an Exception::MethodError exception # unless it's in MyClass or a subclass of MyClass: $object->protectedMethod( $thingy );Requirements:· Perl· Attribute::Handlers· Data::Types· Test::SimpleUnit· Scalar::Util· Hook::WrapSub· Exception::Class


Attribute::Method::Typeable Related Software