[16801] in Perl-Users-Digest
Perl-Users Digest, Issue: 4213 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 3 09:05:41 2000
Date: Sun, 3 Sep 2000 06:05:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967986322-v9-i4213@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 3 Sep 2000 Volume: 9 Number: 4213
Today's topics:
Re: a wannabe (Logan Shaw)
Re: APPLICATION NEEDED for E-COMMERCE <treywilliamsNOSPAM@netzero.com>
Re: Blat guru please !?! (Colin Keith)
Re: DBD::ODBC and date/time field overflow (Colin Keith)
Deleting tempfile after use <reevehotNOSPAM@hotmail.com>
Re: doing a replace task in a file (Colin Keith)
Re: finle handles in recursive procedures (Colin Keith)
Re: Good companion book to Programming Perl? <arm3@lex.infi.net>
hello world? sendkeys@my-deja.com
Re: hello world? <joelnelson@home.com>
Re: hello world? lserinol@my-deja.com
Re: hello world? <mtaylorlrim@my-deja.com>
help - IP problem with DBI <jm@mediaphil.de>
Re: Help! my comma's are comma%27s <wyzelli@yahoo.com>
Re: How do you setup a loop to run until some presses a <anmcguire@ce.mediaone.net>
Re: How do you use setuid in perl <gellyfish@gellyfish.com>
How to browse database with perl? <bfb@att.net>
Re: How to truncate file after nth occurrence of string <gustfrnt@globalvision.net>
HTML::Template <robinson_p@btconnect.com>
Re: HTML::Template <link@tss.no>
Re: learning perl (Colin Keith)
Makefile.PL and PREFIX Part II <luc_paix@my-deja.com>
Makefile.PL and PREFIX luc_paix@my-deja.com
Re: Makefile.PL and PREFIX <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Sep 2000 00:54:27 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: a wannabe
Message-Id: <8osp2j$lej$1@provolone.cs.utexas.edu>
In article <8opgf9$tdg$1@nnrp1.deja.com>, <michaeljgardner@my-deja.com> wrote:
>In article <zUWr5.6270$il3.115105@news6-win.server.ntlworld.com>,
>Said the straight man to the late man, "Where have you been?"
>"I've been here, and I've been there, and I've been inbetween."
>King Crimson
The code which Redmond wrote
Is cracking at the seams
Upon the instruments of death
The blue screen brightly gleams
The development staff is torn apart
With nightmares and with dreams
Will no one be there to see the crash
When silence comes from the machines?
Confusion
Will be my epitaph
As I read a cracked and broken JAPH
If we make it we can all sit back and laugh
But I fear tomorrow, I'll be compiling
Yes I fear tomorrow, I'll be compiling
Yes I fear tomorrow, I'll still be compiling
O.K., I'll stop butchering King Crimson now. Besides, I don't even
know if you can pronounce "JAPH" to rhyme with "epitaph".
I think if I were wanting to learn Perl, I'd do four things:
1. Read the newsgroup. Read the original posts, and try to
see if you can work out answers to people's questions. Then, read
the follow-ups and see if you were right.
2. Read the documentation that came with perl, or at least the half of
it that's not too obscure at first. Whatever "perldoc perl" says
would be a good place to start.
3. Pick up "Learning Perl" and/or "Programming Perl" and read those.
4. Above all, write some scripts. Set for yourself a task that you're
going to finish in Perl, and then do it.
It also might not hurt to read some of what Larry Wall has to say on
Perl. It won't teach the syntax or anything, but it'll teach you to
think like Larry Wall to some extent, and that can help you wrap your
mind around Perl. Of course, it wouldn't hurt to read a good book
about parsing. Perl is very much about language and parsing, so that'd
be helpful in wrapping your head around the somewhat complex syntax and
in understanding regular expressions.
Also, I always like to recommend that you read the excellent article on
regular expressions (in general, but also on Perl) here:
http://www.plover.com/~mjd/perl/Regex/ .
Hope that helps.
- Logan
------------------------------
Date: Sun, 03 Sep 2000 00:26:57 -0700
From: "Trey" <treywilliamsNOSPAM@netzero.com>
Subject: Re: APPLICATION NEEDED for E-COMMERCE
Message-Id: <20000903.002657.27537@sleepy.trey.net>
Give http://scriptsearch.internet.com/pages/l9.shtml a try. Check under
"Business" or "Shopping Cart".
Trey
In article <hcYr5.284$7F3.204516@news0.telusplanet.net>, "Irene Facchin"
<xtremex@telusplanet.net> wrote:
> I am looking for a perl application for E-Commerce, I am not concerned
> if it is completed. But I would like something that I can complete
>
> I am very familiar with Perl, and would like to see if there is
> somethign that can expediate the work I need to do\
>
> thank you
>
>
>
>
>
------------------------------
Date: Sun, 03 Sep 2000 12:59:20 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: Blat guru please !?!
Message-Id: <IWrs5.4044$6A2.391832@nnrp4.clara.net>
In article <U0Nr5.6309$cr3.190698@ozemail.com.au>, "James R" <reevehotNOSPAM@hotmail.com> wrote:
> system "$mailprog $BLAT_ARGS";
I have no idea wot Blat is, the name rings bells, but that's all, still ...
check the return code of this. Try using
open(MAIL, "|$mailprog $BLAT_ARGS") || die $!;
make sure that the $mailprog and $BLAT_ARGS variables have the expected
values, they're not null, someone moved the program or $CONFIG isn't defined.
The usual debugalizing stuff really.
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Sun, 03 Sep 2000 11:36:06 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: DBD::ODBC and date/time field overflow
Message-Id: <GIqs5.4000$6A2.386202@nnrp4.clara.net>
In article <8FA1D331Ddarkononenet@206.112.192.118>, darkon@one.net (David Wall) wrote:
>Driver]Datetime field overflow (SQL-22008)(DBD: st_execute/SQLExecute
>err=-1) at C:\PerlProg\hhe-query\try-q.pl line 29.
Its an ODBC error, so you're best of checking the MSKB and search for that
error code, it turns up a few entries which might help.
Also, stupid question as this seems, why do your date formats have #'s around
them?
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Sun, 3 Sep 2000 21:09:48 +1000
From: "James R" <reevehotNOSPAM@hotmail.com>
Subject: Deleting tempfile after use
Message-Id: <Ppps5.7810$cr3.227775@ozemail.com.au>
Using Blat to send mail on an NT machine, I need to create a temp file with
the form-mail data.
This works fine, but the temp file doesn't get deleted after the script is
finished.
I am using the following line, which I thought would do the trick, but
apparently not.
open(MAIL,">$WIN_TEMPFILE");
various stuff...
unlink $WIN_TEMPFILE;
(a) Should this work?
(b) Are there any other ways to do it safely?
------------------------------
Date: Sun, 03 Sep 2000 10:21:45 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: doing a replace task in a file
Message-Id: <ZCps5.3892$6A2.380932@nnrp4.clara.net>
In article <FF4CFCBCAAED380C.0C67465652F6F6C2.D14EE4DAB4CF2B32@lp.airnews.net>, JakeRocket <rocket@acme.com> wrote:
>What I can't seem to figure out how to do is a replace-type action. I
>would like to replace all spaces on a line with a quotaion mark and
>space.
Try the s/// or tr// operators.. s/// will allow you to replace a regexp
pattern match with whatever you want, tr// will translate character for
character.
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Sun, 03 Sep 2000 12:27:57 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: finle handles in recursive procedures
Message-Id: <htrs5.4014$6A2.390331@nnrp4.clara.net>
In article <8oo2sk$oc5$1@news.netmar.com>, mgopi@csa.iisc.ernet.in wrote:
>hello,
>can i use my() function to create a file handle variable so that recursive
>call
>to the sub uses different file handles.
Yes and no. FileHandles use the glob type which you can't create as a lexical
(my()) variable:
maia% perl -w -Mstrict;
local(*bob);
my(*bob);
Can't declare ref-to-glob cast in my at - line 2, near ");"
You can use local() to make a change to a package variable that is only in
effect until the end of the scope, so you might want to try that.
Alternatively you can stash a file handle away in a scalar and those are okay.
You might find in some cases that perl complains about you trying to use a
scalar where its expecting a glob type:
maia% perl -w -Mstrict;
my($x);
open($x, "<x");
Can't use an undefined value as a symbol reference at - line 2.
But there's a useful module called Symbol which will generate an anonymous
glob and return a reference to it to you, that reference you can stash in
scalar, so:
maia% perl -w -Mstrict;
use Symbol;
my($x) = Symbol::gensym();
open($x, "<x");
print for(<$x>);
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Sat, 02 Sep 2000 21:14:39 -0400
From: alfredo <arm3@lex.infi.net>
Subject: Re: Good companion book to Programming Perl?
Message-Id: <39B1A5FF.16BE8F68@lex.infi.net>
I have tried the Dummies book, didn't like it so I gave it to a person I
don't really like that much. I have settled for two books right now,
Learning Perl, and MacPerl, Power and ease. Both seem like good books, the
MacPerl is the easier of the two.
Niether will do much good if you don't sit down and start writing. that is
my problem right now.
Just do it, look at good code, and see how other's do it.
Al
"David H. Adler" wrote:
> On Sun, 27 Aug 2000 16:58:19 GMT, Uri Guttman <uri@sysarch.com> wrote:
> >>>>>> "SD" == Speed Demon <speed.demon9999@virgin.net> writes:
> >
> > SD> Perl for Dummies is AMAZING. Ok, its a dummies book but it teaches
> >
> >please don't promote that pile of smoldering dung in this newsgroup. it
>
> For a more detailed and less heated informed opinion on this book,
> please see http://www.plover.com/~mjd/perl/reviews/p54d.html
>
> dha
>
> --
> David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
> Please stop flirting with my canvas. - Damian Conway
------------------------------
Date: Sun, 03 Sep 2000 01:58:21 GMT
From: sendkeys@my-deja.com
Subject: hello world?
Message-Id: <8osb7n$ta2$1@nnrp1.deja.com>
hi can someone post me a little hello world cgi script with headers.
i keep getting a "Premature end of script headers". i have read alot of
the message posted befor but i can't get any of them working so if
anyone would give me a little script that works for sure just by
calling mydomain.com/cgi-bin/helloworld.cgi/pl and it would
print "hello world"
thank you my local is #!/usr/lib/perl5
thanks again!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 03 Sep 2000 02:41:56 GMT
From: Joel Nelson <joelnelson@home.com>
Subject: Re: hello world?
Message-Id: <39B1BA62.99E3A3BA@home.com>
sendkeys@my-deja.com wrote:
> hi can someone post me a little hello world cgi script with headers.
> i keep getting a "Premature end of script headers". i have read alot of
> the message posted befor but i can't get any of them working so if
> anyone would give me a little script that works for sure just by
> calling mydomain.com/cgi-bin/helloworld.cgi/pl and it would
> print "hello world"
> thank you my local is #!/usr/lib/perl5
#!/usr/lib/perl5
use CGI qw(:standard);
print
header,
start_html,
"hello world",
end_html;
:-) Joel
------------------------------
Date: Sun, 03 Sep 2000 11:15:15 GMT
From: lserinol@my-deja.com
Subject: Re: hello world?
Message-Id: <8otbrv$u3n$1@nnrp1.deja.com>
In article <8osb7n$ta2$1@nnrp1.deja.com>,
sendkeys@my-deja.com wrote:
> hi can someone post me a little hello world cgi script with headers.
> i keep getting a "Premature end of script headers". i have read alot
of
you're forgetting to put header info
here is a simple sample (you gotta have CGI.pm to run this sample):
#!/usr/lib/perl5
use CGI;
$q=new CGI;
print $q->header;
print $q->start_html;
print "<center><b>Hello World !</b></center>";
print $q->end_html;
Note: start_html and header has some parameters. check out the CGI.pm
documentation.
> the message posted befor but i can't get any of them working so if
> anyone would give me a little script that works for sure just by
> calling mydomain.com/cgi-bin/helloworld.cgi/pl and it would
> print "hello world"
> thank you my local is #!/usr/lib/perl5
> thanks again!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 03 Sep 2000 11:38:14 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: hello world?
Message-Id: <8otd76$ve3$1@nnrp1.deja.com>
And here is one without using any modules. However, the url would be
http://domain.com/cgi-bin/helloworld.cgi
I am not sure shy you want the /pl on the end, it is not necessary.
Even this has a lot of unnecessisary things in it.
Of course you need world executable permissions on it, and the cgi-bin
needs to allow for the execution of scripts. Also, be sure that the cgi-
bin is not aliased to point somewhere else.
You may also want to consider apending a -w to the first line to
activate warnings, and a use strict; below to help in debugging.
Mark
#!/usr/lib/perl5
# helloworld.cgi
print "Content-type:text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Hello World</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=\"#000000\" TEXT=\"#ffffff\" LINK=\"#00FFFF\"
VLINK=\"#00FFFF\">\n";
print "<BR><BR>\n";
print "<center><h2>Hello World</h2></center>\n";
print "<BR><BR>\n\n";
print "</body></html>\n";
In article <8osb7n$ta2$1@nnrp1.deja.com>,
sendkeys@my-deja.com wrote:
> hi can someone post me a little hello world cgi script with headers.
> i keep getting a "Premature end of script headers". i have read alot
of
> the message posted befor but i can't get any of them working so if
> anyone would give me a little script that works for sure just by
> calling mydomain.com/cgi-bin/helloworld.cgi/pl and it would
> print "hello world"
> thank you my local is #!/usr/lib/perl5
> thanks again!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 03 Sep 2000 10:17:21 +0200
From: Jonas Maurus <jm@mediaphil.de>
Subject: help - IP problem with DBI
Message-Id: <39B20911.D022E887@mediaphil.de>
Hello everybody.
I encountered the following problem:
I have a linux box running Redhat 6.2 which is configured for multiple
IP adresses, so it can host multiple FTP-Sites (so there are two devices
eth0 and eth0:0).
I wrote a Perl-script which connects to multiple database servers in our
LAN which run MySQL 3.22.30. I created an account for my Script in MySQL
using the eth0-ip as Host-setting.
Problem: My script can't connect to the database, because MySQL gets the
connection-request from the eth0:0-ip.
Question: How can I control which IP is used by the DBI to connect to
other servers ?
It is not possible to use the eth0:0-IP as it is reserved for one of our
customers.
Please help.
Thanks,
Jonas Maurus
------------------------------
Date: Sun, 3 Sep 2000 14:23:51 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Help! my comma's are comma%27s
Message-Id: <WOks5.11$Fq.1754@vic.nntp.telstra.net>
"perspiring goth" <perspiring@nuts.com> wrote in message
news:39b07c58_4@news.newsfeeds.com...
> Thanks but...
>
> $unescaped = CGI::unescape($text);
>
> print "$text";
>
> ...doesn't work. I'm sure I seem woefully inept but... ???
>
um maybe:
print $unescaped;
Did you try that?
Wyzelli
------------------------------
Date: Sun, 3 Sep 2000 02:12:32 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: How do you setup a loop to run until some presses a key?
Message-Id: <Pine.LNX.4.21.0009030210010.742-100000@hawk.ce.mediaone.net>
On Sat, 2 Sep 2000, Gary Brown quoth:
~~ Date: Sat, 02 Sep 2000 22:12:04 GMT
~~ From: Gary Brown <garyb1@home.com>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: How do you setup a loop to run until some presses a key?
~~
~~ I am tyring to setup a test condition which will keep running until someone
~~ presses a particular key. The script is actual logging system processes and
~~ I want it to run as soon as the script is started and end by pressing a
~~ specific key (like press "s" for stop).
~~
~~ This will run on a Winnt machine using active perl.
~~
~~ Any ideas? This does not sound difficult, but I cannot find a solution
~~ anywhere in my perl book collection.
use Term::ReadKey;
The example below is modified somewhat from the documentation that
comes with the Term::ReadKey module available on CPAN. The POD
in the module has a syntax error (I will submit a patch).
#!/usr/bin/perl -w
use strict;
use Term::ReadKey;
my $key;
ReadMode 4; # Turn off controls keys
until (defined($key = ReadKey(-1))) {
# No key yet
}
print "Got key $key!\n";
__END__
anm
--
Andrew N. McGuire
anmcguire@ce.mediaone.net
perl -le'print map?"(.*)"?&&($_=$1)&&s](\w+)]\u$1]g&&$_=>`perldoc -qj`'
------------------------------
Date: 3 Sep 2000 09:32:30 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How do you use setuid in perl
Message-Id: <8ot2au$6ho$1@orpheus.gellyfish.com>
On Fri, 01 Sep 2000 13:32:16 GMT shobs11@my-deja.com wrote:
> I am trying to run a script, but the user who is to run the script
> needs root permissions to do what the script is to do.
> setuid should do it, and I can get this working in C/C++ but I would
> like to use it within perl.
> Can anyone tell me how to do this?
> Are there any security problems with using setuid with perl?
>
Read the perlsec manpage, determine whether your system allows setuid
scripts, read the advisory on the exploit to an unpatched suidperl if
your system requires setuid script emulation. You might determine that
it would be easier to use 'sudo' (or whatever facility you might have
on your system for running a program setuid) than trying to make a setuid
script.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sun, 03 Sep 2000 12:38:47 GMT
From: Bernie <bfb@att.net>
Subject: How to browse database with perl?
Message-Id: <39B24636.98D7C726@att.net>
Can someone please show me an example of using perl
to browse a database using an html page? I have perl
communicating with a PostgreSQL database, and what I'd
like to do is have several text fields which correspond
to a record in a database, then have buttons to handle
"Next", "Previous", "Update", etc.
-Thanks
------------------------------
Date: Sun, 3 Sep 2000 03:24:04 -0400
From: "Bryan McAvoy" <gustfrnt@globalvision.net>
Subject: Re: How to truncate file after nth occurrence of string
Message-Id: <sr3v7dt5c5d19@corp.supernews.com>
Ouch. Well, thanks for setting me straight on how to ask the question. I
guess what I asked didn't make a lot of sense. Anyway, let's try this again.
Here is a snippet of the log file from which I wish to grab the 5 most
recent products. Products are appended to the beginning of the file
(actually, since I'm not at work attm, I just pasted the same warning back
to back, but this is what the log file looks like:
# Start log file
WUUS52 KGSP 260534
SVRGSP
NCC119-260630-
BULLETIN - IMMEDIATE BROADCAST REQUESTED
SEVERE THUNDERSTORM WARNING
NATIONAL WEATHER SERVICE GREENVILLE-SPARTANBURG SC
134 AM EDT SAT AUG 26 2000
THE NATIONAL WEATHER SERVICE IN GREENVILLE-SPARTANBURG HAS ISSUED A
* SEVERE THUNDERSTORM WARNING FOR...
SOUTHERN MECKLENBURG COUNTY IN THE PIEDMONT OF NORTH CAROLINA
* UNTIL 230 AM EDT
* AT 134 AM EDT...NATIONAL WEATHER SERVICE RADAR INDICATED A SEVERE
THUNDERSTORM WITH LARGE HAIL AND DAMAGING WINDS 5 MILES SOUTH OF
CHARLOTTE...OR ABOUT 4 MILES NORTHEAST OF PINEVILLE...MOVING EAST
AT 5 MPH.
* THE SEVERE THUNDERSTORM WILL BE NEAR...
MATTHEWS AT 210 AM EDT
MINT HILL AT 230 AM EDT
ALTHOUGH LARGE HAIL IS THE BIGGEST THREAT WITH THIS SEVERE
THUNDERSTORM...BRIEF DAMAGING WINDS COULD ALSO OCCUR.
$$
MOYER
WUUS52 KGSP 260534
SVRGSP
NCC119-260630-
BULLETIN - IMMEDIATE BROADCAST REQUESTED
SEVERE THUNDERSTORM WARNING
NATIONAL WEATHER SERVICE GREENVILLE-SPARTANBURG SC
134 AM EDT SAT AUG 26 2000
THE NATIONAL WEATHER SERVICE IN GREENVILLE-SPARTANBURG HAS ISSUED A
* SEVERE THUNDERSTORM WARNING FOR...
SOUTHERN MECKLENBURG COUNTY IN THE PIEDMONT OF NORTH CAROLINA
* UNTIL 230 AM EDT
* AT 134 AM EDT...NATIONAL WEATHER SERVICE RADAR INDICATED A SEVERE
THUNDERSTORM WITH LARGE HAIL AND DAMAGING WINDS 5 MILES SOUTH OF
CHARLOTTE...OR ABOUT 4 MILES NORTHEAST OF PINEVILLE...MOVING EAST
AT 5 MPH.
* THE SEVERE THUNDERSTORM WILL BE NEAR...
MATTHEWS AT 210 AM EDT
MINT HILL AT 230 AM EDT
ALTHOUGH LARGE HAIL IS THE BIGGEST THREAT WITH THIS SEVERE
THUNDERSTORM...BRIEF DAMAGING WINDS COULD ALSO OCCUR.
$$
MOYER
WUUS52 KGSP 260534
SVRGSP
NCC119-260630-
BULLETIN - IMMEDIATE BROADCAST REQUESTED
SEVERE THUNDERSTORM WARNING
NATIONAL WEATHER SERVICE GREENVILLE-SPARTANBURG SC
134 AM EDT SAT AUG 26 2000
THE NATIONAL WEATHER SERVICE IN GREENVILLE-SPARTANBURG HAS ISSUED A
* SEVERE THUNDERSTORM WARNING FOR...
SOUTHERN MECKLENBURG COUNTY IN THE PIEDMONT OF NORTH CAROLINA
* UNTIL 230 AM EDT
* AT 134 AM EDT...NATIONAL WEATHER SERVICE RADAR INDICATED A SEVERE
THUNDERSTORM WITH LARGE HAIL AND DAMAGING WINDS 5 MILES SOUTH OF
CHARLOTTE...OR ABOUT 4 MILES NORTHEAST OF PINEVILLE...MOVING EAST
AT 5 MPH.
* THE SEVERE THUNDERSTORM WILL BE NEAR...
MATTHEWS AT 210 AM EDT
MINT HILL AT 230 AM EDT
ALTHOUGH LARGE HAIL IS THE BIGGEST THREAT WITH THIS SEVERE
THUNDERSTORM...BRIEF DAMAGING WINDS COULD ALSO OCCUR.
$$
#End log file.
So here is what I've tried to do to isolate the 5th set of "$$":
#!/usr/bin/perl5.00503
open(SVRFILE,"/home/bpm/svr.txt") ||
die "Sorry, I could not read /home/bpm/svr.txt";
open(SVROUT,">/home/bpm/svrout.txt") ||
die "Sorry, I could not read /home/bpm/svrout.txt";
#print the first five records in this flat file. these
#records all end with $$ so they can be easily split (I hope).
#I don't need some of these print statements, they
#just let me know something happened
while (<SVRFILE>) {
if (/\${2}/) {
++$tstm;
print "$tstm ";
if ($tstm == 5) {
$newsvr =~ s/\${2}//;
print SVROUT $newsvr;
} else {
print STDOUT $_;
}
} else {
print "Pattern not found: $1";
}
}
Well, all this does is print:
1 $$
2 $$
3 $$
etc...
Shouldn't $newsvr simply be $_ but with everything removed after the 5th set
of $$? I guess not. Am I even close (that would make a simple meteorologist
very happy).
Bryan
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:39B176D5.1ACA09D9@stomp.stomp.tokyo...
> Bryan McAvoy wrote:
>
> > I want to truncate a log file. Basically this file consists of hundreds
of
> > similar products all separated by a "$$" string. I only want the last 5
> > products. Thus, I want to truncate the log file after the 5th occurrence
of
> > the "$$" string and write that to a new file. I cannot figure out how
> > truncate this file based on the nth occurrence of a string. Can anyone
help?
>
>
> You need to state your parameters clearly and concisely.
> These parameters you state are self-contradictory. You
> have not indicated if this is a single line flat file,
> a multi-line flat file, a two, three... four dimensional
> file or something else.
>
> "...truncate the log file after the 5th occurrence
> of the "$$" string...."
>
> This would pick off all entries after the fourth data
> set, if your database is single line flat file using
> a common format. You indicate you want the last five
> products yet exemplify a case of grabbing all but the
> first four products. You are contradicting yourself
> pertaining to your parameters.If your format is different
> than a single line flat file, there is no way of knowing
> what you are asking. Could be any format, nothing but
> a guessing game.
>
> Use of a meta-character for a delimiter is most illogical.
>
> If you are truly interested in receiving help from people
> here, post your parameters clearly and concisely along
> with a snippet of your current code and a snippet of
> of your data structure so people can make sense of
> what you are asking. As is, this is truly nonsense.
>
> Provide something sensible and you will receive some
> sensible answers, such as a simple counter, rindex and
> substring to grab the last five products. Shouldn't
> take more than ten minutes to write a ten line script
> to do this, without having to play a guessing game.
>
> No tickie, no washie.
>
>
> Godzilla!
> --
> @© = (a .. z); @® = qw (7 15 4 26 9 12 12 1 18 15 3 11 19);
> srand(time() ^ ($$ + ($$ << 15))); for ($§ = $®[$®[0]]; $§ < $®[0]; $§++)
> { sub G { rand(1000) < 500 ? "\u$1" : "\l$1" ; } foreach $¿ (@®)
> { $¢ = $©[$¿-1]; $¢ =~ s¡([a-z])¡G($1)¡gie; $Ø = "$Ø$¢"; }
> $Ø ="$Ø! "; $ø = substr ($Ø, $®[12] - $®[11], 0, " ");
> $Ø =~ s¯(a)(r)¯$1 $2¯i; print "$Ø\n"; } exit;
------------------------------
Date: Sun, 3 Sep 2000 09:33:14 +0100
From: "Paul Robinson" <robinson_p@btconnect.com>
Subject: HTML::Template
Message-Id: <4Yns5.6503$ly4.30903@NewsReader>
I'm collecting information from a database and writing it to a template to
provide the user with a dynamic picklist of options.
They then save the information they've entered on form.
I also provide an amend details function which populates the input fields
with values from the database (the ones they saved earlier).
Using TMPL VAR I am able to pass values directly to template and that works
ok. What I need to be able to do is pass an array of items for use in
<select>
<option> ....
<option> ....
</select>
this I am doing with no problem but how do I set the SELECTED value. I know
that the <option> tag allows the use of 'SELECTED' but if I'm passing in an
array of elements into a TMPL LOOP how do I state which one is currently
selected. I also have the same problem with a multiple select list.
I suppose I could do this with JS during onLoad but was hoping for a neater
cgi solution,
has anyone come across this before??
Rgds
Paul
------------------------------
Date: Sun, 03 Sep 2000 13:30:52 +0200
From: Terje Bless <link@tss.no>
Subject: Re: HTML::Template
Message-Id: <39B2366C.A4431C1C@tss.no>
Paul Robinson wrote:
>Using TMPL VAR I am able to pass values directly to template and that works
>ok. What I need to be able to do is pass an array of items for use in
>
><select>
> <option> ....
> <option> ....
></select>
>
>this I am doing with no problem but how do I set the SELECTED value. I know
>that the <option> tag allows the use of 'SELECTED' but if I'm passing in an
>array of elements into a TMPL LOOP how do I state which one is currently
>selected. I also have the same problem with a multiple select list.
Look in the HTML::Template POD for the doumentation for the
loop_context_vars()
function. Cut'n'paste:
# loop_context_vars - when this parameter is set to true (it is false by
# default) three loop context variables are made available inside a
loop:
# __FIRST__, __LAST__ and __INNER__. They can be used with <TMPL_IF>,
# <TMPL_UNLESS> and <TMPL_ELSE> to control how a loop is output.
Example:
#
# <TMPL_LOOP NAME="FOO">
# <TMPL_IF NAME="__FIRST__">
# This only outputs on the first pass.
# </TMPL_IF>
#
# <TMPL_IF NAME="__INNER__">
# This outputs on passes that are neither first nor last.
# </TMPL_IF>
#
# <TMPL_IF NAME="__LAST__">
# This only outputs on the last pass.
# </TMPL_IF>
# </TMPL_LOOP>
#
# One use of this feature is to provide a ``separator'' similar in
effect
# to the perl function join(). Example:
#
# <TMPL_LOOP FRUIT>
# <TMPL_IF __LAST__> and </TMPL_IF>
# <TMPL_VAR KIND><TMPL_UNLESS __LAST__>, <TMPL_ELSE>.</TMPL_UNLESS>
# </TMPL_LOOP>
#
# Would output (in a browser) something like:
#
# Apples, Oranges, Brains, Toes, and Kiwi.
#
# Given an appropriate param() call, of course. NOTE: A loop with only a
# single pass will get both __FIRST__ and __LAST__ set to true, but not
# __INNER__.
HTH, HAND -link
------------------------------
Date: Sun, 03 Sep 2000 12:55:46 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: learning perl
Message-Id: <lTrs5.4038$6A2.392040@nnrp4.clara.net>
In article <39af9495@news1.idx.com.au>, "Simon Voorwinde" <svavevav@idx.com.au> wrote:
>Where's is the best place to learn perl ?
By playing. Having a a good solid book on hand is good for getting you
started, but you need to be able to type it, not just study it. O'reilly's
"Learning Perl" and "The Perl Cookbook" are both handy, ones you'll probably
find useful to have lying around (though like most tech books, tehy're
expensive, see if you get your employer/frield/SO/relative to buy it for you:)
There are other books around though I've not read most.
http://www.perl.com/ has tutorials, there are also the FAQ's that are
distributed with Perl that you *must* check when you get stuck. They give good
solid answers, usually with examples to the questions that people ask over and
over. If you ask one of them and its in there people will most likely flame
you. That isn't to say if you get stuck with the answer not to come here and
ask, most people are friendly .. some are just plain mad:)
Lurk around this newsgroup. Code snippets/discussions will be posted and you
can distinguish good code from bad as the bad code will get commented on
verbosely. :)
Play, learn, fiddle and most importantly *try*. If you want to do something,
get right in there and do it. If it doesn't work try a different approach, if
it still doesn't work, see if there's an FAQ answer and if you still can't
find anything come here and ask :)
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Sun, 03 Sep 2000 09:40:05 GMT
From: STAT <luc_paix@my-deja.com>
Subject: Makefile.PL and PREFIX Part II
Message-Id: <8ot69k$otu$1@nnrp1.deja.com>
Greetings, so I'm about to fall asleep when it dawns on me...
- make
- make test
- make install
Duh...
my question now is... would it be better to Makefile.PL
PREFIX=/home/stat
instead of /home/stat/www/cgi-bin/Lib ??
I now have Base64.pm in
/home/stat/www/cgi-bin/Lib/lib/perl5/site_perl/i386-linux-thread/MIME/
which is a heck of a mouthful... it would still work as good right?
I just want to know before I install all the other modules that I need
before I install LWP.pm
And, if so, is it alright to simply delete the directory and start
over, or do I have to do a special uninstall?
THNX you very much.
<!--#š|t|ä|t|.|d|É|v|!|l|n|É|t|.|n|É|t -->
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 03 Sep 2000 07:32:36 GMT
From: luc_paix@my-deja.com
Subject: Makefile.PL and PREFIX
Message-Id: <8osuqk$hm3$1@nnrp1.deja.com>
Greetings. I'm having a misunderstanding about Makefile.PL. Firstly,
I don't have root, so here's what I did...
cd /home/stat/www/cgi-bin
mkdir Lib
download MIME::Base64-2.11.tar.gz to my home directory /home/stat/
gunziped, tared it etc.
cd into MIME-Base64-2.11 and
perl Makefile.PL PREFIX=/home/stat/www/cgi-bin/Lib
everything went ok, BUT, my understanding (and yes I am a newbie) was
that Base64.pm was going to be created in the ./Lib directory with all
pointers, but there's nothing in ./Lib
Do I have to mvdir ./MIME-Base64-2.11/ into /home/stat/www/cgi-bin/Lib
myself, and if so, should I had:
perl Makefile.PL PREFIX=/home/stat/www/cgi-bin/Lib/MIME-Base64-2.11 ???
and if so, can I change the name of ./MIME-Base64-2.11 into anything I
want? (before Makefile of course)
These answers would clear up lots' of stuff and would be well
appreciated.
As always, STAT.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 3 Sep 2000 12:12:05 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Makefile.PL and PREFIX
Message-Id: <8otbm5$6va$1@orpheus.gellyfish.com>
On Sun, 03 Sep 2000 07:32:36 GMT luc_paix@my-deja.com wrote:
> Greetings. I'm having a misunderstanding about Makefile.PL. Firstly,
> I don't have root, so here's what I did...
> cd /home/stat/www/cgi-bin
> mkdir Lib
> download MIME::Base64-2.11.tar.gz to my home directory /home/stat/
> gunziped, tared it etc.
> cd into MIME-Base64-2.11 and
> perl Makefile.PL PREFIX=/home/stat/www/cgi-bin/Lib
>
> everything went ok, BUT, my understanding (and yes I am a newbie) was
> that Base64.pm was going to be created in the ./Lib directory with all
> pointers, but there's nothing in ./Lib
>
You dont make it clear, after this did you then do :
make
make test
make install
?
It is these steps that respectively create the files that will need to be
installed, test that the created module works and copies the appropriate
files into the correct place (in your case indicated by PREFIX).
When I run make install after having specified a prefix of
/home/gellyfish/Lib (having created the directory /home/gellyfish/Lib)
I will get :
/home/gellyfish/Lib/lib/site_perl/5.6.0/i686-linux/auto/MIME/Base64/Base64.so
/home/gellyfish/Lib/lib/site_perl/5.6.0/i686-linux/auto/MIME/Base64/Base64.bs
/home/gellyfish/Lib/lib/site_perl/5.6.0/i686-linux/MIME/Base64.pm
/home/gellyfish/Lib/lib/site_perl/5.6.0/i686-linux/MIME/QuotedPrint.pm
You will notice that a directory structure has been created under PREFIX
that mirrors that which the Perl installation will have created under, say,
/usr/local - you will also notice that there are more files than simply
'Base64.pm' - the files under 'auto' are needed for the XS element of
the module which is essential to the modules operation.
> Do I have to mvdir ./MIME-Base64-2.11/ into /home/stat/www/cgi-bin/Lib
> myself, and if so, should I had:
> perl Makefile.PL PREFIX=/home/stat/www/cgi-bin/Lib/MIME-Base64-2.11 ???
>
> and if so, can I change the name of ./MIME-Base64-2.11 into anything I
> want? (before Makefile of course)
>
No, if you have followed the steps outlined above (and in the README file
for the module incidentally) then the files will be copied into the
appropriate place and you will need to add the directory :
/home/stat/www/cgi-bin/Lib/lib/site_perl/5.6.0
to @INC with 'use lib' (of course the version number may be different on your
system):
use lib qw(/home/stat/www/cgi-bin/Lib/lib/site_perl/5.6.0);
You *will* want to use the lib pragma as it takes care of the architecture
specific library directories you can see above and automagically adds them
to @INC where appropriate - read more about this in the manpage for the
lib pragma.
It is inadvisable to move the distribution directory as the directory
layout is different to what is required ('make test' makes special allowance
for this but you won't want to do this in your own programs). It is likewise
inadvisable to copy the files into the lib directory where you have more
than one file in the module.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 4213
**************************************