[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[ID 20000109.004] chaining multiple commands in a perl 'open' call




Hi peoples

for some reason you can not chain multiple commands inside an 'open' sub
routine call ...  the second 'open' call is the one you're interested in.

details:

OS       - Solaris 2.7
Compiler - cc: WorkShop Compilers 5.0 98/12/15 C 5.0
Perl     - 5.005_03

Apache/CGI enviroment

     - Apache/1.3.9 (Unix) mod_perl/1.21 mod_ssl/2.4.8 OpenSSL/0.9.4


ok this DOES NOT work
------------------------
    my $tmpfile = "/tmp/mailer-input-$$";
    my $mailer = "/usr/lib/sendmail -t";

    open(MAILER_INPUT, ">$tmpfile") || warn;

    print MAILER_INPUT <<"EOF";
From: scum@scum.coma
Return-Path: scum@scum.coma
Reply-To: scum@scum.coma
To: youraddress@where.coma
Subject: subject line goes here

and here is the user message

EOF

    close(MAILER_INPUT);

    open(MAILER, "$mailer < $tmpfile|") || warn;
    while(<MAILER>) { print $_; }
    close(MAILER);

-----------------------

and this DOES work

-----------------------

    my $mailer = "/usr/lib/sendmail -t";

    print MAILER_INPUT <<"EOF";
From: scum@scum.coma
Return-Path: scum@scum.coma
Reply-To: scum@scum.coma
To: youraddress@where.coma
Subject: subject line goes here

and here is the user message

EOF

    open(MAILER, "|$mailer") || warn;
    print MAILER $allmsg;
    close(MAILER);

---------------------

what is it so?? buggered if I know what the problem is and it ainst
anything to do with a glass and a half of full cream dairy milk

this is actually the second script I've had to fix up. The first was the
script that inserted stuff into the fulcrum search engine. So if things
start magically not working in perl check out your scripts. This is only
apparent on spider and it only started happening in the last six weeks or
so. I installed the current installation of perl in November, so it could
have been broken since back then. The only thing really different is that
I've compiled most of the stuff on spider with SparcWorks 5.0 and
everything was definately working before then...



--
 Michael.Dean@detir.qld.gov.au ,-_|\  UNIX Support
                              /     * Dept of Employment, Training
  Phone: +61 7 3247 5724      \_,-._/ and Industrial Relations
    Fax: +61 7 3247 9111           v  http://www.detir.qld.gov.au/

   "It's funny how, money allows, all to browse and be endowed"
                               -- Foo Fighters


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]