[7413] in Perl-Users-Digest
Perl-Users Digest, Issue: 1038 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 17 12:18:46 1997
Date: Wed, 17 Sep 97 09:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 17 Sep 1997 Volume: 8 Number: 1038
Today's topics:
Re: can I continuously read & empty logfile? (Bart Lateur)
Re: Client/Server over serial line... (Matthew H. Gerlach)
compile perl (Bart Kerver)
Re: Deleting temp files with perl (Jason Gloudon)
Efficiency/New Perl Book: return @array vs \@array? <chapman@techctr.buddcompany.com>
Re: File Dates & Sizes (I R A Aggie)
Re: File Dates & Sizes (Jeff Stampes)
Re: Flock me here flock me there. (Jeff Stampes)
HELP: Approaches to storing perl objects in RDBMS <paul@miraclefish.com>
hpux 9.05 perl 5.004_03 compilation problems <christopher.ang@amd.com>
Re: I'm in an idiom rut ... <bteague@aol.net>
Max number of options in GetOptions <croke@nortel.ca>
Re: multidimensional arrays charlot@SPAM-FREE.org
Re: Net::FTP (Jason Gloudon)
Re: Net::FTP::dataconn (Jeffrey R. Drumm)
Newbie question about system function <markus@dismal.com>
Re: NEWBIE question (Jason Gloudon)
Re: Newbie Question (Jeremy D. Zawodny)
Re: Parsing e-mail folder (newbie) rbush@up.net
Re: perl relative path refs w/NT (Jeremy D. Zawodny)
Re: perl relative path refs w/NT (Jeremy D. Zawodny)
Re: postmail and perlis (Jeremy D. Zawodny)
Re: Question (Jeremy D. Zawodny)
Script to Capitalize HTML Tags (Robert Maguire)
Standard I/O operations in sockets <marden@dcc.ufmg.br>
Re: The CSV format stinks! <steve.tolkin@fmr.com>
Re: Yknow, the thing about perl is.... <seay@absyss.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Sep 1997 16:04:18 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: can I continuously read & empty logfile?
Message-Id: <341ffcac.1665326@news.tornado.be>
John Stumbles <suqstmbl@reading.ac.uk> wrote:
>At present I have a cron job calling a shell script which copies the
>logfile off to somewhere else and then truncates the logfile to 0. Of
>course between copying the contents of the file and zeroing it I sometimes
>lose some data. (I could modify it to rename the logfile and swap in an
>empty file but that's still non-atomic).
Can't you just rename the logfile? As soon as a process tries to append
to this non-existent file, it will be created. That is, if the file is
closed between data bursts, and opened for append.
HTH,
Bart.
------------------------------
Date: Wed, 17 Sep 1997 14:50:29 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: Client/Server over serial line...
Message-Id: <gerlachEGnqK6.MqM@netcom.com>
Perl's powerful regular expressions and overall extremely flexible language
makes it a great candidate for parsing text over a serial line. This
is actually a fairly regular question that should be set in stone
somewhere. So here is my usual answer. As far as I know there is no
clearly documented, reliable, method of performing perl serial i/o with a
WinUnIntel machine. One could probably write a module extention that
performs the appropriate TAPI calls, but I don't think this has been done.
With UNIX the answer is TIMTODI! The most UNIX like method would involve
using the termio interface in the POSIX.pm. If your were programming in C
that's how you'd do it.
Having done a lot of termio stuff in C, I prefer a slightle different
approach. I use Comm.pl's expect-like feature to open a bidirectional
connection to a serial program like kermit, tip, or cu. Then your perl
code simply "print"'s to the serial program to write out the serial
connection and "expect"s to read characters.
The down side to this method is that there is an extra process involved.
The upside, especially if you use kermit, is that you leverage the
functionality in the kermit program. This includes built in support
for file transfer, logging of the serial session to a file, and a library
of modem support for more modems than you could imagine.
In have had great luck using this method for controling a wide variety
of test equipment under SunOS and SCO 3.2.4.
Matthew
>Unfortunately, serial connections are my achilles heel. Are there any good
>tools for getting data over a serial connection reliably from perl? Is it
>just a simple matter of open()ing a bi-directional pipe to the devices?
>
------------------------------
Date: Wed, 17 Sep 1997 13:20:56 GMT
From: bart@lx.student.wau.nl (Bart Kerver)
Subject: compile perl
Message-Id: <5volfo$vk0c2_002@news.wau.nl>
Keywords: convert, compile, perl, c, pascal
Hi,
Though Perl is a fantastic language, I need to run a perl script on a non
windows x86 without Linux. So I want to compile a perl script to a c source. I
have tried the available compiler beta 3, but I can't get it done.
Anyone that can help me with this ?
My perl runs in a windowenvironment, so I don't have all the perl libraries to
recomplile perl, as written in the help docs.
Is there maybe a perl script that can convert perl to C or to pascal ?
I'd be gald to hear about it,
cheers, Bart
------------------------------
Date: 17 Sep 1997 12:46:17 GMT
From: jgloudon@bbn.com (Jason Gloudon)
Subject: Re: Deleting temp files with perl
Message-Id: <5vojep$iaj$1@daily.bbnplanet.com>
In article <341A58D5.2F46@icl.fi>,
Petri Backstrom <petri.backstrom@icl.fi> wrote:
>Matt Weber wrote:
>>
>> What commands do I use in a perl script to delete a temporary file?
>
A useful trick from C coding is to unlink a temporary file right after you
open it, so that it goes away for _certain_ when it is closed. You don't have
to worry about unlink'ing it afterwards that way if you have multiple exit
points in the program.
Jason Gloudon
------------------------------
Date: Wed, 17 Sep 1997 11:42:29 -0400
From: Harold Todd Chapman <chapman@techctr.buddcompany.com>
Subject: Efficiency/New Perl Book: return @array vs \@array?
Message-Id: <83AC84ABDA31E740.DD50D546A3DC9FDA.D364DD521A9D1968@library-proxy.airnews.net>
I am studying the new "Advanced Perl Programming" book. On page 9 it
says that large amounts of data can be efficiently passed to and from
subroutines by using references. Then on page 10 the use of the
Benchmark module is demonstrated. I used the program below to test this
and found that the reference returning version take 50% longer than the
array returning version. Am I doing something wrong? Comments?
Thanks.
htchapma@oakland.edu
________________________________________________________________
#!/usr/local/bin/perl -w
require 5.004;
my ($x, $y, $z);
local @points;
my $i = 0;
print STDERR "Reading points...\n";
while (<>) {
chomp;
chop;
($x, $y, $z) = split;
push @points, [ $x, $y, $z, "real" ];
}
print STDERR "Averaging z values...\n";
use Benchmark;
timethis(1000000, "iso_xy()");
sub iso_xy {
return @points;
#return \@points; #if I uncomment this line and comment above
#the benchmark take 50% longer!
}
____________________________________________________________________
------------------------------
Date: Wed, 17 Sep 1997 09:25:02 -0400
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: File Dates & Sizes
Message-Id: <-1709970925020001@aggie.coaps.fsu.edu>
In article <341f5315.11438954@news.chickasaw.com>, noneya@internet.com wrote:
+ Can someone tell me am I calling stat wrong or am I just totally wrong
+ trying to use stat and is there some other way?
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat $filename;
What's hard about that?
James
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 17 Sep 1997 15:12:09 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: File Dates & Sizes
Message-Id: <5vos09$9eq$2@neocad.com>
noneya@internet.com wrote:
: I am trying to print the file dates, file sizes and last
: modification date into an html file from a perl routine that is doing
: a foreach loop which opens a listing of files. I have tried
: stat($filename) in the loop but I can't get any output to the html
: file.
Can you get any values in perl at all? How are you accessing
the data? How are you printing? Perl doesn't care if it's an
html file, standard out or a socket, so can you print anywhere
else?
: Can someone tell me am I calling stat wrong or am I just totally wrong
: trying to use stat and is there some other way?
How exactly are you calling it? You say you use stat($filename)...
but was that:
$foo = stat($filename);
@bar = stat($filename);
or
%hash = stat(%filename); ????
As you can see, posting a little sample code can go a long way
in getting the help you need. PLease post the section causing you
trouble and maybe we can help.
In the meantime, you can check perldoc -f stat to get the proper
usage of stat.
Cheers,
Jeff
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: 17 Sep 1997 15:07:12 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Flock me here flock me there.
Message-Id: <5vorn0$9eq$1@neocad.com>
kiet (kiet@uclink2.berkeley.edu) wrote:
: It seems the subroutine for flock() isn't implemented for the Activeware
: version of Perl 5.0003.xxx . Does any1 know about this?
Lots of people actually.
: I need the flock() subroutine to carry some of the program under Win '95.
Then you're in trouble. flock() is not implemented under win95 at
all (unless someone has pulled off a coup recently). It's not
Perl's fault...blame Bill Gates.
Jeff
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: Wed, 17 Sep 1997 15:43:25 +0100
From: Paul <paul@miraclefish.com>
Subject: HELP: Approaches to storing perl objects in RDBMS
Message-Id: <341FEC8D.7853FCE4@miraclefish.com>
I want to use a RDBMS (mSQL) to store my application's Perl objects.
1) Am I mad?
2) Is there a standard architecture for this kind of implementation?
How are insert, update and delete methods normally implemented?
3) Is it going to be a lot simpler to use an OODBMS?
------------------------------
Date: 17 Sep 1997 10:29:22 -0500
From: Chris Ang <christopher.ang@amd.com>
Subject: hpux 9.05 perl 5.004_03 compilation problems
Message-Id: <xlpafhcez71.fsf@nueville.i-have-a-misconfigured-system-so-shoot-me>
hi all:
i've been having a difficult time trying to compile
perl 5.004_03 for hpux 9.05 using the hp compiler.
i've tried hacking the source a bit to get around
this problem, but i can't seem to get it. has anyone
else seen this? if so, how did you work around it?
here's the error i'm getting:
cc -c -Ae -I/usr/local/include -I/usr/local/gnu/include -O -DVERSION=\"1.02\" -DXS_VERSION=\"1.02\" -I../.. -DPERL_CORE -DLIBC="/lib/libc.sl" DynaLoader.c
cc: "../../sv.h", line 256: error 1000: Unexpected symbol: "PerlIO".
cc: "../../sv.h", line 257: error 1000: Unexpected symbol: "PerlIO".
cc: "../../proto.h", line 88: error 1000: Unexpected symbol: "PerlIO".
cc: "../../proto.h", line 91: error 1000: Unexpected symbol: "PerlIO".
cc: "../../proto.h", line 260: error 1000: Unexpected symbol: "*".
cc: "../../proto.h", line 261: error 1000: Unexpected symbol: "*".
cc: error 2017: Cannot recover from earlier errors, terminating.
make[1]: *** [DynaLoader.o] Error 1
so, it seems like it's getting confused with the PerlIO
definition, but i don't know why it waits until it
starts compiling DynaLoader.c before it barfs.
thanks,
chris
---
chris ang
<mailto:christopher.ang@amd.com>
i speak for me, not amd.
------------------------------
Date: Wed, 17 Sep 1997 10:12:51 -0400
From: Bryan Teague <bteague@aol.net>
Subject: Re: I'm in an idiom rut ...
Message-Id: <341FE563.16ED213D@aol.net>
dave wrote:
> while( @_ > 0 )
> {
> last unless defined $_[1];
> $hash{$_[0]} = $_[1];
> shift; shift;
> }
>
> Just wondering if I could have less typing with the same
> functionality, without writing a "getargs" subroutine.
Well, if you are passing a hash, or a hash as the last variable, then
you can do something like this:
(%foo) = @_; # for a single
($x, $y, %foo) = @_ # for multiple arguments.
As far as I know, you can only pass 1 hash / array in because of the way
that the list is handled.
Of course, the other option is to dereference the hash you are sending
and handle it in the sub that way....
name($x, $y \%hash)
sub name {
my($x, $y, $foo) = @_;
print "$foo->{some_key}";
}
Assuming that $hash{some_key} is assigned a value.
Hope this helps :D
Bryan
--
Bryan Teague bteague@aol.net Phone: 703-453-4397
------------------------------
Date: Wed, 17 Sep 1997 10:05:21 -0400
From: Gary Croke <croke@nortel.ca>
Subject: Max number of options in GetOptions
Message-Id: <341FE3A1.548@nortel.ca>
Hi
I am wondering if there is a maximum number of command-line options that
GetOptions() will accept when using Getopt::Long;
Thanks
Gary Croke
------------------------------
Date: 17 Sep 1997 11:32:19 -0400
From: charlot@SPAM-FREE.org
Subject: Re: multidimensional arrays
Message-Id: <5vot63$gub@ocean.CAM.ORG>
In article <01bcc304$60f53760$57f382c1@default>,
Jon Marshall <xkn14@dial.pipex.com> wrote:
>
>i have written an a script which builds up a number of multidimensional
>arrays ( hashes of hashes in the camel book ). the problem i have is how to
>construct a loop to go through each one accessing the values within ie.
>
>@groups = qw( ukcns uksns uknns );
>
>each group will have a multidimensional array. within each the values
>i want to access are file types and the key is a project name -
>
>@filetypes = qw ( 3dv hzd cgm );
>
>what i want to do is
>
>foreach $group ( @group ) {
> foreach $project ( keys %group ) { # this is the problem
What, pray tell, does %group contain ? It doesn't seem to be defined
anywhere. I'll go out on a limb and assume you want to use %{$group}
Having $group contain a reference to a hash doesn't magically define
a hash named %group !
> i have tried ( keys %$group ) but this doesn't work. am i making this too
>hard,
>is there a better way to do it or am i simply just being stupid
>
Just re-read the perlref and perllol man pages a couple of times. It will
become clear eventually.
Hope this helps,
Richard.
--
Richard Bellavance -- charlot(at)cam(dot)org -- http://www.cam.org/~charlot/
"All along this path I tread / My heart betrays my weary head
With nothing but my love to save / From the cradle to the grave"
(Eric Clapton, "From the cradle")
------------------------------
Date: 17 Sep 1997 13:50:38 GMT
From: jgloudon@bbn.com (Jason Gloudon)
Subject: Re: Net::FTP
Message-Id: <5von7e$ov8$1@daily.bbnplanet.com>
In article <01bcc35d$2a5c2cf0$090bf1a8@bh0880>,
Marvin Blackburn <mlb@netpath.net> wrote:
>Is Net::FTP part of the perl 5.004 release? I can find no documentation
>from perl doc and I see it referenced quite a bit here.
>--
>---
>Marvin Blackburn
>mlb@netpath.net
>Burlington House MIS
>Burlington Industries
It's not part of the distribution - I guess they couldn't put everything
_and_ the kitchen sink in it but you can find it from www.perl.com in CPAN.
Jason Gloudon
------------------------------
Date: Wed, 17 Sep 1997 13:10:15 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Net::FTP::dataconn
Message-Id: <3420d174.148087869@news.mmc.org>
On Tue, 16 Sep 1997 17:43:44 -0700, Ian Kallen <ian@gamespot.com> wrote:
>Any code examples using the read($buffer,$size) method in the Net::FTP
>perldoc? I've been fiddling with making a file fetcher that feeds data
>into Zlib's gz methods -- I can Net::FTP a file and then employ
>Compress::Zlib to compress it but I'd like to have the intermediate
>inflated file go away; I'd like to compress on the fly whilst fetching
>from a remote FTP source but so far this' eluded me. Net::FTP::dataconn
>samples with the read method actually in use would be most appreciated!
>
>thanks,
>-Ian
Assuming you already know how to use Net::FTP to log on and get where you need
to be to access the file, the 3 following methods allow you to build a file
descriptor object and read from it. You'll need to loop the 2nd method and
process the buffer in that loop.
$filedescriptor = $ftp->retr ($file);
$filedescriptor->read ($buffer, $buffer_size) or die "Could not read $file";
$filedescriptor->close;
For a detailed example, See "The Perl Journal" volume 1 issue 3; "FTP: File
Transfer Using Perl" by Graham Barr. Source code listed in this article can be
found at:
http://orwant.www.media.mit.edu/tpj/programs/Issue_3_FTP/
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
420 Cumberland Ave, Portland, Maine 04101
Voice: 207-871-2150 Fax: 207-871-6501 Email: drummj@mail.mmc.org
------------------------------
Date: Wed, 17 Sep 1997 11:47:10 -0400
From: "Kenneth G. Markus" <markus@dismal.com>
Subject: Newbie question about system function
Message-Id: <341FFB7E.E394833E@dismal.com>
Hi everyone.
I'm working on a script that contains a simple call to the system
function:
system ("c:/Winzip/winzip32.exe", " -min", " -a", " c:/ross.zip", "
c:/web/wwwroot/pdf/pit.pdf\n");
which doesn't work.
Now does system ("c:/Winzip/winzip32.exe -min -a c:/ross.zip
c:/pit.pdf\n");
The statement, however, does work at the command line.
Basically, I need help with a system call to zip files. I've been
struggling and any help
would be greatly appreciated.
Thanks.
Ken Markus
markus@dismal.com
------------------------------
Date: 17 Sep 1997 13:43:48 GMT
From: jgloudon@bbn.com (Jason Gloudon)
Subject: Re: NEWBIE question
Message-Id: <5vomqk$oa2$1@daily.bbnplanet.com>
In article <341FCEE2.4E44F942@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
>[posted and mailed]
>
>Michael Gleibman wrote:
>>
>> Hello!
>> I am completely newbie in Perl. Any help willl be appreciated.
>
>That is what we're here for.
If you really want to use perl you could use the Net::Telnet Module
which you will find in the CPAN archive at www.perl.com.
If you don't mind not using perl,
you may want to check out expect at http://expect.nist.gov, which
was written to do exactly this sort of thing
Jason Gloudon
------------------------------
Date: Wed, 17 Sep 1997 15:10:13 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Newbie Question
Message-Id: <3422f2b1.92739942@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 17 Sep 1997 07:02:58 -0500, fischers@execpc.com wrote:
>I am posting a form to a cgi perl script. I want to access a hidden
>field in the form. How do I access the variable?
Use the CGI.pm module from CPAN, and you'll be able to access hidden
variable in the same way that you will access non-hidden ones. :-)
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 17 Sep 1997 08:39:56 -0600
From: rbush@up.net
Subject: Re: Parsing e-mail folder (newbie)
Message-Id: <874502568.4836@dejanews.com>
In article <341E36FA.A7AE5A41@pplus.best.com>,
dave@hmw.com wrote:
>
> In the next few days I will need to create (or help create) a script
> that will parse the e-mail folder file on a UNIX (actually, SGI IRIX)
> system to get the most recent message and output that message to an
> external text file. The file will be inserted (via server-side include)
> into an HTML file.
>
> To better illustrate the situation, here it is: the crew of a yacht on
> an ocean voyage will be e-mailing their status, messages, etc. to an
> e-mail account on our central server. The most recent message will be
> posted to the HTML page, where visitors of the site can read the
> message.
>
> I'm not looking for a complete solution, but if anyone has/can explain
> how to create a script that will parse the mail folder file and extract
> the most recent message, it would be tremendous help.
>
> Thanks in advance,
>
> Dave
> dave@hmw.com
question:
Why not use an alias entry to to copy the mail to some folder as a
separate file before it goes to the users mailbox ... Then you can run a
script on the files in the directory. and if your clever about
date/timestamping you have them in order by name.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 17 Sep 1997 14:56:35 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: perl relative path refs w/NT
Message-Id: <341fef2b.91838166@igate.hst.moc.com>
[cc'd automagically to original author]
On Tue, 16 Sep 1997 15:30:23 +0100, lynn kasdorf
<lkasdorf@pressroom.com> wrote:
>Jeremy- thanks for the quick response. Okay...
>
>I modified your perl program to look like this:
>---code---
>#!/usr/sbin/perl
>print "Content-type: text/html\n\n";
>print "A file test<BR>\n";
>if (-e ".\\filetest.pl")
>{
> print "File exists using DOS type rel file paths.<BR>\n";
>}
>if (-e "./filetest.pl")
>{
> print "File exists using Unix type rel file paths.<BR>\n";
>}
>if (-e
>"C:\\Netscape\\SuiteSpot\\docs\\cgi-bin\\windows_Database_manager\\filetest.pl")
>
>{
> print "File exists using DOS abs type file paths.<BR>\n";
>}
>if (-e
>"C:/Netscape/SuiteSpot/docs/cgi-bin/windows_Database_manager/filetest.pl")
>
>{
> print "File exists using UNIX abs type file paths.<BR>\n";
>}
>print "Path of this file:$0";
>---end code---
>
>When I run it from the command line, everything works. The output is...
>---output---
>Content-type: text/html
>
>A file test<BR>
>File exists using DOS type rel file paths.<BR>
>File exists using Unix type rel file paths.<BR>
>File exists using DOS abs type file paths.<BR>
>File exists using UNIX abs type file paths.<BR>
>Path of this
>file:C:\Netscape\SuiteSpot\docs\cgi-bin\windows_Database_manager\filetest.pl
>
>---end output---
>
>...BUT- when I hit from a browser, only the absolute paths work (both
>DOS and Unix varieties!). Here is what appears on the browser...
>---browser output---
>A file test
>File exists using DOS abs type file paths.
>File exists using UNIX abs type file paths.
>Path of this
>file:C:/Netscape/SuiteSpot/docs/cgi-bin/windows_Database_manager/filetest.pl
>
>---end browser output---
>
>SO- since the Perl interpreter itself seems to be able to deal with
>relative paths (both kinds!) when run from MSDOS shell, it must be a
>problem with my web server (Netscape enterprise 3.0)? Configuration?
Hm. That just means that the current working directory (CWD) for your
CGI scripts is not what you've been assuming it might be.
Try the above example, but make sure to first chdir() to the right
place. I think it'll work in that case.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 17 Sep 1997 15:05:13 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: perl relative path refs w/NT
Message-Id: <3420f12b.92349932@igate.hst.moc.com>
[cc'd automagically to original author]
On Tue, 16 Sep 1997 15:32:54 +0100, lynn kasdorf
<lkasdorf@pressroom.com> wrote:
>Thanks for your response...
>
>Well, when I print $0 from my script, it does indeed print the correct
>path of itself. Please see my response to Jeremy Z re this problem for
>more data.
Yes, $0 will contain that. Check the current working directory and see
what it is.
---cgi-bin/cwd.pl---
# to prove which directory is the default CWD in the CGI environment.
use CGI;
my $Q = new CGI;
print $Q->header;
print $Q->start_html;
print `cd`;
print $Q->end_html;
---end script---
See what it says, and see if your relative paths should make sense
based on that.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 17 Sep 1997 15:08:57 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: postmail and perlis
Message-Id: <3421f26c.92670953@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 17 Sep 1997 09:15:09 +0200, Rene Sorger
<rene.sorger@onlinemedia.de> wrote:
>Hi,
>
>I am using a perl script for feedback delivery on my websites. The
>program Postmail is called by the script in this way :
>
>open (MESSAGE," | postmail -t -H$smtpserver");
>
>This works fine with perl32 3.07 and Netscape Enterprise Server. But
>using the same script with MS IIS and perlIS doesn't work, postmail is
>started, but does not end and so doesn't send the mail.
>Did anybody have problems like this and knows what to do about it ?
I believe that IIS has trouble with pipes in spawned processes, like
perl.exe.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 17 Sep 1997 15:13:45 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Question
Message-Id: <3423f2ee.92801301@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 17 Sep 1997 07:09:42 -0500, Agony <agony@eden.com> wrote:
>Hi..I was wondering: I have a program that attempts to open up a
>connection using telnet and open. From time to time, the host I'm
>telnetting to either goes down or for some other reason the connection
>doesn't get rejected, but just sits there without dropping. This causes
>my program to hang. Because the connection itself was actually opened, it
>just sits there, waiting for what would normally be a login prompt.
>
>My question is this: Is there a way for me to monitor that in such a way
>that, if there's no login prompt after, say, 5 seconds, it continues on?
Once solution (not necessarily the best) is to use the ALARM signal in
your program so that you can set a timer which will kick off an event
handler which can take corrective action. (Look up alarm() in the
perlfunc manpage.)
OR
Don't use telnet. Use your own TCP/IP sockets in Perl. Have a look at
socket(), select(), connect(), and others. You'll see some socket
programming examples in the Camel and Lamma books, too.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 16 Sep 97 20:14:17 GMT
From: maguirer@hercules.cs.uregina.ca (Robert Maguire)
Subject: Script to Capitalize HTML Tags
Message-Id: <maguirer.874440857@hercules>
I work with PERL and HTML a lot, and have tons of scripts I've written to
automate a lot of the tedious taks I found myself doing when writing and
maintaining my web sites...
One of my habits was to always capitalize my HTML tags in my documents
(i.e. <BODY BGCOLOR="#ffffff">, <A HREF="yaddayadda.html">, etc...). However,
recently I have teamed up with several people who have been writting HTML for
me as well to lighten my load. Unfortunately, they don't have the same habits
as I do of capitaliziong HTML tags.
Is there a script already out there that can do this for me or do i need to
write one myself. I've already got most of it written, except for just the
right regexp or regexps to do the capitalization correctly.
For example, conside the following HTML lines and how they should be capitalized
Ex: <body bgcolor="#FFFFFF" background="Image1.gif">
Should be: <BODY BGCOLOR="#FFFFFF" BACKGROUND="Image1.gif">
NOT!: <BODY BGCOLOR="#FFFFFF" BACKGROUND="IMAGE1.GIF">
Ex: <font face="Arial, Helvetica" color="#FF0033" size="7"><b>Affordance</b></font><br>
Should be: <FONT FACE="Arial, Helvetica" COLOR="#FF0033" SIZE="7"><B>Affordance</B></FONT><BR>
NOT!: <FONT FACE="ARIAL, HELVETICA" COLOR="#FF0033" SIZE="7"><B>Affordance</B></FONT><BR>
With the code I've written so far, all I can get out of it are those lines where
everything (!!) is capitalized. Actually, all I need is to ignore whatever's
in the quotes
thanks,
bob maguire
maguirer@tdi.uregina.ca
http://tdi.uregina.ca/~maguirer
------------------------------
Date: Tue, 16 Sep 1997 16:47:06 -0300
From: "Marden S. Neubert" <marden@dcc.ufmg.br>
Subject: Standard I/O operations in sockets
Message-Id: <Pine.SOL.3.96.970916154549.19216B-100000@turmalina>
If somebody could help me I would really appreciate.
I was developing a small client-server system in which I tried to
use the standard I/O operations on sockets.
The server listened to a socket created in PF_INET domain and of type
SOCK_STREAM. The client connected to that socket and issued a request.
All the I/O was done using the standard operations, e.g.,
print SOCKET $req;
for writing to and
$client_req = <SOCKET>;
for reading from the sockets.
The program was tested in a Linux system (client=linux, server=linux)
with Perl 5.003 and in a Solaris system (client=solaris, server=solaris)
with Perl version 5.004_01. I also used the Socket module provided with
those versions of Perl.
In both systems, the request was read with success by the server, but when
trying to send the response (also via the standard operation print, on the
same socket), no data could be read by the client on the other side. I was
suprised, as the man pages for `socket' both in Linux and Solaris stated
that a SOCK_STREAM socket provides a two-way byte stream.
Searching for some help in the Camel Book (2nd edition), I found a comment
in the manual entry for "send" which said that some non-UNIX systems
treated sockets differently from ordinary file descriptors, thus forcing
the use of send and recv for socket operations.
I modified the system for using send and recv instead of the standard I/O
operations and then it worked properly.
My questions are:
* Has anyone experienced such a problem?
* Am I doing something wrong or Linux and Solaris really don't support
the standard I/O operations for two-way communication with sockets?
* Does it also happen in other systems?
* If the comment in the Camel Book referred to ``non-UNIX'' systems, why
does it apply to Linux and Solaris?
Thanks a lot for your patience,
--x--
-- Marden S. Neubert --
------------------------------
Date: Wed, 17 Sep 1997 09:47:37 -0400
From: Steven Tolkin <steve.tolkin@fmr.com>
Subject: Re: The CSV format stinks!
Message-Id: <341FDF79.7A25@fmr.com>
Bart Lateur wrote:
> ... Quotes inside fields should be DOUBLED! ...
> As I said, I'm pretty sure your file doesn't originate from Excel, but
> is generated by (a program written by) someone who is unaware of these
> finer details.
It is possible that the data was written by dbase, or another Xbase
style database program. I believe that the CSV format was used in dbase
before Excel existed. I recall that there were "corner cases" involving
quotes and commas where the format was deficient. I could not find any
published document describing the format. So it had to be reverse
engineered based on examples, as is being done here. Has Microsoft
published a document describing Excel's comma separated values format?
Steve
--
Steven Tolkin 617-563-0516 steve.tolkin@fmr.com
Fidelity Investments R27C 82 Devonshire St. Boston MA 02109
I'm not really an actor, I just play one on TV. "Any opinions are mine."
------------------------------
Date: Wed, 17 Sep 1997 17:11:18 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Yknow, the thing about perl is....
Message-Id: <341FF316.11275A29@absyss.fr>
Randal Schwartz wrote:
>
> >>>>> "Jason" == Jason Hazzard <hazzard@usa.net> writes:
>
> Jason> But, geez the thing about perl is, I can write a script, that
> Jason> is say, about 200 lines long (I am doing one right now). Then,
> Jason> when I actually utilize the real power of this language I can
> Jason> boil it down to about 50 lines!
>
> Or show it to me, and I can probably get it down to 10 lines firing off
> three fewer processes. :-)
Are you implying that he has three useless 'cat's in his code?
- doug
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
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 1038
**************************************