I'm writing a build utility for a large Java application in Perl.

One of the requirements is that we be able to register EJBs with
our LDAP server. I have a script that builds a registration command
and then executes it using qx($cmd);.

The odd thing is, this works fine from a command line (i.e., registers
the EJB, generates and compiles the stubs), but from the same script
running through CGI I get a "Error creating context" error, which basically
means to me "something ain't right".

Now, I don't expect anyone to answer any questions about Java, but I
have to wonder what might be causing the problem. I'm running the exact
same script from cgi and from command-line:

from command-line:
C:\> perl ejbreg.pl

in the cgi script:
open(PS, "ejbreg.pl |") || die "Can't open script"; print "<DIV>"; while ($line=<PS>) { if($line=~/.*\n$/) { print "$line<BR>\n"; } else { print "$line"; } print ""; } print "</DIV>"; close(PS);



Are there are any differences between the runtime environments of
command-line scripts and scripts called from cgi?

Could it be that there are additional restrictions on the CGI script?
Could something restrict it from being able to contact the LDAP server?
(incidentally, the LDAP server resides on a separate machine from the
web server serving up the cgi).

Thanks for any help with this issue. I can provide additional code if needed

jbwiv

In reply to Differences between CGI and command-line versions of scripts?!? by jbwiv

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.