> I can probably figure this out if I spend some time but as I was going
through
> it more questions were raised.
>

Some time, or some more time.  Some time is usually expected....
 
> Is it possible for a Perl script to check if a subroutine exists in a
module
> without actually invoking that subroutine?  
> 

perldoc UNIVERSAL specifically the 'can' function.

> I have a Perl module that contains a bunch of subroutines.  I need to
pass the
> name of one or more subroutines on the command line to another Perl
script.  I
> would like to avoid hard-coding the subroutine names on the command
line and
> at the same time automatically ensure I never pass the name of a
subroutine
> that does not exist.  I guess I need to abstract the subroutine names
somehow
> and I'm wondering what my options are.  I was thinking of having
constants in
> the module, one for each subroutine name, but there seems to be a little
> duplication there.  When I'm composing the command line (in Perl), is
there
> some way I can check if a subroutine of a given name exists in the
module?  I
> would like to die under such conditions.
> 
> I know there is some way to get a reference to a subroutine.  If I can
figure
> out how to get this reference (which I assume would be undef or
something if I
> try to get a reference to a subroutine that does not exist) that would
> probably help, but I am not sure of the syntax or if that's the right
approach.
> 
> Are there reflection classes for dealing with things like this?
> 
> I did search the web (a little) but wasn't sure where to start in the
perldocs.
> 
> 

See if the above helps.  All of this seems a little fishy, what is the
overall goal and why do you need to pass sub names to a separate script?

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to