Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Module Naming Dilemma

by jdporter (Paladin)
on Jan 05, 2005 at 21:59 UTC ( [id://419743]=note: print w/replies, xml ) Need Help??


in reply to Re: Module Naming Dilemma
in thread Module Naming Dilemma

gaal++, that is quite right. People often forget that class names are just package names, and package names are strings. Which means they can be stored in scalars.

One of the patterns I use a lot is Strategy, in which you typically select (programmatically) between several strategy classes to implement some piece of your application. One of the nice things about Perl is that class names are ordinary objects. So I can do things like this:

use Output::Console; use Output::Tk; my $output_strategy = -T STDOUT ? 'Output::Console' : 'Output::Tk'; my $output = $output_strategy->new();
The same principle could be used to shorten long class names.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-20 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found