[11668] in Perl-Users-Digest
Perl-Users Digest, Issue: 5268 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 31 12:04:12 1999
Date: Wed, 31 Mar 99 09:00:25 -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 Wed, 31 Mar 1999 Volume: 8 Number: 5268
Today's topics:
Re: 'find' for PPT (I R A Aggie)
Atlanta User Group <mcourter@mindspring.com>
Debugger has problems with forking programs. <Wm.Blasius@ks.sel.alcatel.de>
Re: Debugger has problems with forking programs. (Ilya Zakharevich)
Re: File Upload in Internet Explorer (Steve Linberg)
Re: flat file query Help!!! (Steve Linberg)
flat file query (Adolphus Harris)
Re: Hello World (Steve Linberg)
Re: HELP: Overwriting data within a file (M.J.T. Guy)
Re: HELP: Overwriting data within a file (Mario D'Alessio)
Re: HELP: Overwriting data within a file (Mario D'Alessio)
Re: How to Check to see if a cookie was written before (Bill Moseley)
Re: IIS 4,0 and PERL scripts. <jwarner@tivoli.com>
Re: Install Perl on win* using cygwin <Allan@due.net>
Re: Modify the file (Steve Linberg)
Re: More newbe confusion... <ffchopin@worldnet.att.net>
Re: Newbie questions... (Bill Moseley)
Open to Pipe does not work in cron matt@matt.com
Re: Opening >2Gb files on AIX <khelben_blackstaff@my-dejanews.com>
Re: Password change cgi script (Doran L. Barton)
Perl book illustrator needed <tedken@manning.com>
Re: Perl calling MS Word (Scott McMahan)
Re: program interaction using <<HERE docs (Christian M. Aranda)
Re: program interaction using <<HERE docs (Christian M. Aranda)
Re: program interaction using <<HERE docs <tbriles@austin.ibm.com>
Re: Q Mail::** - solved (Steve Linberg)
Q: Newbie needs help to with forms and Perl <trond@umm.no>
Re: Q: Newbie needs help to with forms and Perl (Steve Linberg)
Re: random elements from an array <jdf@pobox.com>
Re: Script produced no output... (Steve Linberg)
Re: Suppressing output from an externally run program.. (Larry Rosler)
Re: Text Wrapping without Text::Wrap <thomas@daimi.au.dk>
Re: two questions need help (Bill Moseley)
Re: Unknown Error (Bart Lateur)
URGENT Socket Failure with Perl 5.005_02 and Dynix 4.x <biwillia@cisco.com>
Re: which database to use in perl? Help (Steve Linberg)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Mar 1999 14:21:28 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: 'find' for PPT
Message-Id: <slrn7g4ce1.n91.fl_aggie@stat.fsu.edu>
On Wed, 31 Mar 1999 09:35:13 GMT, David Cantrell
<NukeEmUp@ThePentagon.com> wrote:
+ As no-one else has done it yet, I'm going to have a go at writing a
+ 'find' clone.
Ummm...dude...there maybe a reason why:
perldoc File::Find
James
------------------------------
Date: Wed, 31 Mar 1999 11:35:15 -0500
From: "Michael Courter" <mcourter@mindspring.com>
Subject: Atlanta User Group
Message-Id: <7dti6m$k5c$1@camel0.mindspring.com>
i'm looking for the where-abouts of the Atlanta Perl User Group. if anyone
has any knowledge of this UG please forward some info to me.
thanks.
michael courter
770.458.6846
mcourter@mindspring.com
------------------------------
Date: Wed, 31 Mar 1999 17:57:25 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
Subject: Debugger has problems with forking programs.
Message-Id: <370245E5.41C67EA6@ks.sel.alcatel.de>
Greetings,
I am working on a program that does a bunch of fork/execs of shell
processes. The forked process execs almost immediately waits a few
seconds and dies. This is expected.
I've set some breakpoints later in the parent program, but there's
no stopping this thing. Worse than that (I think) is that when all
the zombies have been reaped the debugger exits back to the shell!
Is this normal behaviour? Is there any way around it? I have tried
closing the pipes to the children (from both ends) but that didn't
seem to help.
This is driving me a little frantic.
TIA
Wm Blasius
--
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: 31 Mar 1999 16:57:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger has problems with forking programs.
Message-Id: <7dtk63$9ho$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to William Blasius #42722
<Wm.Blasius@ks.sel.alcatel.de>],
who wrote in article <370245E5.41C67EA6@ks.sel.alcatel.de>:
> Greetings,
>
> I am working on a program that does a bunch of fork/execs of shell
> processes. The forked process execs almost immediately waits a few
> seconds and dies. This is expected.
>
> I've set some breakpoints later in the parent program, but there's
> no stopping this thing. Worse than that (I think) is that when all
> the zombies have been reaped the debugger exits back to the shell!
>
> Is this normal behaviour? Is there any way around it? I have tried
> closing the pipes to the children (from both ends) but that didn't
> seem to help.
Posting a message from which one can understand *what* you see and
*what* you want to see may lead to better results.
Ilya
------------------------------
Date: Wed, 31 Mar 1999 11:24:51 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: File Upload in Internet Explorer
Message-Id: <linberg-3103991124510001@ltl1.literacy.upenn.edu>
In article <3701C556.B05902C1@abs.ascom.ch>, Toggweiler Mike
<ntogmi@abs.ascom.ch> wrote:
> Hi
>
> Ich habe erneut ein Problem mit dem File Upload im Internet Explorer 3.0
> und 4.0. Den Patch f|r IE3 habe ich installiert. Jetzt kann ich die
> Datei via Brows Button auswdhlen, das Verzeichnis und der Dateinamen
> werden mir |bermittelt, aber die Datei kann ich immer noch nicht lesen.
> Durch das erstellt mein Script eine 0 Byte Datei. Wie schon gesagt
> funktioniert im Gegensatz dies alles mit Netscape.
> Hat jemand eine Idee, an was das liegen kvnnte?
Ihr Problem hat nichts mit Perl zu tun, glaube Ich. Versuch mal
vielleicht in comp.infosystems.www.authoring.cgi, oder
comp.infosystems.www.browsers.misc. (Entschuldigen Sie mich, Ich spreche nur
Shei_deutcsh. :)
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 31 Mar 1999 11:14:31 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: flat file query Help!!!
Message-Id: <linberg-3103991114310001@ltl1.literacy.upenn.edu>
In article <3701C312.3A0AEDC7@email.uwp.edu>, Adolphus Harris
<harri006@email.uwp.edu> wrote:
> Hi,
> I am searching a flat file and it works well when I have a few fields
> per record.
> I have gone up to 19 fields and the length of a record now extends four
> lines in
> a pico editor. The @database=<Sourcefile>; and subsequent 'split'
> commands,will only
> work with one line of ASCII text at a time. How do I read in an entire
> record for splitting thereby avoiding the line wrap issue?
Don't split your lines with newlines, if you want to use the constuction
you use above. Don't let your editor break your lines. Or, declare a
record seperator you can search for, and split based on that, and then
join your broken lines before you parse.
There are many, many other solutions possible to your generally-stated problem.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: 31 Mar 1999 16:45:32 GMT
From: harri006@uwp.edu (Adolphus Harris)
Subject: flat file query
Message-Id: <7dtjfc$gtu@wiscnews.wiscnet.net>
123456789012345678;0987654321;abcdefghsjdurjeudjrues;4040404040404040404040404040404040404040;kskskskskskdjdujfjfjfjfjfkfkfkddkkddddd;wudjdjdjdjdjdjdjdjdjdjdjdjdjdjdotuyterhf;lodjdjdjdjdjdjdjdjdjdjdjdjdjdjdotuyterkt;123;321;12345;312;54321;456;67890;abc;98765;cba;29835;tee;12345.gifThis
is one (test)line or record of the flat file and this line contains19
fields separated by ; Perl seemed to read and split the fields correctly
the first time but when I closed my editor and reopened the ASCII file, I
got wrapped lines.I tried to allow three lines for a record and
concatenated them as followsbut did not seem to work. I am pretty new to
Perl so bear with my attemptsat scripting..#!/usr/local/bin/perlrequire
"/usr/local/lib/WWW/student/bbbbh/subp.cgi";&Parse_Form;$name =
$formdata{'searchkeys'};$database='/usr/local/lib/WWW/student/bbbbh/database.txt';
print "Content-type: text/html\n\n";$n=0; open (DATABASE,$database) ||
&ErrorMessage; @database_in=<DATABASE>; while(DATABASE){
chomp($database_in[$n]); chomp($database_in[$n+1]);
chomp($database_in[$n+2]); chomp($database_in[$n+3]);
$temp=$database_in[$n].$database_in[$n+1].$database_in[$n+2].$database_in[$n+3];
($mtl_num,$vndr_id,$vndr_mtl_num,$mtl_prime_desc,$mtl_secdry_desc,
$basic_um,$sellg_um_2,$sellg_um_cnvrn_fctr_2,$sellg_um_3,
$sellg_um_cnvrn_fctr_3,$lo_um,$lo_um_cnvrn_fctr,$lo_um_2,
$lo_um_cnvrn_fctr_2,$lo_um_3,$lo_um_cnvrn_fctr_3,$purch_um,
$basic_um_wt,$img_file_name)=split(/;/, $temp); if ($mtl_num == $name)
{ &MESG1; } else {
$oupt="<h3><b>$name</b></h3><h3><b>Not found. Please check product
code .</b></h3> \n"; } $n=$n+4;}
close(DATABASE);&MESG2; ___ _ _ _ / _ \
| | | | | | | |_| | __| | ___ | |_ __ | |__ _ _
___ | _ |/ _` |/ _ \| | '_ \| '_ \| | | / __|| | | | (_| | (_) | | |_) |
| | | |_| \__ \|_| |_|\__,_|\___/|_| .__/|_| |_|\__,_|___/
| | |_| On Wed,
31 Mar 1999, Tom Turton wrote:> Al,> > Do you HAVE to store the original
records with line feeds? If your> original file lets the records "wrap"
to multiple lines, PERL should still> be able to read in the whole line.>
> If you must have multiple lines per record, are they constant? I.e. do
you> always have 3 lines of data per record? If so, you may have to work
on> merging them (first chomping off the linefeed at the end of each
line).> > Guess you really need to post 2 or 3 representative lines of
the data> records you are trying to work with.> > Sorry I can't be of more
help.> > ---Tom> > Adolphus Harris wrote:> > > Hi,> > I am searching a
flat file and it works well when I have a few fields> > per record.> > I
have gone up to 19 fields and the length of a record now extends four> >
lines in> > a pico editor. The @database=<Sourcefile>; and subsequent
'split'> > commands,will only> > work with one line of ASCII text at a
time. How do I read in an entire> > record for splitting thereby avoiding
the line wrap issue?> > Thanks..,> > Al.> > > >
--
___ _ _ _
/ _ \ __| | ___ | |_ __ | |__ _ _ ___
| |_| |/ _` |/ _ \| | '_ \| '_ \| | | / __|
| _ | (_| | (_) | | |_) | | | | |_| \__ \
|_| |_|\__,_|\___/|_| .__/|_| |_|\__,_|___/
|_|
------------------------------
Date: Wed, 31 Mar 1999 11:16:24 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Hello World
Message-Id: <linberg-3103991116240001@ltl1.literacy.upenn.edu>
In article <7dt2th$oef$1@news6.svr.pol.co.uk>, "Jim Main"
<jim@stv-mcr.freeserve.co.uk> wrote:
> #!/usr/local/bin/perl
>
> print "What is your name? ";
> $name = <STDIN>;
> chomp $name;
> print "Hello, $name!\n";
>
> all it does however is print,
>
> "What is your name? Hello !"
Works fine for me, so maybe it's your environment.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: 31 Mar 1999 14:46:48 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: HELP: Overwriting data within a file
Message-Id: <7dtcgo$7cu$1@pegasus.csx.cam.ac.uk>
Chris Tremblay <anne@NOSPAMstorm.ca> wrote:
>
>I think (I may be wrong) in the following line:
>open ( FILEHANDLE, "+< $file" ) or die "cannot open $file";
>
>it should be:
>open ( FILEHANDLE, "< $file" ) or die "cannot open $file";
You are wrong. Please don't post random misleading stuff like this.
Mike Guy
------------------------------
Date: 31 Mar 99 15:50:59 GMT
From: dalessio@manatee.cig.mot.com (Mario D'Alessio)
Subject: Re: HELP: Overwriting data within a file
Message-Id: <dalessio.922895459@manatee>
Rick Delaney <rick.delaney@home.com> writes:
>[posted & mailed]
>Mario D'Alessio wrote:
>>
>> I'm attempting to write a script which will overwrite
>> data within a file. Here's a simplified code example:
>>
>> # Open file for read-write
>> open ( FILEHANDLE, "+< $file" ) or die "cannot open $file";
>
>[snip]
>
>> I threw in some "tell FILEHANDLE" to watch the current file
>> position. It SEEKs correctly to the proper position, but the print
>> statement always appends rather then writing at the current file
>> position.
>Are you sure you opened the file like that and not as "+>>$file"?
Yep.
> What OS are you on?
Unix under Sun4 OS.
> Can you create a complete (but small) program that
>exhibits this behaviour? I have used open/seek/print many times and
>have never had this problem.
Below is the complete program.
Thanks.
Mario
----- SNIP -----
#!/usr/misc/bin/perl5 -w
#
# This program adds new tags to MP3 files.
# If a tag already exists, it will be overwritten.
# If no tag exists, a new one will be appended to the file.
#
# Mario D'Alessio 03/30/99
#
# NOTE: This is only a test program.
#
## Hex dump of a sample MP3 file with a tag
##
## 0004f280 ffffffff ffffffff ffffffff ffff5441 ..............TA
## 0004f290 47546974 6c657878 78787878 78787878 GTitlexxxxxxxxxx
## 0004f2a0 78787878 78787878 78787878 78787841 xxxxxxxxxxxxxxxA
## 0004f2b0 72746973 74787878 78787878 78787878 rtistxxxxxxxxxxx
## 0004f2c0 78787878 78787878 78787878 78416c62 xxxxxxxxxxxxxAlb
## 0004f2d0 756d7878 78787878 78787878 78787878 umxxxxxxxxxxxxxx
## 0004f2e0 78787878 78787878 78787831 32333443 xxxxxxxxxxx1234C
## 0004f2f0 6f6d6d65 6e747878 78787878 78787878 ommentxxxxxxxxxx
## 0004f300 78787878 78787878 78787878 787b xxxxxxxxxxxxx{
$| = 1;
$file = 'file.mp3';
print "\nFILE: $file\n";
$mp3_tag_indicator_length = 3; # Size of 'TAG'
$mp3_tag_length = 30 # Title
+ 30 # Artist
+ 30 # Album
+ 4 # Date
+ 30 # Comment
+ 1; # Genre
open ( MP3_FILE, "+< $file" ) or die "cannot open $file";
$filesize = (stat MP3_FILE)[7];
print "SIZE: $filesize\n";
seek ( MP3_FILE,
$filesize - $mp3_tag_indicator_length - $mp3_tag_length,
0 );
print 'POS BEFORE READ: ', tell MP3_FILE, "\n";
read ( MP3_FILE,
$tag_indicator,
3 );
print 'POS AFTER READ : ', tell MP3_FILE, "\n";
print ">>$tag_indicator<<\n";
if ( $tag_indicator ne 'TAG' )
{
# Seek to end of file
seek ( MP3_FILE, $filesize, 0 );
print 'POS BEFORE WRITE ID: ', tell MP3_FILE, "\n";
print MP3_FILE 'TAG';
}
print 'POS BEFORE WRITE TAG: ', tell MP3_FILE, "\n";
print "\n";
#
# Write new tag
#
print MP3_FILE
#------------------------------
'NewTitle----------------------',
'NewArtist---------------------',
'NewAlbum----------------------',
'9876',
'NewComment--------------------',
'a';
print 'POS AFTER WRITE: ', tell MP3_FILE, "\n";
close MP3_FILE;
------------------------------
Date: 31 Mar 99 15:53:54 GMT
From: dalessio@manatee.cig.mot.com (Mario D'Alessio)
Subject: Re: HELP: Overwriting data within a file
Message-Id: <dalessio.922895634@manatee>
anne@storm.ca (Chris Tremblay) writes:
>Also sent courtesy email
>I think (I may be wrong) in the following line:
>open ( FILEHANDLE, "+< $file" ) or die "cannot open $file";
>it should be:
>open ( FILEHANDLE, "< $file" ) or die "cannot open $file";
The plus sign signifies read-write access
instead of just read access.
Mario
------------------------------
Date: Wed, 31 Mar 1999 06:05:03 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: How to Check to see if a cookie was written before exiting th escript
Message-Id: <MPG.116bcb683153a027989702@206.184.139.132>
You don't need two scripts, really.
You can also just send the redirect (Location) to the same script with
extra path info to tell your script to validate the cookie.
In article <3701ea78@news.uk.ibm.net>, vvb@xibm.net says...
>
> Todd A. Guillory <tag@io.com> wrote in message
> news:370135E9.A083E7F7@io.com...
> > I want to make sure a user has Cookies enabled. I thought I could set a
> > cookie and then check to make sure it exist, but that doesn't work,
> > since the cookie doesn't exist until the PERL script that set it has
> exited.
>
> From what I know from HTTP, it is not going to work in 1 script.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Wed, 31 Mar 1999 08:51:01 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: IIS 4,0 and PERL scripts.
Message-Id: <37023655.4F3FDF68@tivoli.com>
You have your scripts running under perl.exe most likely due to the association
for the .pl extension. You should associate .cgi or .plx (or some other
extension) to perlIS.dll. Installing the ActiveState build of Perl will correct
this. You can, however, correct this manually by going to MMC, right clicking
on your web server and selecting Properties. From there, click on the Home
Directory tab then click on the button labeled Configuration. In the window
that pops up, you will see what extensions are mapped to which applications in
IIS.
If you decide that is too much work and reinstall ActiveState Perl on your IIS
machine, make sure to go back and double check your settings in MMC under Home
Directory-->Configuration. Older AS builds didn't remove mappings to themselves
which resulted in several mappings to .cgi/.plx (whatever you used during the
installation). Problem with that is IIS will use the first mapping it finds
which typically pointed at a version/location of Perl that was no longer what
you wanted.
Using perlIS.dll allows IIS to run Perl natively much like mod-perl does for
Apache. It will allow IIS to run Perl in a multithreaded fashion and thereby
save you the overhead of IIS launching a completely new environment for
Perl.exe every time a script is invoked.
As for your second problem--the problem of a script taking 20 minutes to
complete--what is it that you are trying to do? Are you attempting a really
complex SQL query? If so, you will want to stop and do a big-O analysis on what
your SQL is doing. If you are performing a complex multi-table query, it is
likely your search is trying to perform n^m operations (or O(n^m) in big-O
notation) where n is the number of tables and m is the number of search
operations performed per table. It may be faster to break it down into
multiple queries that perform fewer operations.
Hope this helps.
blazek@sisblansko.cz wrote:
> Hi, I have a script in PERL running on IIS 4.0. We restricted numbers of
> users to 2 only but it does not solve the problem. As this script runs about
> 20 minutes before it finishes users can just start the script and then log
> off. The run PERL script is in memory and another user can loging in to our
> web server and start another Perl script process. So, in memory we can have
> about 25 PERL scripts allocating of 224 MB memory. When the memory is
> comming to 250 MB, IIS 4.0 hangs. (We have 64 MB RAM in our server). Any
> help would be appreciated.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
John Warner Tivoli Systems Inc.
Sales Support Engineer 9442 Capital Of Texas Hwy North
Sales Infrastructure Group Austin, TX 78759
john_warner@tivoli.com
------------------------------
Date: Wed, 31 Mar 1999 11:38:01 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Install Perl on win* using cygwin
Message-Id: <7dtiq9$19j$1@camel25.mindspring.com>
neline@pacific.net.sg wrote in message <3701EDE0.F74B789B@pacific.net.sg>...
:Tried to install Perl on windows using cygwin.
:After running sh Configure it stops and says it needs 'awk'
:Searched cygnus but come up empty handed. Can someone help - do I really
:need awk and if so where do I get it for use with cygwin. (Do I have to
:build awk from scratch?)
:regards
In the latest Perl Journal there is an article describing installing Perl
and Perl/Tk on Win32 by Steve Lidie. I am pretty sure it talked about using
cygwin, you might want to check it out.
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Imagination is more important than knowledge.
- Albert Einstein
------------------------------
Date: Wed, 31 Mar 1999 11:08:52 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Modify the file
Message-Id: <linberg-3103991108520001@ltl1.literacy.upenn.edu>
In article <37022647.4663C09D@netvigator.com>, Alex
<ex5316@netvigator.com> wrote:
> Hi,
> I've a question.
> After I open the file, then modify the data. How can I save the new data
>
> to the file ?
Open the file for writing and print your data to it. Be sure you're
willing to overwrite whatever was there before, and be sure to check your
open and close (and all system calls) for errors.
There are many fine examples of this very basic task in the
documentation. Good luck.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 31 Mar 1999 10:18:17 -0500
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: More newbe confusion...
Message-Id: <7dteof$2f1$1@bgtnsc02.worldnet.att.net>
> Erm, why don't you "use CGI.pm;" which will do all this funny splitting
> for you? And provides nice methods to get at your parameters?
Absolutely what I was thinking... If you have the 2nd Edition of Learning
Perl, then the chapter on CGI explains how to decode and use URL/Form
parameters very well. For a more detailed explanation, purchase Guide to
Programming with CGI.pm, by Lincoln Stein. He wrote the module, so he knows
what's going on. The book is VERY well written with lots of good examples
and a complete function reference. For more information, though, your
questions will best be addressed in comp.infosystems.www.authoring.cgi.
Jason Simms
------------------------------
Date: Wed, 31 Mar 1999 06:17:07 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Newbie questions...
Message-Id: <MPG.116bce426cb98f10989704@206.184.139.132>
In article <3701F14A.D88@student.hk-r.se>, pt98hwi@student.hk-r.se
says...
> 1. I4m supposed to do a homepage with a form that a visitor can fill in.
> Then a e-mail is supposed to be sent to a sertain e-mail adress
> containing what the visitor just wrote (name, address and comments etc).
> How can this be done? I know that I must (or?) use a CGI script. But how
> do I make my owne CGI-script? Do I have to use Perl? What is the most
> common to use in this situation? What would YOU suggest?
Use Perl.
Homework?
http://www.smithrenaud.com/public/CGI_MetaFAQ.html
is one of many sites.
Use CGI.pm, too.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Wed, 31 Mar 1999 16:41:18 GMT
From: matt@matt.com
Subject: Open to Pipe does not work in cron
Message-Id: <37024f50.151107781@news.infonent.com>
Hello
I have a little prog like this:
open (ROUTES, "/bin/rsh cisco-router show ip route |");
while (<ROUTES>) {
parse pertinent info out of the routing table;
}
close (<ROUTES>);
The problem is that this works great from the command line, but will
not work from cron. The rsh command does not complete. Sometimes it
gets through about 16 or 20 entries, usually it gets through none.
What I'm not sure about is how perl redirects command output. Is it
trying to use STDOUT? That would explain things. Is it using its own
filehandle? I should autoflush().
Any help is greatly appreciated.
--matt hempel
------------------------------
Date: Wed, 31 Mar 1999 15:28:24 GMT
From: Khelben Blackstaff <khelben_blackstaff@my-dejanews.com>
Subject: Re: Opening >2Gb files on AIX
Message-Id: <7dteud$ul1$1@nnrp1.dejanews.com>
In article <Pine.SOL.3.96.990331105834.3464I-100000@swan>,
Ron Grunwald <rong@prth.tensor.pgs.com> wrote:
> Hi all,
>
> I've recently come across a problem where my Perl script attempts
> to open a file of around 2.2Gb in size. It couldn't do it.
> Files below 2Gb in size do open successfully. I've used the open ()
> and sysopen () Perl functions for this.
>
> The operating system that the script runs on is AIX 4.2.1, which
> does support file sizes of > 2Gb. The Perl release that I'm using
> is 5.004.
>
> My question then is: Does Perl provide a facility whereby files
> of size greater than 2Gb can be processed successfully ?
>
I have never tried to open such large files, but do you use the
"Large file enabled JFS" with some latter fix ?
Perhaps upgrading to perl 5.005_02 would also help.
*--------------------------------------------------------------*
| Khelben Blackstaff is out there ! ! |
| apache,perl,php,linux,startrek,b5,eastern,stories |
*--------------------------------------------------------------*
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 31 Mar 1999 09:55:36 -0700
From: fozz@xmission.xmission.com (Doran L. Barton)
Subject: Re: Password change cgi script
Message-Id: <7dtk28$rqm$1@xmission.xmission.com>
tgerstel@world.std.com (Tom Gerstel) writes:
>>I am trying to write a cgi script for a group of users in my server. The
>>script should be able to change the password for the respective user by
>>calling 'passwd' program. Is there any script already existing? I am on
>>Linux.
>Generally a really bad idea.
Generally, it *is* a very dangerous thing to be doing... especially if
you're not completely aware of the security implications involved. However,
if the server is only accessible to trusted machines, etc. etc. there are
ways to do it.
Here's how we do it:
Our CGI process (running as user 'www') writes a command to a file (owned
by www with permissions 600) which looks like this:
setpass:jdoe:party99
Then, every 5 or 10 minutes, a cron-executed processed owned by root is
run- which reads the file containing these commands and does the
appropriate tasks. We use this system to not only change passwords, but
create/delete users, set up host information in DNS tables, and set up
mail aliases.
The administrator gets notified via e-mail of each task completed (i.e.
"jdoe's password was set" or "created user 'bobby'".
Hope that helps you in your planning.
-=Fozz
--
Doran L. Barton = fozz@xmission.com && http://www.xmission.com/~fozz/
"Where do you want Microsoft to go today?" --Ronald Barry
"This may seem a bit weird, but that's okay, because it is weird."
-- Larry Wall in the Perl v5 man page
------------------------------
Date: Wed, 31 Mar 1999 11:56:58 -0500
From: Ted Kennedy <tedken@manning.com>
Subject: Perl book illustrator needed
Message-Id: <370253DA.D0841C3E@manning.com>
We are looking for someone with Perl programming knowledge and a
graphics sense to work with the author of a new Perl book to develop
illustrations to amplify selected portions of the text. If interested,
please send a brief description of your credentials to me at
<tedken@manning.com> and I will send you more information.
------------------------------
Date: 31 Mar 1999 16:48:51 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Perl calling MS Word
Message-Id: <370251f3.0@news.new-era.net>
Bob Daly (bdaly@averstar.com) wrote:
> Does anyone know how to call Word in Perl?
You must use Automation.
If you can wait til August, I have a book coming out which
discusses this.
Scott
------------------------------
Date: Wed, 31 Mar 1999 16:05:25 GMT
From: christianarandaOUT@OUTyahoo.com (Christian M. Aranda)
Subject: Re: program interaction using <<HERE docs
Message-Id: <37024663.87266192@news.bmc.com>
On Wed, 31 Mar 1999 02:53:41 GMT, Rick Delaney <rick.delaney@home.com>
wrote:
>You *really* aught to look into installing the module yourself. Please
>don't ignore people's helpful suggestions.
>
>I hope James doesn't mind me ripping off his answer, but it *will* help
>you out.
>
>I R A Aggie wrote:
>:
>: I believe what you seek is 'perldoc perlfaq8', specifically:
>:
FYI - I wasn't ignoring his help. I stated a couple of times that the
sysadmin WILL NOT let a module be on his machine. Period. End of
story. It doesn't matter where I put it. Period.
>> this sucker just hangs when I run it.
>
>Of course. ftp is an interactive program and it will wait forever until
>you type in the password. There are sometimes ways around this with dot
>files, but this is not a perl issue.
>
the password was supplied in the line
user john password
which works when logged into ftp using the -n option.
>man ftp
perhaps you should do the same.
I don't mean to sound hostile, I'm not. I just don't like getting
responses to messages that don't take in to account what my original
post said.
(I'm sure I'll get flamed for this.)
Christian M. Aranda
------------------------------
Date: Wed, 31 Mar 1999 16:12:08 GMT
From: christianarandaOUT@OUTyahoo.com (Christian M. Aranda)
Subject: Re: program interaction using <<HERE docs
Message-Id: <37034850.87759401@news.bmc.com>
On Wed, 31 Mar 1999 01:35:09 GMT, drgreer@qtiworld.com (Darren Greer)
wrote:
>Here is what I do....with success:
>
>[snip valuable code]
this worked like a charm. Thank you very much for the help!
>
>Darren
------------------------------
Date: Wed, 31 Mar 1999 09:38:39 -0600
From: Tom Briles <tbriles@austin.ibm.com>
Subject: Re: program interaction using <<HERE docs
Message-Id: <3702417F.98CA7DA7@austin.ibm.com>
Rick Delaney wrote:
> > Code below, with an explaination of what happens following:
> >
> > print <<`FTP`;
> > /usr/bin/ftp -ni aix7
> > user john password
> > cd catest
> > put myfile.txt
> > quit
> > FTP
> >
> > this sucker just hangs when I run it.
>
> Of course. ftp is an interactive program and it will wait forever until
> you type in the password. There are sometimes ways around this with dot
> files, but this is not a perl issue.
>
> man ftp
Actually, *you* should look at the ftp manpage...particularly the "user"
subcommand.
- Tom
------------------------------
Date: Wed, 31 Mar 1999 11:12:32 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Q Mail::** - solved
Message-Id: <linberg-3103991112320001@ltl1.literacy.upenn.edu>
In article <37021982@news1.us.ibm.net>, "tavi" <tavi@earthling.net> wrote:
> It seems that after explaining my problem to you fine folks, and re-reading
> the documentation I have, I stumbled upon my answer.
Why not share it so others can benefit from your solution?
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 31 Mar 1999 16:11:11 +0200
From: "Trond Hjelmaas" <trond@umm.no>
Subject: Q: Newbie needs help to with forms and Perl
Message-Id: <A_pM2.167$Te3.39@news1.online.no>
Thank you for taking the time reading this quiz!
Facts:
We have IIS(Internet Information Server), WinNT and a VBS script that sends
mail, vi execute it (using cscript.exe in a command window) and it worls
great!
Ex: "cscript c:\Perl\sendmail.vbs -t [receiver] -f [sender] -s [subject] -b
[body]"
Problem:
Vi have a Webpage with three forms (named: _F,_S,_B), where _F is where a
user writes his email-adress, _S where he writes the subject...etc (the
parameter -t is hardcoded to our emailaddress in the PerlScript) How do we
by using Perl get the info in these three fields (_F,_S,_B) and
concatinate(put together) it to one command that can be executed???
This is what in the end should be executed from the desired/wanted
PerlScript:
"cscript C:\Perl\sendmail.vbs -t our@email.address -f _F -s _S -b _B"
where _F,_S,_B is the input from the Webpage.
Help appreciated and needed!
Best regards,
Trond Hjelmaas
th@umm.no
------------------------------
Date: Wed, 31 Mar 1999 11:07:31 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Q: Newbie needs help to with forms and Perl
Message-Id: <linberg-3103991107310001@ltl1.literacy.upenn.edu>
In article <A_pM2.167$Te3.39@news1.online.no>, "Trond Hjelmaas"
<trond@umm.no> wrote:
> Thank you for taking the time reading this quiz!
Since when is a request for help a "quiz"?
> This is what in the end should be executed from the desired/wanted
> PerlScript:
>
> "cscript C:\Perl\sendmail.vbs -t our@email.address -f _F -s _S -b _B"
>
> where _F,_S,_B is the input from the Webpage.
Look into CGI.pm; what you want to do is trivial.
use CGI;
my $q = new CGI;
my $f_param = $q->param("_F");
(etc).
my $command = "cscript [blah blah] -f $f_param [etc]";
> Help appreciated and needed!
Please be sure you understand all of the security implications of blindly
feeding user input into a command line to be executed on your system. A
good read is Lincoln Stein's WWW Security FAQ
(<http://language.perl.com/CPAN/doc/FAQs/cgi/www-security-faq.html>).
Good luck.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: 31 Mar 1999 09:46:48 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "TinP" <tgj@snip..net>
Subject: Re: random elements from an array
Message-Id: <m3zp4t3eef.fsf@joshua.panix.com>
"TinP" <tgj@snip..net> writes:
> How can you take a random element of an array yet not randomly
> choose it again?
my $element = splice(@array, rand @array, 1);
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Wed, 31 Mar 1999 11:09:45 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Script produced no output...
Message-Id: <linberg-3103991109450001@ltl1.literacy.upenn.edu>
In article <7dt86q$4if$1@news2.xs4all.nl>, "frank" <fvdm@dds.nl> wrote:
> I'm trying to use the perlis.dll with SSI.
> When I run the script from an URL it works fine, but when I'm trying to call
> it with SSI it produces no output...
>
> What am I doing wrong ?
Your server may not be configured to properly handle SSI, for a start.
Begin with your server's documentation and get a simple SSI working; after
that you know it's a code problem.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 31 Mar 1999 06:57:49 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Suppressing output from an externally run program...
Message-Id: <MPG.116bd7c8f6b6a3739897f9@nntp.hpl.hp.com>
In article <3701E5C6.A22129BC@datenrevision.de> on Wed, 31 Mar 1999
11:07:18 +0200, Philip Newton <Philip.Newton@datenrevision.de >says...
> Darren Greer wrote:
> > This is what I use....with success:
> > system("cmd 1>/dev/null");
> > Try that...
>
> system "cmd 1>/dev/null 2>&1"
>
> , or you'll still have STDERR on your console. (Assumes your shell is of
> the sh family (e.g. sh, bash, ksh), not the csh (tcsh, etc.) family.)
It doesn't matter what 'his' shell is, unless it is hiding in /bin/sh.
>From `perldoc -f system`:
If there is only one scalar argument, the argument is checked for shell
metacharacters, and if there are any, the entire argument is passed to
the system's command shell for parsing (this is /bin/sh -c on Unix
platforms, but varies on other platforms).
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 31 Mar 1999 17:47:52 +0200
From: Thomas Jespersen <thomas@daimi.au.dk>
Subject: Re: Text Wrapping without Text::Wrap
Message-Id: <y4nemm5hd93.fsf@aries.daimi.au.dk>
John Callender <jbc@shell2.la.best.com> writes:
> I had to smile, too, though in my case it was in response to the number
> of matches to the "cat walked across my keyboard" query at DejaNews
> *not* related to the original question. Obviously, this cat walking
> across the keyboard thing is a major, and hitherto unpublicized, source
> of data loss.
Yes, and strangely it seems to be related to "transportation" somehow,
at least that was what my search revealed.
The most popular newsgroup related to cats walking across keyboards:
misc.transport.urban-transit
misc.transport.road
ba.transportation
la.transportation
and on the 5th place
comp.lang.perl.misc
at the bottom of the list you find the only logical group for this
topic:
rec.pets.cats.anecdotes
------------------------------
Date: Wed, 31 Mar 1999 06:11:45 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: two questions need help
Message-Id: <MPG.116bccffec6f6b9b989703@206.184.139.132>
In article <7dssmm$f69$1@nnrp1.dejanews.com>, fanxin@my-dejanews.com
says...
> Hi all experts: there has two questions: 1. i have downloaded almost all
> mailing list cgi script on the net.
Cool. How many are there?
> all of them are almost same. a loop
> invokes sendmail once by once. the mail is send by openning a pipe from the
> script to sendmail. BUT! this doesn't work when the list is very long.
> eg.5000 the loop will only go about 25-30 times when it needs to go 5000
> times.
This is a self protection mode of your server. It realized that after
about 100 emails enough people will be so mad at it that it fears being
unplugged by an angry mob.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Wed, 31 Mar 1999 14:50:03 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Unknown Error
Message-Id: <37052a61.21353357@news.skynet.be>
souhaib@my-dejanews.com wrote:
>When i try to execute a CGI-Perl program in my page web, the program don't
>execute.
>So, when i consult the file "error.log", always the next message was writing:
>
>Premature end of script headers: c:/program files/apache group/apache/cgi-bin/
>[programme.pl]
>
>Q: what means this message?
>Q: Where is the problem?
>Q: what the purpose solution?
>NB: in the perl program's header, i put always "#!c:/perl/bin/perl.exe"
Is that on Windows? It looks like it. I don't think you really need
that. Oh well, it won't hurt.
The message means that the script didn't behave: it didn't send the
required proper headers, blanks line to terminate the header section,
and probably not the even the body.
Likely reason: a syntax error, so that the script didn't even compile
properly.
It's not unadviceable to include some code in the script so that error
messages, even fatal ones, are sent to the browser. Some CGI library
files have this option built-in; the code snippet
use CGI::Carp qw(fatalsToBrowser);
may be all that is needed.
However, I don't like what it does. I want EVERYTHING to show up in the
browser. So here's my (very bare) alternative; assuming that the script
ALWAYS needs to output a "content-type: text/html" header, I put it in a
BEGIN block at the *front* of the script:
BEGIN {
$| = 1;
print "Content-type: text/html\n\n";
open(STDERR, ">&STDOUT");
}
A more elaborate approach might wrap messages to be printed for
$SIG{__WARN__}and $SIG{__DIE__} into some bare html before printing it.
Some error messages still seem to bypass this mechanism, which isn't
nice.
BTW a tied filehandle doesn't seem to work, either.
Bart.
------------------------------
Date: Wed, 31 Mar 1999 10:47:19 -0500
From: Bill Williams <biwillia@cisco.com>
Subject: URGENT Socket Failure with Perl 5.005_02 and Dynix 4.x
Message-Id: <37024387.A63BCEA0@cisco.com>
After having upgrading a few weeks ago, I am seeing rampant wierdness
with scripts using
Socket.pm. Am starting to think there may be a problem with the
distribution. This was a
clean install, and am wondering if anyone else has seen this.
None of these invocations will work; perl cannot find the socket module:
#use IO::Socket;
#require 'sys/socket.ph';
#use lib '/local/lib/perl5/i386-dynixptx/IO';
However, if I use this one:
use lib '/local/lib/perl5/5.00502/i386-dynixptx/IO';
I get:
<monza> <1839> </users/b/biwillia> ./lckusers_EMAN.pl -t
Socket version 1.3 required--this is only version at
/local/lib/perl5/5.00502/i386-dynixptx/IO/Socket.pm line 118.
a long listing of this Socket.pm shows:
> -r--r--r-- 1 root other 16948 Mar 26 08:53
> /local/lib/perl5/5.00502/i386-dynixptx/IO/Socket.pm
which is when I compiled it, but it claims to be $VERSION = "1.1603";
On a different system, compiled this morning, I have a socket.pm with
the following attributes:
> -r--r--r-- 1 root other 8039 Sep 14 1998
> /local/lib/perl5/i386-dynixptx/Socket.pm
which claims to be $VERSION = "1.7"; but that one just hangs, never
completing and croaking on
the following:
> 931 # send amount of data back as an ack; we will let the server
> check us;
> 932 #
> 933 send(S,$dataSize,24,0)||warn "croaking $!";
> 934
> 935 #
> 936 # read data go to read instead of recv because of bulk of data
>
> 937 # reading in 4k chunks; length is the total amount from above
which is telling me that it ain't working.
So the $64k question is, why would two separate compiles of perl with
the same source load
two entirely different versions of Socket.pm? Any help would be
appreciated.
--
Thanks,
__________________________
Bill Williams
ERP Systems Administrator
Cisco Systems - RTP-IS
------------------------------
Date: Wed, 31 Mar 1999 11:12:11 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: which database to use in perl? Help
Message-Id: <linberg-3103991112110001@ltl1.literacy.upenn.edu>
In article <7dt62p$mjr$1@nnrp1.dejanews.com>, ashishji@hotpop.com wrote:
> I want to use a simple but effective database of perl on my website, which
> could handel upto 40,000 records and provide routines for searching, inserting
> ,deleting ,frequent appending of the records say 1 record per second.
There's no need to post the same query three times under two different threads.
Your question, as stated, is far too vague to answer well. You don't even
mention what OS your server is running under. If it's *nix, there are
many fine, powerful databases available to choose from - some are free and
some cost. If it's NT. there's a different set; MacOS, a different set.
Any decent RDMS should be able to handle your database easily if you
normalize the tables and have a reasonable amount of RAM and CPU speed.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
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 5268
**************************************