in reply to Strange Behaviour with Backticks

Did you over-simplify the matter? Are the parameters really 'A' and 'B' ? or are they something else? What binary are you running? Does it switch filehandles based on input? It's hard to tell.

For debugging, that varies (by platform). First, check what's in $?, maybe your binary just dies. On linux, I'd run the perl script with strace -f -ff -o outputfile script.pl. For solaris, there's truss, ktrace on *BSD. Oh, and then - "use the source, luke" - if you have them, that is ;-)

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Strange Behaviour with Backticks
by neversaint (Deacon) on Jul 21, 2006 at 14:47 UTC
    Dear shmem,
    Did you over-simplify the matter?
    Well, actually it runs under a CGI script (See the code in my reply to Fletch below).
    I hope this doesn't make the difference...
    Are the parameters really 'A' and 'B' ? or are they something else?
    They consist of two characters ('AB','CD').
    What binary are you running?
    They are C binary.
    Does it switch filehandles based on input? It's hard to tell.
    Not so sure. How can I check that?

    ---
    neversaint and everlastingly indebted.......
      Hello neversaint,

      I hope this doesn't make the difference...

      Well, it must not, but it could, as fletch notes below. Running under apache there's no tty. Environment is different. If under chroot, even more. Search paths could be different. UID/GID, etc.

      They consist of two characters ('AB','CD').

      Literally AB and CD What are these for? Floppy disk and hard disk labels?

      They are C binary.
      And what is it supposed to do? You scarce informations leave me to just guessing :-/
      Not so sure. How can I check that?
      As i told you. What OS are you running? If Linux, strace(1) the binary. You should see access(), open() and ioctl() calls. If they involve a tty when run with AB, but not when run with CD, there you have it. If running on some *BSD, ktrace(1) it and kdump(1) the output. If Solaris, use truss. If Windows, grab some stuff from Sysinternals^WMicrosoft.

      Do you have the source for the binary? a man page? any documentation? What's it's real name, anyways?

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ---222----------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}