Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Modules design pattern: abstraction vs incarnation (providing not so static data)

by karlgoethebier (Abbot)
on Nov 22, 2020 at 10:55 UTC ( [id://11124013]=note: print w/replies, xml ) Need Help??


in reply to Modules design pattern: abstraction vs incarnation (providing not so static data)

"...I was suggested to use a role for this...

Not a bad idea. Why don't you give it a try?

For further inspiration you may probably read this:

See also:

Best regards, Karl

P.S.: Little addendum: Years ago i wrote this little sketch for Lady_Aleena to illustrate what was my idea/understanding of a plugin:

package MyClass; use Class::Tiny qw(something); use Role::Tiny::With; use feature qw(say); say q(package ) . __PACKAGE__; with qw(MyRole); 1; package MyRole; use Role::Tiny; use feature qw(say); requires qw(something); say q(package ) . __PACKAGE__; around 'something' => sub { print q(Long John Silver said ); uc &{ (shift) }; }; 1; #!/usr/bin/env perl use strict; use warnings; use MyClass; use feature qw(say); say q(package ) . __PACKAGE__; my $object = MyClass->new( something => q("I reckon i settled you.") ) +; say $object->something; __END__

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found