in reply to Class::Accessor Problem

Comment out the BEGIN{} block.

Update: I re-phrase that. Try taking the failing code out of the BEGIN() block.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Class::Accessor Problem
by PerlingTheUK (Hermit) on Nov 27, 2005 at 16:52 UTC
    BrowserUK,
    Thanks, but it does not work I tried to remove the line from the BEGIN block and I also completely removed the block. Either option did not make a difference to the error message.
    The actual benchmark script coming with this package is running fine in my environment and I cannot spot my error. The current code - which still produces the above quoted error is:
    package Variant; use strict; use warnings; use Exporter; use Class::Accessor; our ( @EXPORT, @EXPORT_OK, %EXPORT_TAGS ); @EXPORT = qw(); %EXPORT_TAGS= (); @EXPORT_OK = qw(); use base ( qw(Exporter Class::Accessor) ); our ( $VERSION, $LAST_ERROR ); __PACKAGE__->mk_accessor( qw(name nodes) );
    I have noticed, that the benchmark example as well as the examples in the documentation use either a base class with all fields defined or Class::Fields as base class. I intend - and only then does using Class:Accessor make sense to me to include it in a base class that does not yet know which fields are in my derived classes. Are there any issues with this setup? Do I need to define the fields of my class before calling mk_accessor( @fieldnames )

    Cheers,
    PerlingTheUK