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

remove attributes from constructor hash

Thread Next
Michael Potter
February 22, 2009 04:00
remove attributes from constructor hash
Message ID:

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


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About