I'm experiencing a very strange error (strange for my limited experience, anyway) with Proc::Daemon.

I have a perl daemon that fails with the error message:

Can't call method "isa" on unblessed reference at /usr/local/share/perl/5.14.2/Proc/Daemon.pm line 88, <STDIN> line 3.

The line 88 in question from Proc::Daemon is this one:

unless ( ref( $self ) && eval{ $self->isa( 'Proc::Daemon' ) } ) {

It is located in the "Init" subroutine in Proc::Daemon.

The reason that I'm calling this error "bizarre" is because a) Why is the script dying when executing an expression in an eval? Isn't that the whole point of eval? b) This script was working not 2 weeks ago when I was testing it on this same system. During that time there have not been any updates to the Proc::Daemon module or to Perl.

Here is the code that calls Proc::Daemon:

Proc::Daemon::Init({ work_dir => '/tmp', setuid => 'some_uid' });

I do have a custom DIE signal handler (which I thought might be the cause of the error, but if so, I must not understand something about the way evals work). It looks like this:

$SIG{'__DIE__'} = sub{ write_to_log('FATAL! '.join(' ', @_)); die; };

Can anybody shed some light on this thing?

Edited to Add: Further poking around has narrowed the problem down to the setuid parameter for Proc::Daemon::Init. If I remove it, the script runs fine. However, this means the script is running as root and I would like to avoid that. Investigatining further...


In reply to Bizarre Proc::Daemon error by xtpu2

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.