[Chicago-talk] Asking an class for its method list

Steven Lembark lembark at wrkhors.com
Mon Jan 26 09:15:37 CST 2004



-- Jay Strauss <me at heyjay.com>

> Well, I was going to use it because I have one module (client) which the
> caller requests methods like:
>
> reqMktData
> placeOrder
> cancelOrder
>
> this module then calls a liked named function on my poe server.  I figured
> instead of writing a specific function in this module for each function on
> the poe server.   I would just dynamically check it that function exists,
> and handle all the calls with AUTOLOADER.  Unfortunately, the module::info
> takes too long so instead I just have a list of functions available and
> still use AUTOLOADER to call them


    my $othermodule = 'What::Ever';

    sub AUTOLOADER
    {
        my $name = ...


        if( my $sub = $othermodule->can( $name ) )
        {
            # call it or install it.
        }
    }

--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list