Perl Monks:

I have a problem changing from 'Class::Accessor::Fast' to 'Class::Accessor::Faster'. From what I understood, simply changing from Fast to Faster should have required no code modification; however, when a script invokes and tries to use this module I receive the error:

"Not an ARRAY reference at /usr/local/bin.../Class/Accessor/Faster.pm"

The code for the module:

#!/usr/bin/perl #Atom.pm #Contains the methods for Atom, an object that represents an atom with +in a compound. package Atom; use base 'Class::Accessor::Faster'; use strict; #use warnings; #The following hashes to allow for conversion of mol file charge code +to accepted numerical representations of charge and oxidation. my %SDF_charge_conversion = (2 => 2, 3 => 1, 4 => "Doublet Radical", 5 + => -1, 6 => -2, 7 => -3, 0 => 0); my %SDF_oxidation_modification = (2 => 2, 3 => 1, 4 => 1, 5 => 1, 6 => + 2, 7=> 3, 0 => 0); #Create prototypical atom object my @atom_fields = ( "element" => 0, #a string representing the element type +of the atom "SDF_charge" => 0, #an integer representing the SDF_charge +code of the atom "index" => 0, #an integer representing the index of th +e atom in the Atoms array of the molecule "bond_count" => 0, #an integer representing the number of b +onds that contain the atom "bond_order_count" => 0, #an integer representing the sum of all +bond orders of the bonds that contain the atom "oxidation_modifier" => 0, #an integer representing the oxidation s +tate of the atom (calculated from charge) "charge" => 0, #an integer representing the charge of t +he atom (calculated from charge) ); Atom->mk_accessors( grep { $_ ne "0"; } (@atom_fields)); #Name: new #Description: Creates a new 'atom' object #Options: None #Input: @_ - @(element, SDF_charge, index, bond_count, bond_order_coun +t, oxidation_modifier, charge) #Output: $self - Atom Object sub new { my $proto = shift @_; my $self = { @atom_fields, @_ }; $self = bless ($self, ref($proto) || $proto); $self->oxidation_modifier($SDF_oxidation_modification{$self->SDF_cha +rge}); $self->charge($SDF_charge_conversion{$self->SDF_charge}); return $self; } 1;

The only change I made was changing Fast to Faster to receive the error. I thought the differences were internal. If any one could help me figure out why I get this error and what modifications I need to make it work, I would greatly appreciate it. I can post the script that envokes the module if needed, but its large and I don't think it would help.


In reply to Problem with Class::Accessor::Faster by jmmitc06

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.