Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 wandering the Monastery: (2)
As of 2024-06-19 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.