Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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.


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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-06-29 06:55 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (95 votes). Check out past polls.