SPUG: Choosing an object's method at runtime

Mark Lybrand markyesme at home.com
Wed May 24 14:27:39 CDT 2000


You can also use the can method which returns a reference to the method if
is available to a particular object.

Mark :)

----- Original Message -----
From: "Marty D. Cudmore" <marty.d.cudmore at boeing.com>
To: <spug-list at pm.org>; "'Sanford Morton'" <smorton at pobox.com>
Sent: Wednesday, May 24, 2000 9:13 AM
Subject: RE: SPUG: Choosing an object's method at runtime


> Using the $obj->$meth() syntax is the ONLY way, I've ever gotten this to
work.  I'm not sure of a manpage, but the syntax is outlined on page 254 of
the Camel under Symbolic References.
>
> Cheers,
>
> Marty
>
>
> ----------
> From: Sanford Morton[SMTP:smorton at pobox.com]
> Sent: Tuesday, May 23, 2000 5:31 PM
> To: spug-list at pm.org
> Subject: SPUG: Choosing an object's method at runtime
>
> I'm feeling particularly dense today. I want to choose an object's
> method at run time:
>   $object = new Some_Class;
>   $method = 'stop';
> But then
>   $object->$method;
> gets a syntax error, whereas
>   $object->$method();
> seems not to.
>
> Does anyone know which man page covers this? I'm clueless. I need more
> sleep. --Sandy
>
>
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
>  For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
>
>
>
>
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
>  For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
>
>


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list