許家瑋
and 1 contributors

NAME

Namespace::Dispatch - A dispatcher treating namespaces as a tree

SYNOPSIS

    # lib/Foo.pm
    package Foo;
    use Namespace::Dispatch;

    1;

    # lib/Foo/Bar.pm
    package Foo::Bar;
    use Namespace::Dispatch;

    1;

    # lib/Foo/Bar/Baz.pm
    package Foo::Bar::Baz;
    use Namespace::Dispatch;

    1;

    # lib/Foo/Bar/Baz/Next.pm
    package Foo::Bar::Baz::Next;
    use Namespace::Dispatch;

    1;

    # any.pl
    package main;
    use Foo;
    Foo->dispatch(qw(bar baz));            #=> Foo::Bar::Baz
    Foo->dispatch(qw(bar baz next));       #=> Foo::Bar::Baz::Next
    Foo::Bar->dispatch(qw(bar baz next));  #=> Foo::Bar::Baz::Next
    Foo->dispatch(qw(hello world));        #=> Foo

DESCRIPTION

Namespace::Dispatch is designed for the purpose that tasks are broke into a set of relevant, hierarchical modules. Implicit dispatching ability was attached into these modules when they are declared as members of this set. Any node in this hierarchy can serve the dispatching requests in recursive manner. That is, Any tree-like routing system can adopt the abstraction under the hood with its own invoking mechanism.

AUTHOR

shelling <navyblueshellingford@gmail.com>

SEE ALSO

App::LDAP

LICENSE

The MIT License