Re: OO and Inheritance



wrote:

> I have a question either about OO in general, or its implementation in
> Perl--I'm not sure which because I don't know enough.
>
> I've created the module Net::Browser::InternetExplorer. It drives an
> IE instance.
>
> I want to eventually create modules for driving other browsers--like
> Net::Browser::FireFox . I would like to be able to say, therefore:
>
> my $browser = Net::Browser->new( flavor => 'InternetExplorer', $URL );
>
> or
>
> my $browser = Net::Browser->new( flavor => 'FireFox', $URL );

Or

my $browser = Net::Browser::Firefox( $url );
my $browser = Net::Browser::InternetExplorer( $url );

Is there a reason why you want to pass it as a parameter? If so, it
sounds like you want to do something with plug ins, e.g.

Otherwise, in the new of Net::Browser you try to use
Net::Browser::YourBrowser, if ok, you call new, and return the instance.

> know which OO concept or catchphrase I should be looking for!

Factory:

<http://www.vico.org/pages/PatronsDisseny/Pattern%20Abstract%20Factory/>
<http://www.pasteur.fr/formation/infobio/python/ch18s06.html>

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

.



Relevant Pages

  • Re: Proper Way to Gap Spark Plugs?
    ... You must live in Perfectland, where there's never a traffic jam, ... > cracked egg in the carton...and every spark plug comes from the factory ... my spark plug gaps are always right. ...
    (rec.autos.tech)
  • Re: 3 prong outlet, which way is up?
    ... plugged in plug. ... Years ago I worked at a factory where the electricians were required ... to install all outlets ground up. ... I will install two duplex outlets in each location and one will ...
    (alt.home.repair)
  • Re: Looking up a value using a range
    ... > I have a spread sheet that you plug in a date and then enter another ... The second date is the on I would like to automate. ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: figure placed out of screen
    ... So I closed matlab and re started to check for the ... Runned a script and the figure disappeared from the ... back to factory. ... Prev by Date: ...
    (comp.soft-sys.matlab)
  • Re: Proper Way to Gap Spark Plugs?
    ... never an undercooked or overcooked meal, never a billing error, never a cracked egg in the carton...and every spark plug comes from the factory gapped perfectly for your particular engine. ...
    (rec.autos.tech)

Loading