Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Attribute::Method::Typeable 1.09

    Download button

    No screenshots available
    Downloads: 364  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jeremiah Jordan | More programs
    Perl Artistic License / FREE
    September 3rd, 2007, 20:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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->[0] = $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



    Product's homepage

      


    TAGS:

    attribute handler | argument checking | Perl module | attribute | typeable | Perl

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM