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

Re: Factory classes in Perl

by jszinger (Scribe)
on Jan 11, 2021 at 19:24 UTC ( [id://11126761]=note: print w/replies, xml ) Need Help??


in reply to Factory classes in Perl

Here’s how I use factories. I have a module which can generate graphics in several different formats (SVG, PDF, etc). I created an OutputRole and a separate class implementing that role for each format ('Output::SVG', etc). Then, when it is time to create output, the OutputFactory takes the name of the output format and returns the appropriate class.

Log In?
Username:
Password:

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

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

    No recent polls found