[11565] in Perl-Users-Digest
Perl-Users Digest, Issue: 5165 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 18 11:17:21 1999
Date: Thu, 18 Mar 99 08:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 18 Mar 1999 Volume: 8 Number: 5165
Today's topics:
Re: adding a number to an existing value in another fil <Allan@due.net>
Re: Expect module (spawned proc won't die) <acox@cv.telegroup.com>
find command problem <ilya_NOSPAM_@napavlly.rose.hp.com>
Re: flock() on Alpha/VMS <techno@umbriel.demon.co.uk>
Getting output from Java program on UNIX dcotteri@my-dejanews.com
Re: glob failed <srobert@anv.net>
Re: How to redirect Output? <Allan@due.net>
Is this "perlish" starplayer2@my-dejanews.com
Re: Is this "perlish" <Allan@due.net>
Re: Is this "perlish" <cmcurtin@interhack.net>
Re: Is this "perlish" (David Cantrell)
Re: Is this "perlish" (M.J.T. Guy)
Re: Modules, how to build in local directory? (Charles Packer)
Ms-Mail from perl massimobalestra@my-dejanews.com
Oracle Connection ashroff_moksha@yahoo.com
Re: Ouput to textbox w/o rewriting page <wells@cedarnet.org>
parse exception with avtivestateperl 509 <gehring@politik.uni-mainz.de>
Re: Perl and JavaScript (Larry Rosler)
Problems with IIS3 <mdelvalle@ocs.es>
Reading pipes with no wait <Wm.Blasius@ks.sel.alcatel.de>
Re: sendmail won't run on www ? <wells@cedarnet.org>
Sendmail <s.filipowicz@orades.nl>
test.pl is running on a local maschine, in www i see th <rundholz@wabe.de>
Re: Win32 Network problems with ActiveState PERL? <primanti@earthlink.net>
Win32 Perl and DOS-style interrupts (etherl)
Writing to files. <s.filipowicz@orades.nl>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Mar 1999 08:24:11 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: adding a number to an existing value in another file
Message-Id: <7cqucl$4gc$1@camel29.mindspring.com>
TinP wrote in message <7cq3bi$dc8$1@news1.fast.net>...
:I wrote a few days ago with a problem and want to commend the group on the
:great answer and how fast my post was answered.
:I am stuck again and looking for help.
:Here is what I have:
:In one file I have a database of scores
:filename scores.txt
:Tom | 56
:Bill | 43
:Joe | 32
:In another file I have another list of names and scores for this week.
:scores_this_week.txt
:Tom | 3
:Sue | 15
:Mary| 8
:Joe | 3
:What I wanted to do was this:
:If the name isn't already in the scores.txt file I want to add the name and
:the score. That is easy enough for me but If the name already exists, I
want
:to just add the new value to the current number that is already there. Any
:suggestions on how do that?
Well, you can spiff this up a bit but do something like the following. Read
the data into a hash (make sure the names are exactally the same in the two
files) then just use something like $data{$name} += $score; That will take
care of both your objectives.
--------------------------8<------------------
#!/usr/local/bin/perl -w
use strict;
my ($name,$score,%data);
open (FH,'scores.txt') or die "$!\n";
while(<FH>) {
chomp;
($name,$score) = split('\|',$_);
$data{$name} = $score;
}
close (FH) or die "$!\n";;
open (FH,'scores_this_week.txt') or die "$!\n";
while(<FH>) {
chomp;
($name,$score) = split('\|',$_);
$data{$name} += $score;
}
close (FH) or die "$!\n";
print "$_ score is $data{$_}\n" foreach keys %data;
-----------------------------------------
I really like being able to use foreach like that <g>.
:Also I was wondering if someone answers my question what is the proper
:netiquette?Should I write back a thanks? Of course I appreciate the help
but
:don't want to clog the thread with a useless post of thanks even though I
am
:thankful.
I find the occasional newsgroup thanks appropriate but others may have a
different opinion. I often express my appreciation via email but I really
don't know what the netiquette is on that point either. I know I appreciate
it when someone thanks me for any assistance I might provide.
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
#else /* !STDSTDIO */ /* The big, slow, and stupid way */
- Larry Wall in str.c from the perl source code
------------------------------
Date: Thu, 18 Mar 1999 12:55:08 +0000
From: Aran Cox <acox@cv.telegroup.com>
Subject: Re: Expect module (spawned proc won't die)
Message-Id: <36F0F7AC.558512A2@cv.telegroup.com>
Christian Koch wrote:
>
> I have a problem with the expect module.
>
> I want to create users for Apache webserver with htpasswd. When I start the
> script the user will be created, but the script never stops. My browser is
> downloading data during the creation of the user. When I press the STOP
> button it stops and the user is created. What can I do to optimize the
> script, that it will be stop without my help.
>
> Here is a part of my script:
>
> $username = "$eingabe[1]";
> $passwd = "$eingabe[2]";
>
> $passwdfile = "/usr/local/httpd/conf/passwd.txt";
> $htpasswd_prog = "/usr/bin/htpasswd";
>
> my $timeout = 10;
>
> $robot = Expect->spawn($htpasswd_prog, $passwdfile, $username);
>
> $pattern = $robot->expect($timeout, "Changing", "New password:");
>
> # if(!defined $pattern) {
> # die "New password: not found";
> # } elsif($pattern == 1) {
> # die "User already there";
> # }
>
> $robot->send_slow(0, "$passwd\n");
>
> $robot->expect($timeout, "Re-type new password:") || die "Pattern Re-type
> new password: not found";
>
> $robot->send_slow(0, "$passwd\n");
>
> $robot->expect(undef);
>
> print "<br><br>User <b>$eingabe[1] </b>wurde erfolgreich angelegt.";
>
> Thank You
> Christian
I had the same problem with a script not ending when the program did, I
fixed it by adding the following just before the last send_slow command.
$obj->log_stdout(0);
hope that helps...
For some reason the telnet I invoked upon exiting would cause the expect
module to print :
Connection closed by foreign host.
over and over again. If I turn off logging to stdout, it isn't a
problem. Of course, this isn't practical in all cases as you may be
interested in the output generated by the command that ends the process
you are interacting with. In the case of my script I don't care.
------------------------------
Date: 18 Mar 1999 06:29:35 GMT
From: Ilya <ilya_NOSPAM_@napavlly.rose.hp.com>
Subject: find command problem
Message-Id: <7cq6gf$88e$2@ocean.cup.hp.com>
I can do the following at the prompt:
> echo | /opt/robelle/bin/qhelp
QHELP/UX/Copyright Robelle Consulting Ltd. 1981-1995
(Version 2.1.05)
Enter the help filename?
>
I would like to accomplish the same task programmatically, using the find in a
Perl script:
$lines = `find $path* -name qhelp -exec echo | {} \\; 2>/dev/null`;
The problem with that is that the "|" (pipe) symbol is being interpreted as
find command terminator, so when I run this exact command, I get:
ksh: {}: not found
find: -exec not terminated with ';'
It thinks the find command ends after the "|" and then the shell tries to
execute {}, which is of course, not found.
Any tips on how to handle "|" in the find command used in Perl script?
--
Ilya
------------------------------
Date: Thu, 18 Mar 1999 10:24:13 -0500
From: "Techno" <techno@umbriel.demon.co.uk>
Subject: Re: flock() on Alpha/VMS
Message-Id: <7cr5r2$2n06$1@newssvr03-int.news.prodigy.com>
Brad Hughes wrote in message <36F04D04.D5D20D61@tgsmc.com>...
>Techno wrote:
>>
<SNIP>
>
>Hmmm.
>
>$ perl -e "open F, 'sys$login:login.com'; flock F, 0"
>The flock() function is unimplemented at -e line 1.
>
>This is with both 5.004_04 and 5.005_02.
>
>Brad
Brad - I'm afraid that's not what I get...
$perl -e "open F,'sys$login:login.com'; flock F,0"
$
ie exits with no errors/warnings.
$perl -e "open F,'sys$login:login.com'; flock F,0 || die ""Flock failed:
$!"";"
Flock failed: at -e line 1.
%SYSTEM-F-ABORT, abort
$
Note - this is slightly different from my script, where $! contained 'out of
processes' (as mentioned earlier).
$perl -v
This is perl, version 5.005_02 built for VMS_AXP
...
$
Also FYI - OS is OpenVMS Alpha Operating System, Version V7.1-2.
Regards,
Techno.
------------------------------
Date: Thu, 18 Mar 1999 14:08:56 GMT
From: dcotteri@my-dejanews.com
Subject: Getting output from Java program on UNIX
Message-Id: <7cr1dh$ka3$1@nnrp1.dejanews.com>
Hi,
I'm trying to call a Java program from a perl CGI script and parse the java
output, to return an HTML page depending on the result. This has worked fine
on NT, but since I've moved it to a Solaris box I'm getting problems. When
the Java throws an Exception and returns an error the Perl scripts is
returning invalid HTML ?!?
My code is something like the following :
...
$output = `java -classpath xxxxx myJava`;
if ($output =~ /OK/)
{
// return HTML for OK page
}
else
{
// return HTML error page
}
....
Admittedly my Perl is not great, but this should be pretty simple, so any help
you can give me would be much appreciated..
Thanks,
Darren.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 06:41:40 -0800
From: "Steven R. Robertson" <srobert@anv.net>
Subject: Re: glob failed
Message-Id: <36F110A4.946ED20D@anv.net>
"Steven R. Robertson" wrote:
>
> I'm a total newbie with perl. But I needed to run an install program
> that depends on it. When I try to run it I get error messages:
> glob failed at line xxx
> I tried compiling a new version of perl 5.005.02 and afterwards tried a
> precompiled version of the same. During the compilation when I run "make
> test" I get similar glob error messages.
> This is on Linux 2.0.36 with glibc-2.0.7 libs.
> I even tried recompiling and install glibc and then compiling perl. But
> "make test" is still giving me the "glob errors".
> What can I do?
Ahh, Thanks for the tips. Turns out that neither csh nor tcsh was
installed on my machine. Thanks again.
------------------------------
Date: Thu, 18 Mar 1999 08:03:27 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: How to redirect Output?
Message-Id: <7cqt5p$3vb$1@camel29.mindspring.com>
Pep Mico wrote in message <36F0C2AB.D37B932A@hp.com>...
:Hello,
:I'm Using Activestate perl (perl for win32). And I'm trying to redirect
:the output of my scripts using the simply MS-DOS redirecting like this.
:myscript.pl > output.txt
:But output.txt doesn't receive anything it has the lengh of "0" zero
:bytes.
:My "sophisticated" script is only this line
:print "hello\n";
:Why It doesn't work? How can i redirect the output of my Script?
Something else must be goint on. If, at the prompt, I type
perl myscript.pl > output.txt
, and myscript.pl contains
print "hello\n";
then output.txt contains hello. Are you sure your script actually runs?
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Numbers are symbols for things; the number and the thing are not the same.
- Ashley-Perry Statistical Axioms[1]
------------------------------
Date: Thu, 18 Mar 1999 12:41:19 GMT
From: starplayer2@my-dejanews.com
Subject: Is this "perlish"
Message-Id: <7cqs9e$g2u$1@nnrp1.dejanews.com>
Hello People of Perl:
I've started using logical experssions instead of if-else statements mostly
because they seem easier to read, and tend to be terse. I showed them to a
collegue and he felt that they were obsufasted or whatever that word is..
I wonder- would it be considered poor style to use say:
!($yes && print "answer is yes\n") && print "answer is no\n";
instead of
if ($yes) {print "answer is yes\n";} else {print "answer is no\n";}
To me the former is clearer as it has fewer {} and is less wordy, but I can
see his point that in the former, the intent is less obvious, as it looks
like a dangling logical expression.
Any thoughts?
S
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 08:33:58 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Is this "perlish"
Message-Id: <7cquv1$4lp$1@camel29.mindspring.com>
starplayer2@my-dejanews.com wrote in message
<7cqs9e$g2u$1@nnrp1.dejanews.com>...
:Hello People of Perl:
:I've started using logical experssions instead of if-else statements mostly
:because they seem easier to read, and tend to be terse. I showed them to a
:collegue and he felt that they were obsufasted or whatever that word is..
:
:I wonder- would it be considered poor style to use say:
:
: !($yes && print "answer is yes\n") && print "answer is no\n";
Yikes, that seems way too complicated to me. I would call that
semi-obfuscated.
:instead of
: if ($yes) {print "answer is yes\n";} else {print "answer is no\n";}
I think the above would be a little easier on the next person to deal with
the code.
:To me the former is clearer as it has fewer {} and is less wordy, but I can
:see his point that in the former, the intent is less obvious, as it looks
:like a dangling logical expression.
:Any thoughts?
to me the following is the cleanest way but, of course, TIMTOWTDI.
print $yes ? "answer is yes\n" : "answer is no\n";
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
The begginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: 18 Mar 1999 08:29:33 -0500
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: Is this "perlish"
Message-Id: <xlxpv673ozm.fsf@gold.cis.ohio-state.edu>
starplayer2@my-dejanews.com writes:
> I wonder- would it be considered poor style to use say:
>
> !($yes && print "answer is yes\n") && print "answer is no\n";
>
> instead of
>
> if ($yes) {print "answer is yes\n";} else {print "answer is no\n";}
The latter will be more obvious to more people and arguably easier to
maintain. This is especially true where the blocks of code to be
written are larger and more complicated.
Optimizing for readability and maintainability is generally a Good Thing.
--
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/
------------------------------
Date: Thu, 18 Mar 1999 14:59:58 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Is this "perlish"
Message-Id: <36f1146e.74897436@thunder>
On Thu, 18 Mar 1999 12:41:19 GMT, starplayer2@my-dejanews.com
enlightened us thusly:
>I wonder- would it be considered poor style to use say:
>
> !($yes && print "answer is yes\n") && print "answer is no\n";
>
>instead of
>
> if ($yes) {print "answer is yes\n";} else {print "answer is no\n";}
I'd certainly consider it poor style, especially if someone else will
have to maintain the code. It is _not_ obvious what's going on.
If you want to be terse bvut readable, why not ..
print "answer is ".(($yes)?'yes':'no')."\n";
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: 18 Mar 1999 15:03:06 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Is this "perlish"
Message-Id: <7cr4ja$ee1$1@pegasus.csx.cam.ac.uk>
<starplayer2@my-dejanews.com> wrote:
>
>I've started using logical experssions instead of if-else statements mostly
>because they seem easier to read, and tend to be terse. I showed them to a
>collegue and he felt that they were obsufasted or whatever that word is..
>
>I wonder- would it be considered poor style to use say:
>
> !($yes && print "answer is yes\n") && print "answer is no\n";
>
>instead of
>
> if ($yes) {print "answer is yes\n";} else {print "answer is no\n";}
The former has an obscure bug in it - consider what happens if print()
fails.
And for this particular example, I'd prefer a conditional expression
for clarity:
print 'answer is ', $yes ? "yes\n" : "no\n";
Mike Guy
------------------------------
Date: 18 Mar 1999 11:57:24 GMT
From: packer@shell.clark.net (Charles Packer)
Subject: Re: Modules, how to build in local directory?
Message-Id: <slrn7f1qkf.fn1.packer@shell.clark.net>
In article <3MuH2.11823$Ge3.46465508@news.itd.umich.edu>, Sean McAfee wrote:
>Look at the perlrun man page; search for "PERL5LIB".
Thanks to the others who suggested PERLLIB or PERL5LIB also...
When I tried this, however, it didn't work. I may not have
used it correctly, though. According to the O'Reilly book, I
should be able to give a root library. For example, if I give
the destination directory for module-building as "pmods", I
should be able to set PERL5LIB to $HOME/pmods and have the
"perl Makefile.PL" statement find earlier modules there as
well as build each subsequent one there. Even if the first
".pm" file gets built a some ridiculous number of levels down
in pmods, e.g. pmods/lib/perl5/site/... it should be found,
right?
--
packer@clark.net
http://www.clark.net/pub/whatnews/whatnews.html
------------------------------
Date: Thu, 18 Mar 1999 13:35:20 GMT
From: massimobalestra@my-dejanews.com
Subject: Ms-Mail from perl
Message-Id: <7cqveo$ip5$1@nnrp1.dejanews.com>
Hi, Does somebody knows if there is a way to send a mail Through a server
Microsoft Mail (Ms-Mail) without having a gateway? Or (Off Topic) does
exists there a (freeware) gateway from unix to ms-mail?
I know perl and unix but not ms-mail server.
Is there someone who can help me?
Thank you
Bye
Massimo Balestra
Torino Italy
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 14:52:58 GMT
From: ashroff_moksha@yahoo.com
Subject: Oracle Connection
Message-Id: <7cr406$mcq$1@nnrp1.dejanews.com>
Hello,
I am currently running Oracle 8 on a unix server and want to build
applications in Perl that require connections to the Oracle database.
I have been told to use oraperl or DBI to connect to Oracle. What are the
diferences between the two? Which should I use?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 14:36:44 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: Re: Ouput to textbox w/o rewriting page
Message-Id: <36F10F7C.49D24B18@cedarnet.org>
Alex Farber wrote:
> "Graphics i.e." wrote:
> > Is it possible to return the results of a form submitted to a perl script
> > back to a textbox without rewriting the entire page? If it is possible can
> > someone give me a clue on how to do this.
> Maybe - if you combine JavaScript (to update that textfield)
> with a nph perl script (to make web page stay) - but I'm not quite sure.
Combine this with layers. You could pull up just the area you want to edit.
STEVE
--
-----------
Stephen D. Wells
http://www.iren.net/wellss/
------------------------------
Date: Thu, 18 Mar 1999 16:37:38 +0100
From: "Uwe W. Gehring" <gehring@politik.uni-mainz.de>
Subject: parse exception with avtivestateperl 509
Message-Id: <36F11DC1.E4FDEE89@politik.uni-mainz.de>
Hi,
I changed from another distribution to the recent ActiveState Perl 509.
I install it on a NT-Server and share the perl-directory for the
clients, which map the share as drive x: With the former distribution,
eaach workstation could execute perl scripts from x:\bin\ Now I get
"Error: Parse exception" even when I just try to run "perl -V" (but
"perl -v" works). I already set the env var PERLLIB and set the same
registry key as on the server, but this changes nothing.
TIA
--
Sincerely
Uwe W. Gehring
Research Assistant
****************************************************
University of Mainz - Institute of Political Science
Saarstr. 21 55099 Mainz Germany
Tel.: +49 6131 39-5485 Fax: +49 6131 39-2996
E-Mail: gehring@politik.uni-mainz.de
WWW: http://www.uni-mainz.de/~gehring
****************************************************
------------------------------
Date: Sun, 14 Mar 1999 11:34:55 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl and JavaScript
Message-Id: <MPG.1155af36a6626c9989746@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <36EC58B2.14785AAC@kawo2.rwth-aachen.de> on Sun, 14 Mar 1999
19:47:47 -0500, Alex Farber <alex@kawo2.rwth-aachen.de >says...
> "Cyril Sarrauste de Menthihre" wrote:
> > $JSCRIPT=<<STOP;
> > # ....
> > STOP
> > ;
>
> ^^^ remove this ;
Why do you think that will change anything? Did you try it before
posting this assertion?
That is nothing but a harmless null statement.
> > But it's always the same error message :
> > Can't find string terminator "STOP" anywhere before EOF at line
> > "$JSCRIPT=<<STOP;"
The only proper answer to this Frequently Asked Question is to refer to
perlfaq4: "Why don't my <<HERE documents work?"
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 18 Mar 1999 09:13:51 +0100
From: "Miguel Angel del Valle Mariotti" <mdelvalle@ocs.es>
Subject: Problems with IIS3
Message-Id: <7cqc4t$89f$1@talia.mad.ttd.net>
Hi
I am running a Perl application in Windows platform, but it is impossible to
run it with IIS3, I don4t know what happens.
The Perl version is 5.005_03, and only works with IIS4.
How do i configure IIS3 to support Perl? Is there something special that I
have to do in the Web Server?
Thank you very much................
Miguel Angel
mdelvalle@ocs.es
------------------------------
Date: Thu, 18 Mar 1999 15:53:59 +0100
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
Subject: Reading pipes with no wait
Message-Id: <36F11387.41C67EA6@ks.sel.alcatel.de>
Greetings,
I have what seems (at first) to be a small problem but I can't quite see
my way around it. What I am trying to do is this:
I am writing a monitor script that multiplexes output from several child
processes. A configuration file determines how many of which processname
will be run. These processes send occasional output back to the parent.
I create a new FileHandle for each process and use it to start the child
using a piped open: $self->process_id=(open( $self->read_fh, "-|") );
where $self->read_fh supplies the reference to the fh. This works.
I spend my time (periodically) iterating through the filehandles looking
for things to read. I have a lot of these processes and I do not want to
mess with select(2) if I can help it.
To read I do: my $fh=$self->read_fh; read($fh,$char,1) or undef $char;
This works but blocks if there is no input.
Is there some way to just set FNDELAY on a filehandle before or during a
piped open?
As usual, a truly elegant solution would be marvelled at!
TIA
Wm Blasius
---
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: Thu, 18 Mar 1999 14:40:50 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: Re: sendmail won't run on www ?
Message-Id: <36F11072.EE7C193E@cedarnet.org>
> I am testing a small script to send out email via sendmail.
> The script runs fine under bash. But when I called the script
> via www <A href="/cgi-bin/m.pl">, the apache server returned
> premature end of script headers.
>
> Script Listing:
>
> #!/usr/local/bin/perl
>
> $mailprog = "/usr/sbin/sendmail";
>
> open(MAIL,"|$mailprog -t");
> print MAIL "To: <root\@abc.com>\n";
> print MAIL "From: <mlc>\n";
> print MAIL "Subject: Nothing\n\n";
> print MAIL "Reply-To: <mlc>\n";
> print MAIL "That's all folk!\n\n";
> close(MAIL);
>
> Apparently, the script failed on the line open().
> Any suggestion would be much appreciated.
John,
Your script returned "Premature end of script headers"
That's the problem. It probably sent the mail but you
didn't tell it to send anything back to the server.
Add this to you program and it should work:
print "Content-type: text/plain\n\nMail Sent.\n";
HTH,
STEVE
--
-----------
Stephen D. Wells
http://www.iren.net/wellss/
------------------------------
Date: Thu, 18 Mar 1999 16:29:26 +0100
From: Steven Filipowicz <s.filipowicz@orades.nl>
Subject: Sendmail
Message-Id: <36F11BD6.E4B6E011@orades.nl>
Is it possible to send the mail send by sendmail to two emailaddresses?
Something like this :
---------------------------------------------------------------------------
print MAIL "To: <root\@abc.com> , <root\@def.com>\n";
---------------------------------------------------------------------------
Thanks!
------------------------------
Date: Thu, 18 Mar 1999 15:30:05 +0100
From: "Andy Rundholz" <rundholz@wabe.de>
Subject: test.pl is running on a local maschine, in www i see the only the source
Message-Id: <7cr2ig$8c1$1@black.news.nacamar.net>
Hallo there,
my programm test.pl is running like a rabbit on a local maschine. /:-)
but if i call the programm from a webserver i see only the source code?
best regards, Andy
------------------------------
Date: Wed, 17 Mar 1999 22:16:19 -0700
From: Joseph & Jamie Primanti <primanti@earthlink.net>
Subject: Re: Win32 Network problems with ActiveState PERL?
Message-Id: <36F08C23.31BEC973@earthlink.net>
I use a url: "\\server_name\share_name\path\file_name".
Joe Primanti
Peter Connolly wrote:
> Hi All
>
> I'm trying to write a small program using ActiveState PERL 5.09 plus
> some BackWeb extensions (which are all working fine). My problem is
> that my PERL script can't look on a mapped drive. The code below works
> fine when the drive in question is a local drive. If the drive is
> mapped through Windows NT as a share, it can't locate the files and
> halts. I can't see why it shouldn't work - I've tried it many times
> logged in as administrator all seems well until I try to access the
> maped drive, at which point the PERL code starts to look for files,
> then halts without an error.
>
> Are there any problems with Activestate PERL and mapped drives? I can't
> see any reasons for it going wrong. I've started the NT process as a
> proper login account under the user administrator, not system, yet it
> still refuses to work. If anyone can make this code work across mapped
> drives, I would be most grateful.
>
> Thanks
>
> Peter
>
> Code Begin>>>
>
> > my $Thisline, $Filename, $NumFiles=0, $Date, $Time, @TheFile = (), @DataLines = (), @TotalLine = ();
> > my $LastAcd = "", $Acd, $CallsAnswered, $CallsAbandoned, $AvgDelay, $Percent, $Count;
> > my $StoryCount, $cnt = 0;
> > my @Allfiles = (), $source_dir = 'g:/', @sorted_files = (), @stats_files = ();
> >
> > #change the value below to anything other than 0 to output debug information.
> >
> > my $debug = 1;
> >
> > if ($debug)
> > {
> > BW_log_and_print("Starting to look for files....");
> > }
> >
> > opendir (DIR, $source_dir) || die "Cannot open $!";
> > while($Allfiles[$cnt] = readdir(DIR)) {
> > if ($Allfiles[$cnt] ne "." and $Allfiles[$cnt] ne ".."){
> > chdir($source_dir);
> >
> > # This bit may be used in the future for testing timestamps of the files to see if they're recent. For now we're assuming that the files
> > # are cleared down each evening.
> > #
> > # $created = (-C $Allfiles[$cnt]);
> > # $modified = (-M $Allfiles[$cnt]);
> > # $accessed = (-A $Allfiles[$cnt]);
> > # $read = (-r $Allfiles[$cnt]);
> > # BW_log_and_print("Filename:$Allfiles[$cnt], Created:$created,
> > # Modified:$modified, Accessed:$accessed, Read:$read");
> > $cnt++;
> > }
> > }
> > if ($debug)
> > {
> > BW_log_and_print("Found $cnt files. Sorting...");
> > }
> >
> > @sorted_files = sort @Allfiles;
> > @stats_files = grep { /stats.\d{3}/ } @sorted_files; # We're only interested in files named stats.xxx, where xxx is a three digit extension
> >
> > if ($debug)
> > {
> > BW_log_and_print("\nOriginal List: @Allfiles\nSorted List: @sorted_files\nJust the stats files: @stats_files\n");
> > }
> >
> > $NumFiles = $#stats_files;
> > if ($NumFiles == -1) { BW_die("Couldn't find any files matching stats.xxx - Exiting...\n"); }
> >
> > if ($debug)
> > {
> > BW_log_and_print("Last element in list is $NumFiles.");
> > }
> >
> > $Filename = $stats_files[$NumFiles];
> >
> > if ($debug)
> > {
> > BW_log_and_print("File $NumFiles is called $Filename.");
> > }
> >
> > open (INFILE , $Filename) or BW_die("I can't open the file $Filename. ");
> >
> >
> This will work on most Win32 systems, but for some reason fails as a
> service sub-process under Windows NT. I'm totally lost from here on.
> Does anyone have any clues?
>
> Thanks
>
> Peter
------------------------------
Date: 18 Mar 1999 15:37:03 GMT
From: etherl@io.com (etherl)
Subject: Win32 Perl and DOS-style interrupts
Message-Id: <slrn7f27do.83b.etherl@dillinger.io.com>
I didn't get any takers on this over in c.l.p.modules, so I'll try it
here.
After a search of various FAQs, web engines and DejaNews, I think this
group may be my last resort.
I'm hoping to be able to write a few extensions to a proprietary ERP
system we use that is Win32-based using Perl and Perl/Tk.
Unfortunately, I think I'm stuck on getting data in and out of the system.
The system's documentation refers to stuffing values onto various
registers (BX,CX) and generating interrupt 16H to return information to
the calling application.
Is there any way to do this inside of Perl, or are we looking at linking
in some C or ASM stuff to handle this?
--
etherl@io.com
No funny .sig today
------------------------------
Date: Thu, 18 Mar 1999 13:04:21 +0100
From: Steven Filipowicz <s.filipowicz@orades.nl>
Subject: Writing to files.
Message-Id: <36F0EBC5.EC6D85A@orades.nl>
Hi All,
I would love to know how I can write something to a file.
The code below read from a file.
--------------------------------------------------------------
#!/usr/local/bin/perl -w
$number = 0;
$name = 'steven';
open FILE, $target or die "could not open '$target' $!";
while ($line = <FILE>) {
@line = split/\|/, $line;
print "$line[1]","<P>";
}
close FILE;
--------------------------------------------------------------
For example I would like to write $number and $name to a file.
How would I do this?
Thanks!
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5165
**************************************