Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: CGI::Application and object inheritance

by spork (Monk)
on Jul 27, 2005 at 15:45 UTC ( [id://478652]=note: print w/replies, xml ) Need Help??

in reply to Re: CGI::Application and object inheritance
in thread CGI::Application and object inheritance

Thanks for the input cfreak. What is missing from the code sample is the actual CGI script which calls the new() defined in C::A. I am new to OO use and your answer sheds some light on where my package fits in the big picture. Thanks again.
  • Comment on Re^2: CGI::Application and object inheritance

Replies are listed 'Best First'.
Re^3: CGI::Application and object inheritance
by cfreak (Chaplain) on Jul 28, 2005 at 03:55 UTC

    Ahh but it does

    In your script you just need to call:

    my $cgi_app = Foo->new();

    Sorry that wasn't clearer. new() in package Foo makes the call my $self = $class->SUPER::new(). Because of the use base statement SUPER now refers to C::A. $cgi_app is an object from which you can access your own methods or the C::A methods. If you need to pass opts to C::A you can modify new() in Foo. I'd modify it so you can pass the opts to the Foo package and it passes them on.

    Hope that makes it a bit clearer

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (1)
As of 2024-06-12 18:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    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.