develooper Front page | perl.moose | Postings from February 2009

remove attributes from constructor hash

Thread Next
From:
Michael Potter
Date:
February 22, 2009 04:00
Subject:
remove attributes from constructor hash
Message ID:
167f9c460902220400v67463491w987af8cb9f6408c1@mail.gmail.com
Hi

I am extending a non-Moose class, and I want to add an attribute to my
derived class. Problem is, the base class complains (loudly) if it
gets attributes it was not expecting - and it seems the new attribute
in the derived class get passed down to the base, hence the problem.
Is there an easy way to remove an attribute from the constructor hash
once it has been used to initialize an attribute? Something like this
would be nice:

has type => (
    is        => 'ro',
    gobble => 1 # remove element from constructor hash when used to
initialize this attribute
);

Cheers

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About