[7835] in Perl-Users-Digest
Perl-Users Digest, Issue: 1460 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 12 09:28:16 1997
Date: Fri, 12 Dec 97 06:01:13 -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 Fri, 12 Dec 1997 Volume: 8 Number: 1460
Today's topics:
Re: /string/o <rootbeer@teleport.com>
ANNOUNCE: IndexMaker 3.3: an index.html maker from PDF, <pivari@geocities.com>
Re: autoflush on/off (Martien Verbruggen)
Binary vs. ASCII input <dmills@riag.com>
Re: Bug in perl5db.pl <adavid@netinfo.com.au>
Re: Can Perl handle Chinese(or other Asian languages)? <flavell@mail.cern.ch>
Re: Can't 'print' large (> 6M) files <dformosa@st.nepean.uws.edu.au>
Chunking up a large input file <dmills@riag.com>
Re: Download Question - Yes Please (Martien Verbruggen)
Re: Download Question (Martien Verbruggen)
File Sorting with UNIX from Perl <strower@ims.ltd.uk>
Foreach, array, s/// problem (James Gryga)
Re: Help a newbie out (Martien Verbruggen)
Re: Help a newbie out (brian d foy)
Re: just starting with perl <rootbeer@teleport.com>
Re: just starting with perl (Frank Reichstein)
mkdir command (Kitty Smith)
Re: mkdir command <rra@stanford.edu>
Re: mkdir not recoginizing mode <rootbeer@teleport.com>
Re: Most Common Web dev tools? <rootbeer@teleport.com>
Re: need to know what browser the client is using (brian d foy)
OraPerl <-> OraTcl (Hisao Nakanishi)
Re: Perl Modules Info (brian d foy)
Re: Perl Plug-In for Netscape? <adavid@netinfo.com.au>
Re: please help : web personals (Martien Verbruggen)
Question about telnet.pl (janghada)
Re: recursive regex? (Martien Verbruggen)
Socket woes.... (Cliff Bradshaw)
Re: To use a ref or not? (brian d foy)
uninitialized value messages when using -w directive an <deanb@cons.prg.home.net>
Re: untainting data <rootbeer@teleport.com>
Re: Using a fork (help needed) <adavid@netinfo.com.au>
Re: WANTED: "generic" logfile parse/report (Martien Verbruggen)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 11 Dec 1997 21:04:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Blake D. Mills IV" <blakem@seas.upenn.edu>
Subject: Re: /string/o
Message-Id: <Pine.GSO.3.96.971211210242.10598D-100000@user2.teleport.com>
On 11 Dec 1997, Blake D. Mills IV wrote:
> I just inherited some code that has:
>
> m/constant/o
Your suspicion that that /o is useless is correct. (So is the 'm'. :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 12 Dec 1997 10:19:16 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: IndexMaker 3.3: an index.html maker from PDF,HTML,VRML and other files
Message-Id: <34910FA4.6EEA@geocities.com>
Hi,
I'm glad to announce the version 3.3 of IndexMaker a perl script to make
an index.html file from PDF, HTML, VRML and other files.
At the moment, it uses
the /Author field and the first /Title field in every matched PDF files,
the <TITLE> </TITLE> field and the META Description and Author fields
in every matched HTML files
the Info node field in every matched VRML 1.0 files
the WorldInfo node field info and title in every matched VRML 2.0 files
and the name of the file in the others.
It should work with PERL 4 and 5.
What's new with version 3.3
In HTML files now the program searchs the META Description and Author
fields
Added docs/HTML_META.notes
Added tests directory
This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Lab/3469
Enjoy it!
Send me your suggestions.
--
_/_/_/_/ _/_/_/ Fabrizio Pivari
_/ _/ _/ mailto:pivari@hotmail.com
_/_/_/ _/_/_/ mailto:pivari@yahoo.com
_/ _/ mailto:pivari@geocities.com
_/ _/ http://www.geocities.com/CapeCanaveral/Lab/3469/
------------------------------
Date: 12 Dec 1997 04:43:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: autoflush on/off
Message-Id: <66qfdk$23p$5@comdyn.comdyn.com.au>
In article <881787422.374669313@dejanews.com>,
g.e.kohr@gats.hampton.va.us writes:
> I have a server push piece of code where I would like to be able to
> enable/disable perls autoflush. Essentially the code looks like this:
[snipped unreadable code. I am really too lazy to reformat it for you]
As it clearly states in your unreadable code:
$| = 1; # Force a flush on every print
$| = 0; # Turn off flush on every print
> I'm thinking that this system call could have a filehandle assigned to it.
> I've played with the line, BUT, I don't know the syntax
$| controls _perl_'s buffering. Other buffering will most likely be
unaffected.
system("$idl < $idl_inpt 2> $idl_log") ||
print TRACE "Idl returned an Error: $!\n"
You expect output from this? I don't think $| influences buffering of
external programs. You'll have to rewrite the external program, most
likely.
Martien
PS. next time, PLEASE, post code that is readable.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Fri, 12 Dec 1997 07:44:35 -0500
From: Daniel Mills - Software Engineer Alexandria <dmills@riag.com>
Subject: Binary vs. ASCII input
Message-Id: <349131B3.4F9@riag.com>
This is somethi
------------------------------
Date: Sat, 13 Dec 1997 00:13:21 +1100
From: Anthony David <adavid@netinfo.com.au>
Subject: Re: Bug in perl5db.pl
Message-Id: <34913870.EB29AD1F@netinfo.com.au>
Jason A. Smith wrote:
> I found a small bug or typo in the perl debugger (perl5db.pl)
> that comes with perl5.004_01. I checked the one that comes with
> perl5.004_04 and it still has the bug. The bug is in the system
> subroutine where it saves the STDIN and STDOUT file handles before
> calling system, then restores them. Instead of saving STDOUT, it is
> saving OUT, so that after making a system call in the debugger the
> STDOUT stream is set to OUT and not restored to STDOUT. I am not sure
> who I should notify about this bug so I am posting it here hoping that
> the right person will see it.
use perlbug and it will be automagically sent to the right people.
> --
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: Fri, 12 Dec 1997 13:23:00 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Can Perl handle Chinese(or other Asian languages)?
Message-Id: <Pine.A41.3.95a.971212131635.120530C-100000@sp064>
On Fri, 12 Dec 1997, Stuart Price wrote:
> Uploading data files as ASCII scrambles the Japanese, so I have to
> upload as binary, which scrambles line feeds.
"Japanese" is not a character encoding, it is a language (as you
obviously know). The issue is, what character encoding you are using on
the respective platforms.
Sounds as if your uploading procedure doesn't support what you're
trying.
However, that isn't really a Perl question. Unless you coded your
uploading in Perl, of course.
--
"A closed mouth gathers no foot"
"The mind works best when it is open"
- decisions, decisions...
------------------------------
Date: 12 Dec 1997 12:39:51 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Can't 'print' large (> 6M) files
Message-Id: <881930391.425313@cabal>
In <Pine.GSO.3.96.971211185126.22475E-100000@user2.teleport.com> Tom Phoenix <rootbeer@teleport.com> writes:
>On Thu, 11 Dec 1997, Ben Rector wrote:
>> I have been have problems printing files larger than 2Mb with
>> "print" and 6Mb with "syswrite".
>> Each time I try to print I get an "Out of Memory!" error.
>Sounds as if you're running out of memory. :-)
Let me guess Mr Rector is useing the line
print <>;
Which loads and entire file into memory and then prints it out again.
My advice would be to do this
while(<>) {
print;
}
Wich dose it line bye line. This should save some memory.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep. I do not reply to mungged
Support NoCeM http://www.cm.org/ addresses.
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Fri, 12 Dec 1997 08:06:54 -0500
From: Daniel Mills - Software Engineer Alexandria <dmills@riag.com>
Subject: Chunking up a large input file
Message-Id: <349136EE.7F27@riag.com>
I've written a program that processes SGML files (you know...HTMLs
dad). This program has, however, a very serious problem. When the
input file becomes excessively large (approx. > 10Mb), the program bombs
and gives an "Out of memory" message. As far as I can tell this is
happening because of the way I'm using the input stream which is as a
single string.
e.g.
open(FILEIN,"text.sgml")
undef $/;
while(<FILEIN>){
.
.
}
The out of memory problem can be solved if I replace the while with:
while(read FILEIN,$buffer,BUFSIZE)
The problem with this approach is if the read stops in the middle of an
SGML tag, I've got problems. For example, if the program is crusing
along and the read has nearly finished grabbing BUFSIZE bytes and the
input stream looks like:
....and she said, don't look at me that way</quote><quote>His reply ...
^
read ends here
If BUFSIZE bytes have been read in where the end read is indicated,
information will be lost.
Is there a simple way to make the read smart so that it won't break up
any tags or do I need to devise a completely different approach?
Thanks,
-- Dan
------------
Daniel Mills
Research Institute of America Group
These opinions and ideas are, of course, solely the authors'.
------------------------------
Date: 12 Dec 1997 05:09:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Download Question - Yes Please
Message-Id: <66qgun$2c4$3@comdyn.comdyn.com.au>
In article <34907C98.46D7@deletethisstringanddot.flash.net>,
Steve <dtlgc@deletethisstringanddot.flash.net> writes:
> It's a valid email address, just modified for spam-related reasons.
> dtlgc@flash.net
So it is not valid. Anything that doesn't work without editing if I
try to reply to a message, is not valid.
'This is a working computer, Sir'
'But it doesn't work!'
'All you need to do is take it apart, and modify it, so that all
the cables are connected, and there is actually memory in there..
oh, and a disk'
'Oh, ok.. I see..'
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: 12 Dec 1997 05:06:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Download Question
Message-Id: <66qgoa$2c4$2@comdyn.comdyn.com.au>
In article <348F323C.D58D213D@tuipgraphics.com>,
Nash Weber <nash@tuipgraphics.com> writes:
> HOW CAN I DOWNLOAD THE ARCHIVE TO THE CLIENT WITHOUT HAVING THE ARCHIVE
> RENAMED TO THE NAME OF THE SCRIPT THAT CALLS IT?? Any ideas???
You could have asked nicely, instead of shouting. Doesn't exactly
endear.
Try one of the comp.infosystems.www.* groups. Like us, they get this
question all the time. Unlike us, they are willing to talk about CGI
and WWW problems. Alternatively, you could try a search on dejanews,
which will probably yield you some 100 answers immediately.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing down
Webmaster www.tradingpost.com.au | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd. | I can ask him what he meant - Steven
NSW, Australia | Wright
------------------------------
Date: Fri, 12 Dec 1997 12:31:04 +0000
From: Stuart Trower <strower@ims.ltd.uk>
Subject: File Sorting with UNIX from Perl
Message-Id: <34912E88.D533EDD7@ims.ltd.uk>
Hello,
I'm fairly new to perl programming. How can I call the UNIX sort command
from within a perl script. I want to sort the lines of a text file based
on the first charcater of each line (which I currently use the SORT
command in UNIX for). I want to automate this so that everytime I run a
script it does the sort for me, this is part of a bigger script. The
sort command in Perl kind of confuses me and only seems to work with
arrays, lists....So how can I call the Unix sort command and not the
perl sort command. Help
Stuart
strower@ims.ltd.uk
------------------------------
Date: Fri, 12 Dec 1997 12:46:30 GMT
From: jamesgry@netcom.com (James Gryga)
Subject: Foreach, array, s/// problem
Message-Id: <jamesgryEL2u5J.EFE@netcom.com>
Hi, Thank you for taking the time to read and hopefully reply to this post.
I have a script that checks for a key word at the begining of the line
and if it finds that word, it deletes the line and writes the corrected
version of the file. That part was simple. for example:
#!/usr/bin/perl -pi
s/^Word1: (.*)\n//g;
s/^Word2: (.*)\n//g;
.
.
.
and so on.
this works very well. However, since most of the lines are identical
except for the key work, I thought of using an array and the foreach
statement.
#!/usr/bin/perl -pi
@Array = ("Word1: ", "Word2: ", "Word3: ", ...and so on);
foreach $element (@Array) {
s/^$element (.*)\n//g;
}
This does not work. I am probably overlooking something very simple.
Any help would be appreciated.
jim
------------------------------
Date: 12 Dec 1997 05:14:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help a newbie out
Message-Id: <66qh79$2c4$4@comdyn.comdyn.com.au>
In article <34908399.8C34649@ix.netcom.com>,
Eric <ewalti@ix.netcom.com> writes:
> Hi. I'm good at HTML and i know java too. Now i figure its time to move
> onto CGI. Right? Anyways, i dont have the slightest idea about CGI. Can
> someone help me out? help me get started? Any good tutorials out there?
> Somone please help!!! thanx
Start at http://www.cgi-resources.com/
Ask in discussion groups about CGI (one of the comp.infosystems.www.*
ones will do), and not in one that is dedicated to perl.
perl != CGI
If you also want to learn about perl, try http://www.perl.com/
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Fri, 12 Dec 1997 01:57:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help a newbie out
Message-Id: <comdog-ya02408000R1212970157380001@news.panix.com>
In article <34908399.8C34649@ix.netcom.com>, Eric <ewalti@ix.netcom.com> wrote:
>Hi. I'm good at HTML and i know java too. Now i figure its time to move
>onto CGI. Right? Anyways, i dont have the slightest idea about CGI. Can
>someone help me out? help me get started? Any good tutorials out there?
>Somone please help!!! thanx
perhaps you could start with the CGI Meta FAQ.
or yahoo.
or some other search engine.
or a CGI newsgroup.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 11 Dec 1997 20:55:36 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: jennifer <tuia@msn.com>
Subject: Re: just starting with perl
Message-Id: <Pine.GSO.3.96.971211204906.10598B-100000@user2.teleport.com>
On Thu, 11 Dec 1997, jennifer wrote:
> Subject: just starting with perl
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> #!usr/bin/perl -w
> print ("Hi Jen!\n");
Usually, you'll want a slash between the ! and 'usr', but (since you're
running Perl from DOS) that's not important in this case.
> I saved this as jen.pl.
> Back at the dos prompt..
> c:\perl5\perl jen.pl
> "can't open perl script jen.pl no such filde or directory exists."
I'm sure that that's not exactly what it says. :-) But it seems to be
telling you that there's not a file called jen.pl in the current
directory. Could it be correct? Maybe you aren't in the directory you
think, or jen.pl isn't in the same directory.
> So I type...
> c:\perl5\perl
> Now I'm on a blank line, no prompt of any kind
That's right. Perl's waiting for you to type your script.
> so I type..
> jen.pl
> Now I'm on another blank line no repsonse from perl
> I type..
> c:jen.pl
> Another blank line, still no response.
Still waiting. :-) You could either type something that will give Perl a
fatal error while compiling, or you could type your system's end-of-file
character. To save you the trouble of trying to find it in your system's
docs, I'll tell you that it's probably control-Z.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 12 Dec 1997 06:31:10 GMT
From: phar@pacbell.net (Frank Reichstein)
Subject: Re: just starting with perl
Message-Id: <66qlne$ke1$1@nnrp4.snfc21.pbi.net>
In article <01bd0675$8b7e6a60$d6812299@xbwerrsn>, tuia@msn.com says...
>
>Everyone was so helpful on my last question, I'm going to ask another
>num-num question.
>I have perl5 installed on win95. Located in my C: directory (hard drive)
>that being that...
>I type at the dos promt:
> c:\perl5\perl -e "print 8 * 8;"
> I get the answer -
> 64.... so far so good. Now I've typed a program in notepad
> #!usr/bin/perl -w
> print ("Hi Jen!\n");
>I saved this as jen.pl.
Notepad will append .txt when you save a file unless you use "jen.pl" so this
file is probably hanging around in a directory with the name jen.pl.txt.
Just a Thought...
pHar
------------------------------
Date: Thu, 11 Dec 1997 17:03:52 -0600
From: smith@twsuvm.uc.twsu.edu (Kitty Smith)
Subject: mkdir command
Message-Id: <19971211.170352.953299.NETNEWS@TWSUVM.UC.TWSU.EDU>
I am having trouble with the mkdir command. I can't figure out what
the permissions should be for the command to achieve a directory with
770. I have a umask of 022 set. I get permissions of 775 when I use
the following command:
mkdir("newdir", 777);
I get the same when I change 777 to 757 in the mkdir command.
I am rather confused as to how the command infaces with the umask.
Could someone clear up my understanding of the whole thing?
Thanks,
Kitty Smith
Wichita State University
------------------------------
Date: 12 Dec 1997 00:59:53 -0800
From: Russ Allbery <rra@stanford.edu>
To: smith@twsuvm.uc.twsu.edu (Kitty Smith)
Subject: Re: mkdir command
Message-Id: <m3hg8f7x86.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Kitty Smith <smith@twsuvm.uc.twsu.edu> writes:
> I am having trouble with the mkdir command. I can't figure out what the
> permissions should be for the command to achieve a directory with 770.
> I have a umask of 022 set. I get permissions of 775 when I use the
> following command:
> mkdir("newdir", 777);
If you do the following:
umask(022);
mkdir("newdir", 0777);
verbatim exactly as written (no additional quotes and including the
leading zeroes), does it do what you expect? Modes for umask and mkdir
have to be in octal and Perl recognizes octal numbers by looking for bare
(unquoted) numbers beginning with 0.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Thu, 11 Dec 1997 21:39:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ritchard Shadian <rshadian@hawaii.edu>
Subject: Re: mkdir not recoginizing mode
Message-Id: <Pine.GSO.3.96.971211213835.10598G-100000@user2.teleport.com>
On Thu, 11 Dec 1997, Ritchard Shadian wrote:
> Does the umask have something to do with it, and if so, can I
> temporarily change the umask during the execution of my program?
Yes, and yes. :-) See perlfunc(1)'s description of the aptly named umask
function. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 11 Dec 1997 20:59:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jay Quinn <jpquinn@cyberramp.net>
Subject: Re: Most Common Web dev tools?
Message-Id: <Pine.GSO.3.96.971211205757.10598C-100000@user2.teleport.com>
On Thu, 11 Dec 1997, Jay Quinn wrote:
> What are the most common web development tools being used today?
Computers. And spiders, of course.
Of course, this is a newsgroup about Perl, not about the web. Maybe you
want to ask your questions in a newsgroup where they would be on topic.
That's likely to get you better and more-complete answers - at least, if
your questions aren't too vague. :-) Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 12 Dec 1997 01:49:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: need to know what browser the client is using
Message-Id: <comdog-ya02408000R1212970149550001@news.panix.com>
In article <66nfvn$56b@ecuador.earthlink.net>, "David Harris" <dharris@drh.net> wrote:
>Ah, the browser companies really did mess up the HTTP_USER_AGENT environment
>variable by calling everything Mozilla. Your secret decoder ring is at:
>
>http://www.gsb.georgetown.edu/dept/gsbtc/waehner/browser/
now someone needs to volunteer to make a Perl interface to that...
of course, it's missing "Mozilla 5.0, Sony PlayStation".
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 12 Dec 1997 13:03:43 GMT
From: hisao@physics.purdue.edu (Hisao Nakanishi)
Subject: OraPerl <-> OraTcl
Message-Id: <66rcnf$f8p@mozo.cc.purdue.edu>
Is there an easy way to convert an OraTcl script to an equivalent
OraPerl script? Is OraPerl available on SunOS4?
H. Nakanishi
hisao@physics.purdue.edu
------------------------------
Date: Fri, 12 Dec 1997 02:03:20 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Modules Info
Message-Id: <comdog-ya02408000R1212970203200001@news.panix.com>
In article <3490dc62.0@news5.kcdata.com>, "Nic" <nic@cyber-west.com> wrote:
>I am somewhat familiar with perl programming and have been tinkering with it
>for a while. I was just wondering if there is a book out there that covers
>many of the commonly used and/or advanced perl modules.
you might be interested in the Perl Resource Kit available from O'Reilly.
<URL:http://perl.oreilly.com/prk_index.html>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
not beating a dead horse - that comes later.
------------------------------
Date: Sat, 13 Dec 1997 00:37:42 +1100
From: Anthony David <adavid@netinfo.com.au>
Subject: Re: Perl Plug-In for Netscape?
Message-Id: <34913E26.EB5F8E90@netinfo.com.au>
A Netscape Plugin recently announced is the Velocity Engine for Perl.
There is also a Velocity Engine for TCL by Binary Evolution Inc - http://www.binevolve.com/.
I have only played with the demo's at their site. The performance graphs look
impressive, but then that's how benchmarks always work out :-)
--
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: 12 Dec 1997 04:55:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: please help : web personals
Message-Id: <66qg40$23p$7@comdyn.comdyn.com.au>
In article <348f6039.12067899@news.labyrinth.net.au>,
jomele@usa.net (ton) writes:
> Hello and how are you doing?
> I would like to start an online dating service. Does anyone outhere
> have any useful scripts. I am willing to barter advertising for these
> scripts.
Has nothing to do with perl. If you want CGI scripts, try
www.cgi-resources.com, or ask on one of the comp.infosystems.www.*
groups.
> Please contact me at jomcoy@hotmail.com if you can help
Nope. if you can't even set up your mail headers correctly, I am not
going to bother replying by email.
> Thanks
Uhuh
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
Date: 12 Dec 1997 13:44:47 GMT
From: janghada@hitel.net (janghada)
Subject: Question about telnet.pl
Message-Id: <66rf4f$7ca$2@news2.hitel.net>
I found this sample program(telnet.pl) to connect telnet server or any
tcp server. But when I try to connect to telnet server, it seems like hang.
No answer, but connect is ok. when I try to connect ftp server, there is
a message from ftp server. Port 80 (http) is also Ok. Only telnet port remains silent. Any problem in thiis source? Or any other consideration needed for
Telnnet Server? I really appreciate for your comments.
--------------------------------------------------------------------------
#tcp-client
( $them, $port ) = @ARGV;
$port = 23 unless $port;
$them = 'localhost' unless $them;
$AF_INET = 2;
$SOCK_STREAM = 1;
$SIG{'INT'} = 'dokill';
sub dokill {
kill 9,$child if $child;
}
$sockaddr = 'S n a4 x8';
#chop($hostname = `hostname`);
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
unless $port =~ /^\d+$/;;
($name,$aliases,$type,$len,$thisaddr) =
gethostbyname($hostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
print "socket ok\n";
}
else {
die $!;
}
if (bind(S, $this)) {
print "bind ok\n";
}
else {
die $!;
}
if (connect(S,$that)) {
print "connect ok\n";
}
else {
die $!;
}
select(S); $| = 1; select(STDOUT);
$a=<S>;print "$a";
while( $b=<STDIN> ) {
print S "$b\n";
$a=<S>;print "$a";
}
exit 1 ;
--------------------------------------------------------------------------
Thanks in advance.
------------------------------
Date: 12 Dec 1997 04:57:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: recursive regex?
Message-Id: <66qg8e$23p$8@comdyn.comdyn.com.au>
In article <66nhku$1oq8@itssrv1.ucsf.edu>,
coleman@library.ucsf.edu (Gregory Coleman) writes:
[REFORMAT INCREDIBLY LONG LINE]
> Basically, I just want to go through a file system, and look at each
> level of directories and scan for something. For example, say I
> have user's home directories, and I am getting ready to change the
> path to perl. I want to know who all has "#!/usr/local/bin/perl" so
> that I might later change it.
You could use the unix find(1) command, together with sed or perl -pi,
or you can use the File::Find module that comes with perl.
HTH
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: 12 Dec 1997 10:43:13 GMT
From: cjb@trog.dra.hmg.gb (Cliff Bradshaw)
Subject: Socket woes....
Message-Id: <66r4g1$t44$1@trog.dra.hmg.gb>
For quite a while now we've been using a Perl web server program
to run a small intranet on a network of SunOS 4 machines. Everything
was just fine.
Now we've upgraded all the machines to Solaris 2, and I've recompiled
Perl 5 but for some reason the web server program refuses to play ball.
The problem appears to be in the socket routines. The code fragment in
question is:
# set up a server socket
$IPPROTO_TCP=6;
$sockaddr = 'S n a4 x8';
$this = pack($sockaddr, $AF_INET, $port, "\0\0\0\0");
socket(S, $PF_INET, $SOCK_STREAM, $IPPROTO_TCP) || die "socket: $!";
bind(S, $this) || die "bind: $!";
listen(S, 5) || die "listen: $!";
And the error I get is:
socket: Protocol not supported at /user/cliff/httpd/tinyhttpd.pl line 85.
By fiddling around with the socket() instruction (based on wild guesses
and looking in socket.ph) I can shift the error to the bind() instruction,
but I *cannot* get the damn thing to work.
Any advice or suggestions would be gratefully received!
--
Cliff
cjbradshaw@dera.gov.uk
"I never get into a battle of wits with someone unable to defend themselves"
------------------------------
Date: Fri, 12 Dec 1997 01:47:47 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: To use a ref or not?
Message-Id: <comdog-ya02408000R1212970147470001@news.panix.com>
In article <h67wwhbseny.fsf@baynetworks.com>, plussier@baynetworks.com (Paul L. Lussier) wrote:
>I was wondering what difference if any the following code snippet has with
>regards to using a ref to a scalar or not.
the Benchmark module will help you find the answer.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 12 Dec 1997 02:28:34 -0800
From: Dean Burnham <deanb@cons.prg.home.net>
Subject: uninitialized value messages when using -w directive and namespace
Message-Id: <yxmafe6j1nx.fsf@cons.prg.home.net>
I am getting this error when I run the code below.
Use of uninitialized value at /home/deanb/ns-home/cgi/test line 28 (#1) (W) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign an initial value to your variables.
Parameter for foo>><<
---- Code ----
#!/usr/local/bin/perl -w
use CGI qw(:all);
use strict qw(subs vars refs);
use diagnostics;
sub Draw_screen {
print header;
print start_html(-'title'=>'mumble',
-'BGCOLOR'=>'red');
print start_multipart_form();
print textarea(-name=>'foo',
-rows=>3,
-columns=>25),br;
print submit(-name=>'submit',
-value=>'submit');
print endform, end_html;
}
my $query = new CGI;
if(!$query->param) {
&Draw_screen;
}
else {
import_names('Q');
print header, start_html, "Test program ";
print "Parameter for foo>>", $Q::foo, "<<"; # Line 26
no strict 'refs';
print "Parameter for foo>>", ${'$Q::foo'}, "<<"; # Line 28
print end_html;
}
__END__
I would like to continue using the -w directive, but it will not
allow importing the "Q" namespace and referencing the variables in
this new namespace. Are there any compiler tricks which can be
done to avoid getting the:
"Use of uninitialized value at line 26, <> chunk 1".
or
"Use of uninitialized value at line 28, <> chunk 1".
I thought {'foo'} sufficiently handled premature dereferencing and
symbol table lookup problems such as this by delaying the evaluation
of the variable.
Bottom line -- importing the namespace "Q" gives me a bunch of
problems.
** Do you recommend I trap for this warning with the $SIG{__WARN__}?
if so, how?
Please E-mail responses to me in addition to replying to this post.
Thanks in advance,
Dean Burnham
deanb@corp.home.net
------------------------------
Date: Thu, 11 Dec 1997 21:14:10 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: untainting data
Message-Id: <Pine.GSO.3.96.971211210549.10598E-100000@user2.teleport.com>
On Thu, 11 Dec 1997, Mark Worsdall wrote:
> Hi, I am trying to untaint an IP variable passed to me. Now in all
> SINGLE IP numbers the untainting works fine, however on occasion I am
> passed data such as this:-
> 194.154.10.177, 194.238.50.8
>
> 2 IP numbers with a space,
And a comma, it seems.
> so I drop the space and then try to untaint the data (DOH!) no good, cos
> yes I should really untaint the data before doing anything with it
Do you know that it will be exactly two such numbers, or possibly more?
Will there always be a comma and a space, or something else?
> $surfer = $ENV{'HTTP_X_FORWARDED_FOR'} || 'Nothing';
> $surfer =~ s/ //g; # drop spaces
> if ($surfer =~ /^([-\@\w.]+)$/) {
> $surfer = $1; # $surfer now untainted
> } else {
> die "Tainted data in $surfer: $!";
> }
I'd suggest that you split the string into a list of single numbers, then
make untainted copies of each of those individually. Maybe like this.
my $surfer = $ENV{'HTTP_X_FORWARDED_FOR'};
if (defined $surfer) {
my @list = split /,\s*/, $surfer;
for (@list) {
if (/^([-@\w.]+)$/) { # Right pattern?
$_ = $1;
} else {
warn "Can't extract from '$_', skipping";
$_ = undef;
}
}
$surfer = # what you get when you
join ', ' , # join with commas
grep defined, # the defined elemens of
@list; # that list
} else {
$surfer = 'nothing';
}
Of course, this may not be what you really need. It does potentially leave
spaces in $surfer. But I hope it's a start. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 12 Dec 1997 23:56:16 +1100
From: Anthony David <adavid@netinfo.com.au>
Subject: Re: Using a fork (help needed)
Message-Id: <34913470.741334FC@netinfo.com.au>
David Waring wrote:
> I have script that sends mail to people on a mailing list as shown below
>
> open(MAIL,"|$mailprog -t");
> print MAIL "To: $address\n";
> print MAIL "From: NW Ski Report\n";
> print MAIL "Subject: Powder Alert\n\n";
> print MAIL "Dear $name,\n\n";
> print MAIL "$FORM{'headline'}\n\n";
> .......
> close (MAIL);
>
> It works but there is a problem the mailing list is now over 500
> addresses and when I call this script from a web page using a form the
> process takes several minutes and eventually I get an internal server
> error instead of the proper responce that things worked. All the mail is
> actually sent.
>
> I would like to fix this so that I don't hang my browser for 5 minutes and
> get a proper return.
I assume this CGI is running on a Unix box. One way to do it would beto write
the message out to a file and have a cron job scheduled at regular intervals
that would read the file and do the mailing part.
I don't think a forked process would buy you anything as the CGI would still
have to
wait on completion.
By decoupling the process, you don't have any feedback regarding the success
or
failure of the mailing. I suggest incorporating a "Mail Status/Queue" function
into your
CGI to track the health of the mailings.
Regards
--
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: 12 Dec 1997 04:50:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: WANTED: "generic" logfile parse/report
Message-Id: <66qfrg$23p$6@comdyn.comdyn.com.au>
In article <348F149C.3CF@zeegee.com>,
Eryq <eryq@zeegee.com> writes:
>> dlt_00 somehost.somedomain.com 12/06/97 802 MB full /
>> dlt_00 somehost.somedomain.com 12/06/97 236 MB full /usr/people
>> dlt_00 somehost.somedomain.com 12/06/97 163 MB full /usr/share
>> dlt_00 legato-serv.somedomain.com 12/06/97 47 MB full /released/nsr/index/somehost.somedomain.com
> That "last string" is a slightly difficult problem, since you can have
> weird directory names which include spaces; e.g., "/usr/local/whoa there/kid".
Since it is the last field, however, you can use split with three arguments
split (/\s+/, $line, 7);
This will split $line in 7 fields, delimited by whitespace. Possible
whitespace in the seventh field will not be used to split on.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
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 1460
**************************************