nntp.perl.org wrote:
> Hello all.
> I've written a module to deal with the issue of inheritable class data
> (yes, yet another one).
> What's peculiar with it is that it doesn't rely on accessor methods.
> After declaration, you can use the variables just like any other package
> variable but you can inherit and override those variables in other
> packages/classes.
> I'm thinking of calling the module Package::Data::Inheritable which
> should reflect the emphasis on package variables rather than on classes.
>
> Before uploading to CPAN I would like to check whether I missed some
> module that does the same and if the proposed name/namespace is good. 

Not sure what you're trying to do. Is it this?

  package A;
  our $DATA = 'A';

  package B;
  use base 'A';
  our $DATA = 'B';

  package C;
  use base 'A';
 
And then:

  $A::DATA # 'A'
  $B::DATA # 'B'
  $C::DATA # 'A'

If so, I don't know of anything on CPAN that does this.  However, I
think inheriting variables is a *terrible* idea. 

What is your reason for wanting to use variables instead of properly
delegating to methods?

Regards,
Jonathan Rockway

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to