Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Using $variable in place of "Method" in Module::Submodule::Method( @args )

by izut (Chaplain)
on Aug 23, 2006 at 19:25 UTC ( [id://569183]=note: print w/replies, xml ) Need Help??


in reply to Using $variable in place of "Method" in Module::Submodule::Method( @args )

Here is an example:

#!/usr/bin/perl use strict; use warnings; package Module::MyModule; sub pass { my ($function, @args) = @_; my $f = \&{"Module::MyModule::" . $function}; return $f->(@args); } sub test { my (@args) = @_; return join ", ", @args; } package main; print Module::MyModule::pass("test", qw(1 2 3 4));

Update: modified to support strict.

Igor 'izut' Sutton
your code, your rules.

  • Comment on Re: Using $variable in place of "Method" in Module::Submodule::Method( @args )
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://569183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-16 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found