[7948] in Perl-Users-Digest
Perl-Users Digest, Issue: 1573 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 3 02:07:35 1998
Date: Fri, 2 Jan 98 23:00:21 -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, 2 Jan 1998 Volume: 8 Number: 1573
Today's topics:
Re: "Excessive Paranoia" using crypt (Wilson Fang)
Re: bulk mail <efinch@vais.net>
Re: bulk mail <efinch@vais.net>
Re: bulk mail (Danny Aldham)
Re: bulk mail (Abigail)
Re: forking in perl plambert$1@plambert.org
Re: HELP! Newbie needs advice on h2ph and SysV IPC <tem@energid.demon.co.uk>
Re: http error (Tad McClellan)
i need help (Ted Fiedler)
Re: i need help <joseph@5sigma.com>
I need money [Re: I need a script] <joseph@5sigma.com>
Re: IIS4 Please Help! <BobMartin@inu.net>
Re: Lookup Table (Mike Stok)
Re: newbie lost with MacPerl!! <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: perl is c worsened (was: Re: word wrap routine) <daftary@_remove_to_send_email_.cisco.com>
Re: Perl not Y2K compliant (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Perl Trick? <eddie@NOSPAMMING.cs.odu.edu>
Re: recomended Perl books ? (jay)
Re: recomended Perl books ? <wtansill@erols.com>
Re: Search and replace questions <joseph@5sigma.com>
Re: SHELL/REGEX GUNSLINGERS NEEDED!!! <zuodong@earthlink.net>
Socket ? <eddied@wwisp.com>
Stored Function Call from perl DBI <evanw@netops.com>
Whoops! (Re: UserAgent and POST questions) (SasEz! Publications and Design)
Re: word wrap routine <daftary@_remove_to_send_email_.cisco.com>
Re: Writing a "nice" server? plambert$1@plambert.org
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Jan 1998 02:13:53 GMT
From: wilson@tp.silkera.net (Wilson Fang)
Subject: Re: "Excessive Paranoia" using crypt
Message-Id: <68k6t1$7te$1@news9.tp.silkera.net>
Frank (FHeasley@chemistry.com) 4#(l:
: I'm trying to implement crypt, but I'm getting this wierd message that
: says "Function not implemented due to excessive paranoia".
: What does this mean? Is my program "too paranoid", or is perl
: refusing to act because perl is too paranoid?
: All I want to do is write encrypted passwords to a file. There's
: nothing in the faq that I can find, and I've been all through the man
: page and the modules, and dejanews and the various search engines.
: Any clarification would be appreciated.
: Frank
hi, I met the same situation, try perl for win32 in
http://www.activestate.com/software/default.htm
this version of perl supports crypt function.
Wilson
------------------------------
Date: Fri, 02 Jan 1998 22:19:33 -0500
From: Ed Finch <efinch@vais.net>
Subject: Re: bulk mail
Message-Id: <34ADAE45.AC19D1C7@vais.net>
> ike wrote:
> >
> > If i am writing a program to send bulk email, is using sleep 1
> enough
> > time to make it so that i don't overload the sendmail program?
FWIW: Our mail server at work is a Sun Ultra-II with 2 200mhz processors
and 512mb of RAM. I wrote a perl script that will send a message to
everyone in the /etc/passwd file - about 1300 accounts. When the script
is run, the load average never goes above .5 on the mail server.
Ed
------------------------------
Date: Fri, 02 Jan 1998 22:23:59 -0500
From: Ed Finch <efinch@vais.net>
Subject: Re: bulk mail
Message-Id: <34ADAF4E.F5F09D45@vais.net>
Ed Finch wrote:
> > ike wrote:
> > >
> > > If i am writing a program to send bulk email, is using sleep 1
> > enough
> > > time to make it so that i don't overload the sendmail program?
>
> FWIW: Our mail server at work is a Sun Ultra-II with 2 200mhz
> processors
> and 512mb of RAM. I wrote a perl script that will send a message to
> everyone in the /etc/passwd file - about 1300 accounts. When the
> script
> is run, the load average never goes above .5 on the mail server.
>
> Ed
That "send" button is just too sensitive ;-) The whole point of my
message is that I do not have any built-in sleep()s, etc - I just let
'er rip.
Ed
------------------------------
Date: 2 Jan 1998 21:20:31 -0800
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: bulk mail
Message-Id: <68khqv$5a7$1@lennon.postino.com>
X-Newsreader: TIN [version 1.2 PL2]
Mike (mhanson@arrowweb.com) wrote:
: If i am writing a program to send bulk email, is using sleep 1 enough
: time to make it so that i don't overload the sendmail program?
You wont overload sendmail, you will more likely overload your
data link first.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
Ban the neutral zone trap. It's killing our National sport.
------------------------------
Date: 3 Jan 1998 06:27:58 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: bulk mail
Message-Id: <68klpe$qvq$1@client3.news.psi.net>
Danny Aldham (danny@lennon.postino.com) wrote on 1586 September 1993 in
<URL: news:68khqv$5a7$1@lennon.postino.com>:
++ X-Newsreader: TIN [version 1.2 PL2]
++
++ Mike (mhanson@arrowweb.com) wrote:
++ : If i am writing a program to send bulk email, is using sleep 1 enough
++ : time to make it so that i don't overload the sendmail program?
++
++ You wont overload sendmail, you will more likely overload your
++ data link first.
Well, after a while, when all the nasty returns come in, the
sendmail might get busy....
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 3 Jan 1998 01:38:53 GMT
From: plambert$1@plambert.org
Subject: Re: forking in perl
Message-Id: <68k4rd$qhr$4@nntp1.ba.best.com>
mjforder@hotmail.com spewed:
> Can anybody tell me where I can find a nice gentle introduction to
> writing perl script which use fork, wait etc. I've read some sections in
> the programming perl book, and the perl reference, but I'm little foggy
> on some of the concepts.
> What I am trying to achieve is a perl script that will read a certain
> directory every n minutes, detect any files in the dir., and then fork a
> process for each file that will fax the file (via system calls to 3rd
> party software). I'm assuming (perhaps foolishly) that it would be
> quicker and general more efficent to do it this way, especially if there
> are a lot a faxes as each fax can take up to 3-4 minutes to send
> (depending on size).
Short answer:
When you want to do something "in the background", you do this:
if (!fork()) {
# whatever you're doing "in the background".
exit;
}
If this is all you know, you'll get a few things to work, and then shoot
yourself in the foot. ;-)
Important tips: after a fork, variables aren't the same. In other words,
if you change $foo inside the "background" part above, then it DOES NOT
change in the code that follows--they're now separate programs.
Another important thing to consider, in your case, is if this is really
what you want to do. If you fork off a process for each file, and it
attempts to fax, and there are six files in the directory, then you will
attempt to fax all six files simultaneously.
You could have each child (each forked-off process) look for a lock file,
and all sorts of fancy things like that, but if you can only actually
fax one file at a time, then you're better off just doing them sequentially
without forking.
In other words, be sure that what you want to do is equivalent to this:
% ls
file1 file2 file3
% fax file1 &
% fax file2 &
% fax file3 &
--Paul L.
------------------------------
Date: Sat, 3 Jan 1998 01:59:55 +0000
From: "Timothy E. Morgan" <tem@energid.demon.co.uk>
Subject: Re: HELP! Newbie needs advice on h2ph and SysV IPC
Message-Id: <xRFBsIAbuZr0Ewn8@energid.demon.co.uk>
On Thu, 1 Jan 1998, Tom Phoenix <rootbeer@teleport.com> wrote:
>Well, IPC_PRIVATE _is_ a subroutine, one which returns a numeric value.
>But maybe h2ph didn't get the correct value. Does your ipc.ph give
>something different than ipc.h does? Also, does the IPC::SysV module from
>CPAN do anything good for you? Hope this helps!
Thanks for the help, Tom.
--
Timothy E. Morgan
------------------------------
Date: Fri, 2 Jan 1998 19:01:33 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: http error
Message-Id: <dl2k86.fs3.ln@localhost>
m9@sprynet.com (m9@sprynet.com) wrote:
: Get the following error when trying to run script:
: http/1.0 501 not supported
: Running NT4 and IIS3.0
But this is the Perl newsgroup.
HTTP is not Perl.
You should ask your question in a newsgroup that has some connection
to the subject of your question ;-)
Such as:
comp.infosystems.www.servers.ms-windows
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Jan 1998 03:35:07 GMT
From: budo@news.ncx.com (Ted Fiedler)
Subject: i need help
Message-Id: <236F34EC328E6E13.6143CA9396DF8AE4.9DB1D98A5DC0FDDD@library-proxy.airnews.net>
#!/usr/bin/perl -w
use strict;
my (
$comments,
$curse
);
if (-s "in" && -l "out") {
unlink("out", "in");
}
open (IN, ">in") || die "cant open in: $!";
$comments = <STDIN>;
print IN $comments;
symlink("in", "out") || die "cannot create symbolic link: $!";
while (<IN>) {
$curse = <IN>;
if ($curse =~ /damn/) {
print "you need to watch your language\n";
}
else {
exit 0;
}
close (IN);
}
why wont this match damn in a string???
------------------------------
Date: Fri, 02 Jan 1998 23:45:40 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: i need help
Message-Id: <34ADDE42.788A90F2@5sigma.com>
It will, but are you aware IN is open for writing, not reading?
-joseph
http://www.effectiveperl.com
------------------------------
Date: Fri, 02 Jan 1998 23:43:25 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: I need money [Re: I need a script]
Message-Id: <34ADDDBB.DF4D1B57@5sigma.com>
I have a bank account that I want to have users add money. It would
be great if someone could send money to it, using the $20 and $50
format please
Help me,
and also email with the amount you are sending thank you
-joseph
:-)
Kriebel wrote:
>
> I have a site that I want to have users add a links. I if someone could
> write a CGI script that would print to a file using this format:
> <br>
> <br>
------------------------------
Date: Sat, 3 Jan 1998 00:46:55 -0600
From: "Bob Martin" <BobMartin@inu.net>
Subject: Re: IIS4 Please Help!
Message-Id: <34addebd.0@NEWS.INU.NET>
I just got IIS4.0 to run my scripts. First, I recommend that you map .pl to
PerlIs.dll. That way you don't run multiple instances of Perl.exe, and you
don't leave yourself open to hackers.
You can work around redirection by dumping output to file, then dumping the
file into another program..
open(MAIL,">$tempdir\\tempfile") || die("Cannot open $tempdir\\tempfile --
Check Directory Permissions : $!");
open(MAIL,"|$mailprog -t -Hdowntown.inu.net<$tempdir\\tempfile");
close(MAIL);
Steve West wrote in message <34AD3EA3.615C54A8@metafuse.com>...
>Scott,
>
>I had that problem too, and was able to fix it. It has nothing to do with
Perl
>it is Microsoft IIS server problem.
>
>Microsoft changed from having the script mappings in the registry to the a
>configuration in the service manager. Now script mappings are changed in
the
>default website properties.
>
>Go to the default website, right mouse click on the properties for that
site....
>
>then click on "Home Directory" tab
>Go to the "Applications Settings" toward the bottom of the window...find
>the "Configuration" button...the click on it. A new window called script
>mappings exists..you need to either create a new script mappings or edit
the old
>one.
>
>It should look like this
>
>.cgi c:\perl\bin\perl.exe %s %s
>.pl c:\perl\bin\perl.exe %s %s
>
>I had those set before in the registry...as you may have too...and MS IIS
4.0
>pulled the values out and capitalized the %S %S...that wont work..it looked
like
>this
>
>*** MICROSOFT PUT THIS THERE...IT WILL NOT WORK ***
>.pl C:\PERL\BIN\PERL.EXE %S %S
>
>*** YOU MUST CHANGE MAPPING TO LOOK LIKE THIS***
>.cgi c:\perl\bin\perl.exe %s %s
>.pl c:\perl\bin\perl.exe %s %s
>
>
>***** OTHER PERL PROBLEMS WITH IIS 4.0 *****
>There is still another problem that I am aware of with running perl and IIS
4.0.
>
>You cannot use standard I/O redirection with perl and IIS 4.0... (at least
by
>default
>it is not configured properly and I still havent been able to get it to
work)
>
>What this means is if you want to send information to the console and
redirect
>it to another application like sendmail, or blat you cannot do this
>open(BLAT, " | blat - -t email@email.com -s subject") || die "cannot send
to
>blat";
>
>This will not work because the IIS 4.0 server will not open a new
console...
>I am working on this as we speak and will post a message here if I get it
>resolved. I also have a call into Microsoft on this one...so I hope we
are in
>good hands but probably not
>
>Perl WILL run on IIS 3.0 becuase it does create a new console.
>So for those of you with Perl running just fine on 3.0 beware do not
upgrade
>just yet.
>
>Steve West
>
>scott clark wrote:
>
>> Mark Polakow wrote:
>> >
>> > Hello all. I am in serious need of getting Perl up and running on IIS4
>> > and having a heck of a problem setting up Perl scripts though I had no
>> > problem running them under Netscape server on NT. I have done all the
>> > basics: Run the Perl 5.003 Install.bat which makes registry changes
>> > and associates .pl with the Perl interpreter. I have heard that IIS
>> > requires you to use 2 slashes instead of 1 for pathing....
>> > If you could offer any help I would appreciate it!
>>
>> Try the following URL, it worked great for me on IIS3.0...
>> http://support.microsoft.com/support/kb/articles/Q150/6/29.asp
>>
>> This of course assumes that you have Perl running from the command
>> line...
>> If not, check and *make sure* your path points to ...\Perl5\bin\ (or
>> wherever you installed the Perl.exe
>>
>> The contents of this message express only the sender's opinion.
>> This message does not necessarily reflect the policy or views of
>> my employer, Merck & Co., Inc. All responsibility for the
statements
>> made in this Usenet posting resides solely and completely with the
>> sender.
>
>
>
------------------------------
Date: 2 Jan 1998 19:49:41 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Lookup Table
Message-Id: <68k1v5$45m$1@stok.co.uk>
In article <34AD7F33.AC273E0B@cybernex.net>,
The Hudsons <hudson@cybernex.net> wrote:
>Does perl have a function similar to other languages for a lookup
>table? I would imagine that I could use a multi dimensional array to
>accomplish the table function, but I'm not quite sure how to go about
>implementing it. Could anyone offer me any insight / help. Thanks in
>advance,
If you're using a recent perl then it has the ability to build data
structures like multidimensional arrays with some shorthand to let you say
$table[1][2][3] = 4;
or
$table{'foo'}{'bar'} = 'baz';
The perl distribution includes the following man pages which may be useful
in understanding this notation:
perlref Perl references
perldsc Perl data structures intro
perllol Perl data structures: lists of lists
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Fri, 2 Jan 1998 21:52:04 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: newbie lost with MacPerl!!
Message-Id: <68kjkr$nru@mtinsc05.worldnet.att.net>
Robert Garrigos wrote in message
<34AD778D.261EE981@cataloniabsnreed.demon.co.uk>...
>Hi everybody,
>
>I'm just starting to learn Perl on a Mac, with MacPerl5, and have a few
>problems.
This is hardly surprising. :D
>
>I have a book by Jerry Muelver (Creating cool web pages with Perl) which
assumes
>that you are on a PC. :-|
>
>The first instruction
>
>perl -e "print 'Hello, World!' \n;"
>
>doesn't seem to work. It doesn't do anything. I tried to type it in a
script
>window and in the one liner window. The Macperl's on line help docs. are
not
>much helpful for a beginner. Moreover, I think the book it's talking about
>Perl4.
>
>My questions are:
>
>Can I still use this book to learn Perl if I use MacPerl5? What is it that
I
>should take account of, regarding the two different versions of Perl and of
the
>platforms?
>
>Of course, it would be much better to use a book to learn Perl based on
>MacPerl5. Is there anything like that?
>
>Thank you very muchfor your help.
>
>--
>Robert Garrigos
>
I use MacPerl at work but don't have a Mac here at home so I don't have
access to it at the moment, but I'll try to help.
The reason you can't use the -e construct is because it deals with a command
line and Perl doesn't have a command line. However, that doesn't mean you
can't run the script by leaving off all the stuff that isn't a Perl script.
So, open up a new script (with File / New, I think) and type this into the
window that opens up:
print "Hello, world!\n";
Then select the option that lets you run the current buffer (I forget what
it's called) and another window will open up with "Hello, World." in it.
That's the result of your script and corresponds to what happens when you
send output to the console in Unix or DOS/95/NT.
Once you get the hang of it (there's plenty of documentation that comes with
MacPerl) you can run pretty much run any script in MacPerl that you can in
other forms of Perl. There are only a couple of things you need to keep in
mind.
* The file separator on a Mac is ":" instead of "\" or "/", so when you're
specifying the full path to a file you have to remember that it's "Macintosh
HD:MacPerl:My Script.pl" instead of "C:\perl5\myscript.pl" or
"/usr/me/perlstuff/myscript.pl".
* There are some Macish things you can do easily in MacPerl that are a
little harder in DOS or Unix, like built-in support for Macintosh dialog
boxes and AppleScript scripts (again, see the documentation).
* There are some Unix specific commands you can't use on Mac, but that's OK
because by and large you won't want to.
I don't do much CGI so I can't help you with the creating cool web pages
part. I hear there's a book on MacPerl coming out sometime this spring from
O'Reilly, but I can't remember the name. Check their web page (www.ora.com,
I believe) for information.
Hope this helps!
-- Creede
------------------------------
Date: Fri, 02 Jan 1998 17:44:30 -0800
From: Kuntal Daftary <daftary@_remove_to_send_email_.cisco.com>
Subject: Re: perl is c worsened (was: Re: word wrap routine)
Message-Id: <34AD97FE.774DAD78@_remove_to_send_email_.cisco.com>
Eli the Bearded wrote:
> That little bit of code produces an entire ascii art movie -- the
> intended effect being planar cross-sections of a shaded sphere,
> the actual effect looking more like a bomb, notwithstanding.
i would like to have a look at this code, if someone has it
--
#!/usr/local/bin/perl5
$d=12;for($b=$c=10;$a=substr "ASDDFGSFDHGAads \
??DBSDBSEBDCDDzFBDCECBADDDCBDDCBDGDIFBECEDDAACBABDADAABDADAACAACBAFFBFBFBDACD
\
DBCDDBCDCACDGFBFBFBCBDBEBDBEBDBCBDBHFBFBFBCBDBEBDBEBDBCBDBHFBFBFBCBDBEBDBEBDB
\
CBDBHFBFBFADBDBEBDBEBDBCBDBHGGAGEBDBEBDBEBDBCBDBHHECEGEABDCCCDCCCCEABG]CCBDCC
\
CDCCCCCCBF??IAwCLGByCKGBzBKGBzBKGBYDNCBDFBKGBADGCIAACBADCEDADAACBKGCACBACAACG
\
ACDDAACEBCDDBKGBCDCACCEBDBDACCDBKBKGBDBCBDCDBDBCBDCCBKBKGBDBCHEBDBCHDBKBKGBDB
\
CGFBDBCGEBKBKGBDBCBKBDBCBJBKBKGBDBCDDADGDDDACCJBKHEFGEFFGECICAAHICHEFBKESCI_B
\
o_Bo`Bn??GA_AhEB^BiEB^BiEB^BiEB^BSCBDMEBBCFDGDDBBCGCEDADAAJEBAAACDAACBACAACBA
\
ABAAACEAACEBCDKECCCBACDCACDBCCAEACCDBREBEBABDBCBIBCAEBDCCBREBEBABDBCBIBBAFHDB
\
REBEBABDBCBIBABFGEBREBEBABDBCBIFEBJBREBEBABDBCCEABBBCDDDACCQEBEBBEABCGCBCCAAB
\
GECPFBDBCCCBCEEBCCDEYLAfKA?JA?IA???",$b+++6,1;++$d){for($a=ord
$a;$a-->64;){
printf "%c",++$c==ord Z?$d=$c=$c/9:32^$d&1;}}
------------------------------
Date: Fri, 02 Jan 98 22:08:21 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Perl not Y2K compliant
Message-Id: <34adad0e$3$ofn$mr2ice@speaker>
In <slrn6aqqvb.50c.abigail@betelgeuse.wayne.fnx.com>, on 01/02/98 at 10:34 PM,
abigail@fnx.com (Abigail) said:
+-----
| ++ True, but that's with what amounts to formatted data. The most probable
| ++ solution I see is that (long) will be a 64-bit type on most platforms by then.
| What makes you think 32bit and 64bits aren't formats?
+--->8
Would you prefer kindergarten language? "Formatted" = "formatted for display,
as by COBOL, xBase, and other monstrosities". Unless you're claiming that the
complaint that started this thread (which itself assumed such a formatted
value) was in fact valid....
A 32-bit binary value can be adjusted in several ways; and, aside from file
formats (which I recently commented on elsewhere; the gist, however, was
"don't write internal format data to files if you can help it"), switching to
64-bit values involves recompiling with a compiler that treats (long) as
64-bit. Again, assuming intelligence on the part of the programmer.
--
brandon s. allbery [Team OS/2][Linux][JAPH] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
`Greensleeves'." ---unknown, quoted by Janet D. Miles in alt.callahans
------------------------------
Date: Fri, 02 Jan 1998 21:53:59 -0500
From: Eddie Brown <eddie@NOSPAMMING.cs.odu.edu>
Subject: Re: Perl Trick?
Message-Id: <34ADA847.F96918A4@NOSPAMMING.cs.odu.edu>
A web page..
brian d foy wrote:
> In article <34AC935B.E2E575CD@NOSPAMMING.cs.odu.edu>, Eddie Brown <eddie@NOSPAMMING.cs.odu.edu> posted:
>
> >Besides having a java program execute a perl prog: does anyone know
> >of a way of having a perl program execute as soon as a page is accessed?
>
> depends on what a page is...
>
> but it likely has nothing to do with Perl. it's probably the same
> answer as getting anything to execute at the right time. there is
> probably a better newsgroup for this question. :)
>
> --
> brian d foy <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sat, 03 Jan 1998 01:40:42 GMT
From: mocat@NOSPAM.best.com (jay)
Subject: Re: recomended Perl books ?
Message-Id: <34ad9598.27494766@nntp.best.com>
On Fri, 2 Jan 1998 02:21:17 -0500, "Tiago Stock"
<tiagosdelete@gdn.net> wrote:
>Please follow this thread in recommending your favorite Perl reference book.
>
>I'm just starting and would like input from more experienced users in which
>book to buy.
>I'm sure more readers would appreciate this as well.
I'm not very experienced with PERL, I'm learning, and learning slowly
since I don't have a lot of free time to read.
I bought the Learning PERL book (O'reiley) and it helped me get a
start, but I've found that it doesn't tell you what you need to know
in a more than a few instances.
For example... it has 3-4 lines on $1, $2, etc pattern matching read
only variables, but it doesn't explain anything about them. If this
is the only book you have at the time, it's very frusterating if you
have to use those for a script you're writing. Yes, there are
manpages and such... but it's so hard to find what you're looking for
that way.
Programming PERL I've only glanced at a few times... and it seems
quite good. It goes into detail about many, many things the Learning
PERL book doesn't even mention. My only problem with it is the
incredibly sparse 1 or 2 pages on hashes. No biggie though, the
Learning PERL book goes into great detail with those.
So I recommend going out and purchasing Learning PERL and Programming
PERL at the same time. One is sparse in areas, the other has lots of
info and such.
If you plan on doing a lot of text manipulation, should take a look at
Mastering Regular Expressions (O'reiley too) and look at the perlre
manpage.
jay
being too verbose
------------------------------
Date: Fri, 02 Jan 1998 22:13:04 -0500
From: "William B. Tansill, III" <wtansill@erols.com>
Subject: Re: recomended Perl books ?
Message-Id: <34ADACBF.7248@erols.com>
Tiago Stock wrote:
>
> Please follow this thread in recommending your favorite Perl reference book.
>
> I'm just starting and would like input from more experienced users in which
> book to buy.
> I'm sure more readers would appreciate this as well.
>
> --
> Tiago S.
> http://members.aol.com/tiagos
1) Programming Perl, 2nd Edition
O'Reilly & Associates
ISBN 1-56592-149-6
(Camel Book)
2) Advanced Perl Programming
O'Reilly & Associates
ISBN 1-56592-220-4
(Panther Book)
3) Mastering Regular Expressions
O'REilly & Associates
ISBN 1-56592-257-3
(Hip Owls Book)
No, I don't own O'Reilly stock.
Yes, I wish I did.
Another book, Learning Perl (LLahma (sp?) book) is recommended by some.
I found that I needed more, but a co-worker liked it a lot.
--
How do I set my laser printer to "stun"?
------------------------------
Date: Fri, 02 Jan 1998 23:38:05 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Search and replace questions
Message-Id: <34ADDC7C.6BE2C050@5sigma.com>
If your lines are all formatted pretty much that way, then:
while (<>) {
s{>(\w+)\s+(\d+)\s+(.+?)<}{><a href="/cgi-bin/pick.cgi?$1$2">$1 $2</a> $3<};
print;
}
-joseph
http://www.effectiveperl/com
Pete Holsberg wrote:
>
> Happy New Year to everyone!
>
> I have a file that has lines like this:
>
> <FONT SIZE=+1>AC 106 Office Accounting I 3</FONT>
> <FONT SIZE=+1>EG 222 Literature II 3</FONT>
>
> etc.
>
------------------------------
Date: Fri, 2 Jan 1998 23:35:34 -0800
From: "Zuo Dong Zheng" <zuodong@earthlink.net>
Subject: Re: SHELL/REGEX GUNSLINGERS NEEDED!!!
Message-Id: <68kf1d$7tv@argentina.earthlink.net>
> for REGEX in `(cat /usr/local/scripts/pregex)`
should be:
for REGEX in `cat /usr/local/scripts/pregex`
unlike the for synex in msdos, you don't use () with for
loop in unix sh.
zuodong.
------------------------------
Date: Fri, 02 Jan 1998 19:04:43 -0600
From: Eddie Dodwell <eddied@wwisp.com>
Subject: Socket ?
Message-Id: <34AD8EAB.41C67EA6@wwisp.com>
I am hoping someone can tell me why this code is returning the error:
Could not connect to server
Address family not supported by protocol family
here is the snippett:
#!/usr/bin/perl5
use Socket;
[
code
]
# Open a socket to the POP3 server.
$protocol = getprotobyname('tcp');
socket(SOCKET,PF_INET,SOCK_STREAM,$protocol);
$remote_ip = gethostbyname($server);
$remote_sock = pack('Sna4x8', AF_INET, 110, $remote_ip);
unless(connect(SOCKET, $remote_sock))
{
OutputError("Could not connect to server \n $!");
}
perl version is 5.001
OS is BSDI 3.1
The /etc/protocols is there and the proper protocol number is returned
as well as the IP address of the machine we are trying to reach.
Any other info I need to include, let me know.
Eddie
------------------------------
Date: Fri, 02 Jan 1998 20:04:03 -0600
From: Evan Wetstone <evanw@netops.com>
Subject: Stored Function Call from perl DBI
Message-Id: <34AD9C93.531CCA0C@netops.com>
I'm writing a perl script that needs to call a stored function from
an Oracle database. I'm using perl 5.004_04, DBI, and DBD-Oracle.
The stored function takes an integer and a string as parameters,
and returns an integer.
Any ideas on how to do this? I've been racking my brain and searching
the docs but can't seem to find any reference to it.
Thanks,
Evan
------------------------------
Date: Sat, 03 Jan 1998 04:36:34 GMT
From: sase@sasezdesyn.com (SasEz! Publications and Design)
Subject: Whoops! (Re: UserAgent and POST questions)
Message-Id: <34adbf52.1281962@news.theriver.com>
Sorry all, I mangled two seperate codes together on accident, let me
take out the part that shouldn't be there.
On Sat, 03 Jan 1998 01:00:22 GMT, sase@sasezdesyn.com (SasEz!
Publications and Design) wrote:
>Hi all,
>I have been studying perl for three to four weeks now. I've only
>been using the man pages, faq's, tutorials online and this newsgroup
>so far, I hope to get the camel book soon though.
>
>I tested my first program today and after working out a couple of
>syntax errors, I got it to work. I'm using UserAgent from the LWP
>library, and for testing purposes I'm posting to my own free for all
>links page. My new code is working but my free for all code is
>telling me I didn't enter a URL. I've checked and triple checked
>that I have the name= part right, it's name=url on the free for all
>submit page so that is how I have it on my new test code.
>
>If anyone wants to check out the code below and tell me what I may
>be doing wrong I'd sure appreciate it. I'm trying to figure out why
>my free for all code is sending back a No URL Error. I'm also
>including other questions below the code for expansion on this
>beginning one.
>
>Reading this newsgroup makes me think the perl motto should be
>SMWTDI (so many ways to do it) :)
>
>Thanks in advance to all! :)
>Now for the code:
btw, I don't have -w in my code itself but I'm using it when running
from the command line.
>
>#!/usr/bin/perl
>
># Create a user agent object
> use LWP::UserAgent;
> $ua = new LWP::UserAgent;
> $ua->agent("AgentName/0.1 " . $ua->agent);
>
> # Create a request
> my $req = new HTTP::Request POST =>
>'http://www.sasezdesyn.com/freestuff/links.cgi';
> $req->content_type ("application/x-www-form-urlencoded");
> $req->content
>("name=title&value=test2;name=url&value=http://www.test.com");
>
> # Pass request to the user agent and get a response back
> my $res = $ua->request($req);
>
> # Check the outcome of the response
> if ($res->is_success) {
> print $res->content;
> } else {
> print "Bad luck this time\n";
> }
>
>Now for my other questions.....
>...Req POST=> #can I put a variable in here? @form('url')
>$req->content #can I put a variable or associative array here?
>%form('name', 'value') (I don't think that's quite the right
>syntax)
>
>Can I put the new request section inside of a for/foreach statement?
>For instance,
>$file = '/etc/passwd';
>open(INFO, $file);
>@line = <INFO>;
#much better
>close(INFO);
>for $line
>{
> New User Agent....
>}
>
>And if I have 5 lines in the file then a new agent will be created 5
>times, correct?
>
>I try to read through the newsgroup at least every other day but
>you're welcome to reply by mail also if you'd prefer. Thanks again!
>Kathy Burns
>
>-
>SasEz! Publications and Design ~ Kathy Burns
>Professional Web Design, Hosting, and Maintenance
>Is your business set up to make money 24 hours a day, 7 days a week?
>http://www.sasezdesyn.com mailto:sase@sasezdesyn.com
>ICQ #828499 ~Check out our Free web design planning guide!~
>-
-
SasEz! Publications and Design ~ Kathy Burns
Professional Web Design, Hosting, and Maintenance
Is your business set up to make money 24 hours a day, 7 days a week?
http://www.sasezdesyn.com mailto:sase@sasezdesyn.com
ICQ #828499 ~Check out our Free web design planning guide!~
-
------------------------------
Date: Fri, 02 Jan 1998 17:43:44 -0800
From: Kuntal Daftary <daftary@_remove_to_send_email_.cisco.com>
Subject: Re: word wrap routine
Message-Id: <34AD97D0.CC3D4530@_remove_to_send_email_.cisco.com>
Tom Phoenix wrote:
> > # why does everyone want to try to re-invent Text::Wrap?
> >
> > It was a 'quick and dirty solution'. It wasn't really meant to work
> > perfect but just give an idea to the poster.
>
> Compared to posting buggy code, it would have been better to give the
> poster the idea of using a module, don't you agree?
yes. but sometimes not everyone is aware that a "module" exists for
some
particular task. besides, people like me (i m not aware if there any
out
there) who (presently) shirk from anything OOPS oriented might not
want
to use a module (just a psychological thing rather than anything
else).
finally, these are jsut opinions. isnt it better that the questioner
gets
multiple opinions: sureshot modules as well as QND snippets and
himself
figures out what best suites his situation?
finally, it is not correct to post condenscending stuff just cuz he
knows
perl better than the lesser mortals (like me)
"why does everyone want to try to re-invent Text::Wrap?"
can be written as:
"there is a ready made module that does the work and then
there is a slight problem with the posted snippet"
after Text::Wrap is not the last code that will be ever written for
the
purpose. in fact i m sure that if i make it my mission in life i can
write
code that does the job but is better (simply cuz every code can be
bettered
and battered)
> > All people get here is 'Look in CPAN' and then have to
> > search for bloody hours trying to find something.
>
> Does anybody really have to "search for bloody hours"? Perhaps you've
> exaggerated. CPAN is well organized. There are indices. There is the
> module list. There are search engines. There's the CPAN.pm module. I'm
> sure that it's not really as hard as you say, but perhaps you have
> suggestions on how it could be improved.
--
#!/usr/local/bin/perl5
$d=12;for($b=$c=10;$a=substr "ASDDFGSFDHGAads \
??DBSDBSEBDCDDzFBDCECBADDDCBDDCBDGDIFBECEDDAACBABDADAABDADAACAACBAFFBFBFBDACD
\
DBCDDBCDCACDGFBFBFBCBDBEBDBEBDBCBDBHFBFBFBCBDBEBDBEBDBCBDBHFBFBFBCBDBEBDBEBDB
\
CBDBHFBFBFADBDBEBDBEBDBCBDBHGGAGEBDBEBDBEBDBCBDBHHECEGEABDCCCDCCCCEABG]CCBDCC
\
CDCCCCCCBF??IAwCLGByCKGBzBKGBzBKGBYDNCBDFBKGBADGCIAACBADCEDADAACBKGCACBACAACG
\
ACDDAACEBCDDBKGBCDCACCEBDBDACCDBKBKGBDBCBDCDBDBCBDCCBKBKGBDBCHEBDBCHDBKBKGBDB
\
CGFBDBCGEBKBKGBDBCBKBDBCBJBKBKGBDBCDDADGDDDACCJBKHEFGEFFGECICAAHICHEFBKESCI_B
\
o_Bo`Bn??GA_AhEB^BiEB^BiEB^BiEB^BSCBDMEBBCFDGDDBBCGCEDADAAJEBAAACDAACBACAACBA
\
ABAAACEAACEBCDKECCCBACDCACDBCCAEACCDBREBEBABDBCBIBCAEBDCCBREBEBABDBCBIBBAFHDB
\
REBEBABDBCBIBABFGEBREBEBABDBCBIFEBJBREBEBABDBCCEABBBCDDDACCQEBEBBEABCGCBCCAAB
\
GECPFBDBCCCBCEEBCCDEYLAfKA?JA?IA???",$b+++6,1;++$d){for($a=ord
$a;$a-->64;){
printf "%c",++$c==ord Z?$d=$c=$c/9:32^$d&1;}}
------------------------------
Date: 3 Jan 1998 01:30:17 GMT
From: plambert$1@plambert.org
Subject: Re: Writing a "nice" server?
Message-Id: <68k4b9$qhr$3@nntp1.ba.best.com>
Tom Phoenix <rootbeer@teleport.com> spewed:
> Select should block until there's activity on one of the filehandles. As
> far as I know, it should never sit and waste cpu cycles. (What value are
> you using for the fourth argument, the timeout?)
> I recommend calling select something like this, for debugging.
> warn "select(" .
> join(", ", map '"0x' . unpack("H*", $_) . '"',
> $rin, $win, $ein) .
> ", undef) at @{[ scalar localtime ]}";
> select($rout=$rin, $wout=$win, $eout=$ein, undef);
> warn "select returned with masks " .
> join(", ", map '"0x' . unpack("H*", $_) . '"',
> $rout, $wout, $eout) .
> " at @{[ scalar localtime ]}";
Oh, god, I'm embarrassed. Please excuse the large quantity of egg on my
face.
It seems the variable I was using for my timeout was, in my "real" script,
but not in my "test" script, getting changed from undef to 0. Eep.
It works beautifully now. :-)
Thanks, Tom, for reminding me that when it's supposed to work one way, but
it is actually working another, then I'm wrong about how it's supposed to
work. ;-)
--Paul Lambert
------------------------------
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 1573
**************************************