Hi,
I would like to subclass the Log::Agent class and keep the complete interface. I can do a:
use base qw( Log::Agent );
But then, off course I loose the exported functions and also some magical variables, as I call them.
For example, Log::Agent has the notion of a $Driver variable.
Normally it is a class variable, so how do I let the two packages (parent
and inherited) behave the same?
First
use Log::Agent;
$Log::Agent::Driver = ...
Second
use My::Log;
$My::Log::Driver = ...

Would I need to redefine the $Driver variable in My::Log, or does the inheritance mechanism of Perl (looking in the parent class) only works for methods?


johanvdb

Edit kudra, 2002-05-07 Took care of unclosed pre


In reply to Inheritance and exported methods by johanvdb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.