Hi Michael, following to our discussion about the function redefinition problem in lib/cmds I'd like to provide you with the test code that I have prepared to implement solution 2).
Currently the 'use strict' at the beginning of initServer is commented out because otherwise the daemon will not start unless all problems are corrected. I recommend to comment out the generalError() function call after sourcing the cmd file to see all problems (not only the first one). The patch is against 0.9.2.1, but it should be easy to apply the concept to the CVS head as well. There are some switches in it for easier testing. Two variants of sourcing the cmd file are selectable using $method. Side effect: '1;' is no longer necessary at the end of the sourced files, but it would be possible to emulate this in the calling code. What do you think? Martin --- /home/bartosch/initServer 2004-12-16 15:56:42.000000000 +0100 +++ initServer 2004-12-16 15:55:05.000000000 +0100 @@ -5,7 +5,7 @@ ## Flush the output $|=1; -use strict; +#use strict; use vars qw (@ISA);; no warnings; @@ -99,8 +99,34 @@ foreach my $command (@cmds) { $command = $cmds_dir."/".$command; - my $result = eval "require \"$command\";"; - if (not defined $result) { + + my $rc = undef; + # FIXME/DEVELOPMENT choose the source method: + # 0: use unix cat command (dirty) + # 1: use sourcing from file handle + my $method = 0; + if ($method == 0) { + $rc = eval "use warnings FATAL => qw(redefine); " . `cat $command`; + } + if ($method == 1) { + local $/ = undef; + local *HANDLE; + open HANDLE, "<$command" and + $rc = eval "use warnings FATAL => qw(redefine); " . <HANDLE>; + close HANDLE; + } + + # FIXME/DEVELOPMENT enable this temporarily to see what errors were found + if (1) { + # extra debug + if (not defined $rc) { + print "rc not defined\n"; + } + if ($@) { + print "Error2 : [EMAIL PROTECTED]"; + } + } + if ($@ or (not defined $rc)) { generalError (i18nGettext ("The loading of the command __CMD__ failed. __ERRVAL__", "__CMD__", $command, "__ERRVAL__", $@)); ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ OpenCA-Devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/openca-devel