Paul Medynski wrote: > In Sys::Syslog, you cannot use LOG_EMERG (or 'emerg', etc). Doing so > results in the following error: > > syslog: invalid level/facility: LOG_EMERG at yadayada.pl line 275
Thanks for your report (and your correct analysis thereof). This problem appears to have been corrected in perl 5.8.0, where the xlate() function is : sub xlate { local($name) = @_; $name = uc $name; $name = "LOG_$name" unless $name =~ /^LOG_/; $name = "Sys::Syslog::$name"; # Can't have just eval { &$name } || -1 because some LOG_XXX may be zero. my $value = eval { &$name }; defined $value ? $value : -1; } > The problem is in Sys::Syslog::xlate() > > sub xlate { > local($name) = @_; > $name = uc $name; > $name = "LOG_$name" unless $name =~ /^LOG_/; > $name = "Sys::Syslog::$name"; > eval { &$name } || -1; > } > > In the last line, &$name evaluates to 0, via the AUTOLOAD sub, which is the > correct integer value of LOG_EMERG, and so the subroutine returns -1. In > our Perl 5.005_03 installation, the xlate() sub looks like this: > > sub xlate { > local($name) = @_; > $name = uc $name; > $name = "LOG_$name" unless $name =~ /^LOG_/; > $name = "Sys::Syslog::$name"; > defined &$name ? &$name : -1; > } > > This implementation works correctly, and returns the value 0 for LOG_EMERG.