Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Class::DispatchToAll 0.11

    Download button

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

    License / Price:

    Last Updated:

    Category:
    Thomas Klausner | More programs
    Perl Artistic License / FREE
    July 21st, 2007, 21:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Class::DispatchToAll description

    Class::DispatchToAll Perl module can dispatch a method call to all inherited methods.

    Class::DispatchToAll Perl module can dispatch a method call to all inherited methods.

    SYNOPSIS

    package My::Class;
    our @ISA=qw(SomeClass SomeOtherClass More::Classes);
    use Class::DispatchToAll qw(dispatch_to_all);

    my $self=bless {},My::Class # not a proper constructor, I know..

    # this calls 'some_method' in all Classes My::Class inherits from
    # and all classes those classes inherit from, and all ... you get
    # the point.
    $self->dispatch_to_all('some_method');

    # saves all return values from all calls in an array
    my @returns=$self->dispatch_to_all('some_method');

    See the Docs of Damian Conways Module Class::Delegation for a good introduction about Dispatching vs. Inheritance.

    Class::DispatchToAll enables you to call all instantances of a method in your inheritance tree (or labyrinth..).

    The standard Perl behaviour is to call only the lefternmost instance it can fing doing a depth first traversial.

    Imagine the following class structure:
    C
    /
    A B C::C
    / /
    A::A D
    /
    My::Class

    Perl will try to find a method in this mess in this order:

    My::Class -> A::A -> A -> B -> D -> B -> C::C -> C
    (Note that it will look twice in B because B is a parent of both A::A and D))

    As soon as Perl finds the method somewhere, it will short-circuit out of it's search and invoke the method.

    And that is exactly the behaviour Class::DispatchToAll changes.

    If you use dispatch_to_all (provided by Class::DispatchToAll) to call your method, Perl will look in all of the aforementioned packages and run all the methods it can find. It will even collect all the return values and return them to you as an array, if you want it too.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    dispatch method call | Perl functions | Perl module | Class::DispatchToAll | dispatch | method

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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