Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 lurking in the Monastery: (5)
As of 2025-06-23 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.