Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: dynamic method creation, dispatch table or pseudo methods?

by choroba (Archbishop)
on Apr 18, 2021 at 19:56 UTC ( #11131440=note: print w/replies, xml ) Need Help??

in reply to dynamic method creation, dispatch table or pseudo methods?

Another possibility would be to create an abstract class with
sub dumper { die 'Dumper not defined in the abstract class!' }
then subclass it with MyClass::Dumper where you override the sub:
use Data::Dumper; sub dumper { my ($self, @data) = @_; print Data::Dumper::Dumper(@data); }
If the user wants to use a different Dumper, they can subclass the abstract class with a different implementation of the dumper.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2021-10-26 06:38 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (90 votes). Check out past polls.