Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

comment on

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

No problem!

Received an update from Tomasz with a better way. Per Tomasz: "non-anonymous subroutine definitions in perl are being executed in compile time, which means the subs will be created even when the condition in your if is false. That means they can conflict with the future versions of Win32::Daemon."

Better solution provided by Tomasz, which works for me:

use Win32::Daemon; # restore AUTOLOAD sub which was erroneiously removed in 20181025 vers +ion of Win32::Daemon # note that newer versions of Win32::Daemon don't use AUTOLOAD at all if ($Win32::Daemon::VERSION == 20181025) { package Win32::Daemon; *Win32::Daemon::AUTOLOAD = sub { no strict; no warnings; # This AUTOLOAD is used to 'autoload' constants from the const +ant() # XS function. If a constant is not found then control is pas +sed # to the AUTOLOAD in AutoLoader. my( $Constant ) = $AUTOLOAD; my( $Result, $Value ); $Constant =~ s/.*:://; $Result = Constant( $Constant, $Value ); if( 0 == $Result ) { # The extension could not resolve the constant... $AutoLoader::AUTOLOAD = $AUTOLOAD; goto &AutoLoader::AUTOLOAD; return; } elsif( 1 == $Result ) { # $Result == 1 if the constant is valid but not defined # that is, the extension knows that the constant exists bu +t for # some wild reason it was not compiled with it. $pack = 0; ($pack,$file,$line) = caller; print "Your vendor has not defined 'Win32::Daemon' macro $ +constname, used in $file at line $line."; } elsif( 2 == $Result ) { # If $Result == 2 then we have a string value $Value = "'$Value'"; } # If $Result == 3 then we have a numeric value eval "sub $AUTOLOAD { return( $Value ); }"; goto &$AUTOLOAD; } }

In reply to Re^10: Win32::Daemon service doesn't reach RUNNING state by SwaJime
in thread Win32::Daemon service doesn't reach RUNNING state by SwaJime

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 surveying the Monastery: (5)
As of 2022-08-17 07:26 GMT
Find Nodes?
    Voting Booth?

    No recent polls found