http://qs321.pair.com?node_id=566184


in reply to Re^2: Desperatly seeking CSW (Class::Std Wisdom)
in thread Desperatly seeking CSW (Class::Std Wisdom)

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

Replies are listed 'Best First'.
Re^4: Desperatly seeking CSW (Class::Std Wisdom)
by krisahoch (Deacon) on Aug 08, 2006 at 20:30 UTC

    stvn,

    I figured out what was going on. Originally I was calling all of these methods from a web-based script. The server cached one of these temp files and that is where the problem has been. I actually solved this particular issue along time ago. When I went and did what you did (command-line script) the problem disappeared. It also prompted me to get a Apache Reboot as well. Thank you for your time.

    Kristofer