this is quite possibly a unix problem, not a perl one, but i am getting it via perl, so i have to start here...

in short, everything system call i'm making from a particular perl program returns 16777215 instead of zero. when i paste the relevent code into a new script to quickly test it alone, it returns 0. both do the same thing, with no errors.

the manner of calling can be system() or backticks, no difference. i am using root to run both the real program (a daemon...) and any test variants. any program i call on a shell returns 16777215, whether it is mv, rm, tar, etc... the program and any testing snippets are run from the same directory, with the same permissions, on the same files. the only difference in testing is that i'm not bothering to listen to a socket, i don't have a user connected to that socket, and i'm not fork()ing or eval()ing before i get to making the shell call...

the best solution i have is to find perl modules to do everything i already have perfectly good system calls to for... and i don't want to install new perl modules where i can possibly avoid it. it's worth avoiding having to update multiple servers to add a perl module for tar when they all have /usr/bin/tar already...

but a solution is not entirely what i need. i still don't know what the problem is... best guess there is a something like taint but with no complaints from perl as i'm not using taint... wouldn't know if the system can do that, but if anyone else would, it's a BSD (darwin) with perl 5.8.0
... my @output = `@command`; print $? >> 8, "\n";

this snippet is, verbatim, with anything i want in @command -- system() does the same, as i mentioned. contents of @output are exactly what they should be, files are manipulated as they should be, nothing ever on STDERR unless the command is wrong. (in which case i do get other error codes)

In reply to bizzare exit code by Xanatax

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.