I am not getting the same error when I run this code:

{ package My::Class; { use strict; use Class::Std; my %_handler_map :ATTR; # Holds trigger names and states. # ... further down # ============================================================== +============= # METHOD: register_handler(%registration_hash) # REQUIRES: A hash with the following parameters ... # trigger: The state which triggers the handler. # handler: The name space string (Triggered::Handler) which i +s triggered. # RETURNS: # true: If the trigger and handler both are present and are s +tored. # false: If the trigger or handler are not valid (present). # other: An error is thrown if the trigger and handler are val +id but # but they do not get stored. # # PURPOSE: Register state handlers and triggers. # -------------------------------------------------------------- +------------- sub register_state { my ($self, %arguments) = @_; my $trigger = $arguments{'trigger'} || return(undef()); my $handler = $arguments{'handler'} || return(undef()); # ... Here is the part I am having problems with. $_handler_map{ident($self)}{$trigger} = $handler; # Do error checking here. Throw an error if needed. return(1); } } } my $state_arguments = { 'form_data' => {} }; my $state_manager = My::Class->new($state_arguments); $state_manager->register_state( 'trigger' => 'welcome', 'handler' => 'Handler::Welcome', )
Which seems to confirm my suspicion that the problem is elsewhere in your class. The error you are tripping in Class::Std is in one of the (IMHO) darker corners of the module. Something as simple as what you have demonstrated in the OP should not be causing that error. Perhaps if you posted your entire class, the issue might be more obvious to spot.

-stvn

In reply to Re^3: Desperatly seeking CSW (Class::Std Wisdom) by stvn
in thread Desperatly seeking CSW (Class::Std Wisdom) by krisahoch

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.