Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Class::Accessor attributes

by perldiverx (Beadle)
on Mar 07, 2014 at 13:06 UTC ( #1077374=perlquestion: print w/replies, xml ) Need Help??
perldiverx has asked for the wisdom of the Perl Monks concerning the following question:

I've created a module using Class::Accessor and I've used the 'antlers' pragma to use the Moose style interface for creating attributes, but I'm having a problem exporting these attributes. Per the documentation I've used extends on the attributes, but I can't seem to get them into the script that I'm using them in. I get a message stating that Perl 'Can't locate package transaction_type for @Monro::CC::ISA at C:/Perl/lib/Class/ line 36 (#1)'. Sample:
package Monro::CC; use strict; use warnings; use Class::Accessor "antlers"; extends(qw/transaction_type/); has transaction_type => ( is => 'rw', );
And part of the script that utilizes this:
#!/usr/bin/perl use strict; use warnings; use Monro::CC; my $transaction_info = read_psin(); my @transaction_info = @{$transaction_info}; my $trans_obj = Monro::CC->new( transaction_type => $transaction_info[0], );

Replies are listed 'Best First'.
Re: Class::Accessor attributes
by McA (Priest) on Mar 07, 2014 at 13:42 UTC


    with the line


    you say that you want to inherit from a package with name transaction_type. And the error message stats

    'Can't locate package transaction_type for @Monro::CC::ISA at C:/Perl +/lib/Class/ line 36 (#1)'

    which says that you don't have a module called transaction_type in the INC path.


      I thought about that when I created this initially, however the documentation on CPAN tells me to replace  @ISA = qw /Foo Bar/; with extends qw(/Foo Bar/);
      Even when I change this to your recommendation the script still warns that it cannot locate the package.

        Do you have a package called transaction_type? There must be something like somewhere in your INC path.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1077374]
Approved by rnewsham
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-05-25 03:39 GMT
Find Nodes?
    Voting Booth?