Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: module as parameter

by anonymized user 468275 (Curate)
on Sep 21, 2017 at 12:21 UTC ( [id://1199827]=note: print w/replies, xml ) Need Help??


in reply to module as parameter

ML functor wouldn't help either, because parameter I is insufficient to determine which of A B C is indicated. So I will assume you mean that the implementation also needs to be indicated in the call. But we still need to know what are the criteria for choosing which implementation. Example of parameter driven calling however:
package Action; use Moo; has interface => (is => 'ro'); has implementation => (is => 'ro'); our %action = (IA => sub {&intIimpA;}, IB => sub {&intIimpB;}, IC => sub {&intIimpC;}, ); sub doAction { my $self = shift; &{$action{$self->interface . $self->implementation}}; } # sub intIimpA{ # implementation code in here } sub intIimpB{ } sub intIimpC{ } 1;

One world, one people

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-24 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found