[13623] in Perl-Users-Digest
Perl-Users Digest, Issue: 1033 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 10 20:05:35 1999
Date: Sun, 10 Oct 1999 17:05:15 -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: <939600315-v9-i1033@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 10 Oct 1999 Volume: 9 Number: 1033
Today's topics:
Re: .pl files How to convert in text format ? <Home.Barbet@wanadoo.fr>
[Q] Object-Relational DBs in Perl (Postgres, Informix, <wade@csd.uwo.ca>
Re: ActivePerl - Running? <jeff@vpservices.com>
Re: ActivePerl - Running? <sjs@yorku.ca>
CGI and perl question <Mob-Rules@home.com>
CO-LOCATION SPACE AVAILABLE <hostmaster@dsp.net>
Re: Do you now an affordable Perl editor for Windows NT KernelKlink@webtv.net
Expiring Pages <gus@asus.net>
Re: Help - Perl regular expression question! <ltl@rgsun40.viasystems.com>
Help! <acacia@online.no>
how to call a sub roght by form <yhm@inter.net.il>
howto load modules to an ISP website? <dtbaker@busprod.com>
Re: I need some Perl help (Abigail)
Re: I need some Perl help <gellyfish@gellyfish.com>
Kragen kicks butt ( was Re: We do complex Perl Programm <gellyfish@gellyfish.com>
need csh > perl advice <reply@the.ng>
Re: need csh > perl advice <sjs@yorku.ca>
Parsing Config File (Chris Fairbanks)
Passing unknown filenames as arguments to another progr <scresawn@ufl.edu>
Re: Perl CGI/Browser Output Bug - Help! (Eric Bohlman)
Re: Question? Writing to file (Martien Verbruggen)
Re: Redirecting output to /dev/null (Scot Hacker)
Re: s/// used on a file slurped into a scalar (David Wall)
Re: Splash screen <gellyfish@gellyfish.com>
Y2K and localtime <thomas2@dalnet.se>
Re: Y2K and localtime <Tbone@pimpdaddy.com>
Re: Y2K and localtime <jeffp@crusoe.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 10 Oct 1999 01:40:51 +0200
From: BARBET Alain & Estelle <Home.Barbet@wanadoo.fr>
To: lsouriau@club-internet.fr
Subject: Re: .pl files How to convert in text format ?
Message-Id: <37FFD283.97762545@wanadoo.fr>
ledanseurs wrote:
>
> Hi ,
>
> I am working on Win NT 4 Workstation. I was given some files with 'pl'
> extension,
> (ex file.pl ), I can read them with a software called Worldview.
> I have to convert those files to text files (.txt), do you know how to
> do that ?
> If I open those files with Word Pad or Note pad , they are full of
> unreadable ascii
> caracters, so i really need a program that can convert those kind of
> files.
>
> Thank you
>
> Laurent
>
> e-mail: lsouriau@club-internet.fr
Perl in unreadable ascii ?? I don't know what's your file is ! Usually
Perl are text file who can view with
Wordpad ... You are sure this is Perl file ?
--
Alain & Estelle BARBET
http://www.citeweb.net/alian
------------------------------
Date: 10 Oct 1999 19:10:20 -0400
From: Wade Holst <wade@csd.uwo.ca>
Subject: [Q] Object-Relational DBs in Perl (Postgres, Informix, etc.)
Message-Id: <61g0zibyn7.fsf@brown.csd.uwo.ca>
I am looking into the availability of object-relational databases that
have a clean perl interface.
I am hoping to be able to create perl classes whose instances have
both an in-memory and database presence. Before I go off and write
my own collection of classes to handle the sychronization details
between DB and RAM versions (by either defining abstract superclasses
that 'serializable' objects inherit from, or by defining a 'wrapper'
class that can reflectively query arbitrary object's state), I wanted
to see if anything had been written or planned along these lines.
I have recently bought two Linux boxes, both running Linux RedHat 6.0,
and noticed that Postgres 6.4.2 comes bundled with Redhat 6.0. Can
anyone give me any comments on the usefulness of Postgres, whether it
is being actively supported, and whether anyone has taken up
maintenance of the Postgres Perl module? As a side note, is Informix
worth paying money for? Does the DBD::Informix module handle Postgres?
Thanks in advance,
Wade
--
Dr. Wade Holst wade@csd.uwo.ca
University of Western Ontario http://www.csd.uwo.ca/~wade
------------------------------
Date: 9 Oct 1999 22:11:11 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: ActivePerl - Running?
Message-Id: <37FFBD37.CC2A6359@vpservices.com>
Richard Neidermyer wrote:
>
> I downloaded activePerl for my home system on windows95.
> ... There is no editor? Now i am lost.
> When I click on perl.exe all I get is a dos window.
Well, first thing you should learn is where the documentation is. From
windoze, click on start-menu/programs/ActivePerl/Online documentation.
Or from a DOS window type "perldoc perldoc".
The documentation covers your questions in the section on "Getting
Started", but the basic idea is you create scripts in any text editor
capable of saving plain ascii files and you run them by going to a DOS
console window and typing "perl scriptname".
--
Jeff
------------------------------
Date: 09 Oct 1999 18:47:17 -0500
From: Steven Smolinski <sjs@yorku.ca>
Subject: Re: ActivePerl - Running?
Message-Id: <m3zoxst7ui.fsf@hank.yorku.ca>
Richard Neidermyer <rmnesu@ptd.net> writes:
> I downloaded activePerl for my home system on windows95. I am not too
> familiar with Perl and how it works. [...]
You might want to actually use the help item that ActivePerl put in your
start menu. There are over a thousand pages of help in html form there.
Make some tea. Book off an evening. Learn some Perl.
Steve
------------------------------
Date: Sun, 10 Oct 1999 23:40:17 GMT
From: Mob-Rules <Mob-Rules@home.com>
Subject: CGI and perl question
Message-Id: <380123F5.C1586D5@home.com>
How do I make it so you have to go through my page before using my cgi?
I tried $ENV{'HTTP_REFERER'} != "http://mysite.com/page.html" then print
access denied but I can still do "http://mysite.com/cgi-bin/mycgi.chi"
and it works.
Any help?
Thanks
------------------------------
Date: Sun, 10 Oct 1999 15:31:11 -0700
From: "bub" <hostmaster@dsp.net>
Subject: CO-LOCATION SPACE AVAILABLE
Message-Id: <hr8M3.505$SC2.24817@nuq-read.news.verio.net>
CO-LOCATION SPACE AVAILABLE
I'll give you:
some space on our 19" industrial racks
Primary & secondary DNS
Multiple domain hosting
Domain name registration
3 IP addresses
10/100/gig switch or hub connectivity
(1) UPS (Uninterrupted Power Supply) unit
Level 3 or Verio backbone connectivity
2 email accounts
Monitor/keyboard/mouse
(1) dial-in account
24x7 access
$205 per mo per machine.
email: hostmaster@dsp.net
------------------------------
Date: Sun, 10 Oct 1999 19:18:23 -0400 (EDT)
From: KernelKlink@webtv.net
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <8732-38011EBF-20@storefull-215.iap.bryant.webtv.net>
Can't recommend an editor outside of pico, but if your looking for a GUI
editor I would recommend that you get one that has the ability to
automatically add line numbers to your script. This would be a very nice
feature in case you have to comment on (for example) line #127 and then
cut and paste it into a newsgroup posting or into an email etc..
Some GUI editors will add line numbers but if you cut and paste the
script, the line numbers do not appear in the paste.
------------------------------
Date: Sat, 9 Oct 1999 19:42:59 -0400
From: <gus@asus.net>
Subject: Expiring Pages
Message-Id: <rvvlbtamh1s45@news.supernews.com>
How do I expire a page once it has loaded. I do not want people to be able
to refresh the page...
I tried inserting an expire html header tag. But it does nothing..
Is it my server? I am on NT4 with IIS
Thanks
------------------------------
Date: 10 Oct 1999 22:45:29 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Help - Perl regular expression question!
Message-Id: <7tr4u9$l58$1@rguxd.viasystems.com>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
:>I always ask myself whether (very much optimized)
:> /foo(?<!kfoo(?=d))/; # Match foo not inside kfood
:>can be written more readable and less error-prone.
A backreference has a fixed length when it is actually tested. Could
it not be made legal in a lookbehind? Let me rephrase. How much
work would it take to make it legal in a lookbehind?
/(fo+)(?<!k\1(?=d))/: variable length lookbehind not implemented at re line 12.
I'm not advocating quatifiers in the lookbehind that would cause
backtracking within the lookbehind itself.
The need to recalculate the length each time has a cost. I don't
have any feel for the cost/benefit tradeoff on this.
Without it, the "very much optimized match foo not inside
kfood" seems pretty limited as I quickly discovered when trying
to apply it.
Still a cool technique for the toolbox though.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Sun, 10 Oct 1999 01:32:07 +0100
From: "Acacia" <acacia@online.no>
Subject: Help!
Message-Id: <YfQL3.2678$nU4.12274@news1.online.no>
Ok, I'm pretty new at this, but im trying to set up a website without hiring
a programmer...
How can I transform a URL into the name of the last subdirectory of the
given URL ?
What I'm saying is, how do I, for instance, turn
http://www.something.com/anything into 'anything' ...
Any help would be greatly appreciated.
Acacia
------------------------------
Date: Sun, 10 Oct 1999 00:28:01 +0200
From: "Yuval Hamberg" <yhm@inter.net.il>
Subject: how to call a sub roght by form
Message-Id: <7toft7$ej1$1@news2.inter.net.il>
hi,
I want that the user will enter his password in a cgi output like this:
<html><body>
<h1>Password?</h1><form method="POST">
<input type="hidden" name="action" value="main">
<input type="password" name="password"><br>
<input type="submit" value=" Enter ">
</form></body></html>
than the cgi will do:
if ($FORM{'action'}) { &checkpassword; }
if ($FORM{'action'} eq "main") { &main; }
But that dosent work. i lerned that i sould put this in before:
# Read and Parse Form:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
}
# Finished with parsing the input.
But i don't know excekly what it does and not why he does it. anyway it
still wont work...
any ideas
thanks
------------------------------
Date: Sat, 09 Oct 1999 17:38:07 -0500
From: Dan Baker <dtbaker@busprod.com>
Subject: howto load modules to an ISP website?
Message-Id: <37FFC3CF.CCC0E430@busprod.com>
I have a website that needs to use the optional module Image/Size.pm and
my ISP is reluctant to load it for some reason. I have been attempting
to copy required files and create a "site" for optional modules in my
cgi-bin dir, but I must be missing copying or editting some pieces for
the auto-loader or something because I cant get things to work
correctly.
Is there a reasonably easy way to upload a module like this (things that
are normally installed to /usr/bin/site ) to a user cgi-bin site and
configure it?
--
Thanx, Dan
# If you would like to reply-to directly, remove the - from my username
* no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B) *
------------------------------
Date: 10 Oct 1999 15:03:49 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: I need some Perl help
Message-Id: <slrn801s8q.cs7.abigail@alexandra.delanet.com>
Mob-Rules (Mob-Rules@home.com) wrote on MMCCXXXI September MCMXCIII in
<URL:news:3800D57B.2847C103@home.com>:
## I have a list of names in a file and I need to know how many times each
## name appears and what the name is but can't figure out how to do it in
## Perl.
Assuming the names are one separate lines:
local %_;
local *FILE;
open FILE, "file" or die "Failed to open file: $!\n";
map {$_ {$_} ++} <FILE>;
close FILE or die "Failed to close file: $!\n";
print map {"$_{$_}: $_"} keys %_;
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Oct 1999 20:49:49 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I need some Perl help
Message-Id: <7tqu5d$6ae$1@gellyfish.btinternet.com>
On Sun, 10 Oct 1999 18:05:28 GMT Mob-Rules wrote:
> I have a list of names in a file and I need to know how many times each
> name appears and what the name is but can't figure out how to do it in
> Perl.
>
my %filenames;
while(<>)
{
chomp;
$filenames{$_}++;
}
foreach (keys %filenames)
{
print $_,"\t",$filenames{$_},"\n";
}
Or isnt that what you meant ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 10 Oct 1999 20:20:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Kragen kicks butt ( was Re: We do complex Perl Programming at very competetive rates)
Message-Id: <7tqsek$6a9$1@gellyfish.btinternet.com>
On Sun, 10 Oct 1999 18:06:48 GMT Kragen Sitaker wrote:
> In article <7tp250$b0u$1@news.vsnl.net.in>,
> Findcollege <info@findcollege.com> wrote:
>>We do complex Perl Programming at very competetive rates ($20/hour).We have
>>offices in US and in India and as the developmet would be done in India we
>>give high quality perl programming at very low rates. Vist our company's
>>web-site at
>>www.enabling-information.com
>
> I don't see any Perl code on your web site that would allow us to
> critique your expertise. I do see:
<snip>
Heh ;-}
Kragen you're in the wrong job mate (whatever that might be) ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 09 Oct 1999 22:36:26 GMT
From: "Matt Hadder" <reply@the.ng>
Subject: need csh > perl advice
Message-Id: <KrPL3.7619$Y96.69758@news.rdc2.occa.home.com>
Hello group,
I was looking for advice. I just changed jobs recently. At my old job I
wrote mainly in Unix C Shell. I am a decent csh programmer. My new
position is in a group developing in Perl. The function of the programs I
will be writing will be the same or very similar to what I have done in the
past. Also, I have inherited the task of porting a set of automation
scripts from csh to Perl.
My questions:
Is there some good documentation for avoiding pitfalls when coming from
another language to Perl?
Does anyone have advice as to the approach to take or things to avoid when
porting from csh to Purl?
Thanks,
Matt
------------------------------
Date: 09 Oct 1999 19:00:32 -0500
From: Steven Smolinski <sjs@yorku.ca>
Subject: Re: need csh > perl advice
Message-Id: <m3yadct78f.fsf@hank.yorku.ca>
"Matt Hadder" <reply@the.ng> writes:
> Is there some good documentation for avoiding pitfalls when coming from
> another language to Perl?
There are a few words in _Programming Perl_, 2nd edition, by Wall,
Christiansen, and Scwartz (O'Reilly) page 533 (which I think is one
must-have if you need to do serious Perl).
> Does anyone have advice as to the approach to take or things to avoid when
> porting from csh to Purl?
There is this snippet of good advice in the Perl FAQ:
------8<-------
=head2 How can I convert my shell script to perl?
Learn Perl and rewrite it. Seriously, there's no simple converter.
Things that are awkward to do in the shell are easy to do in Perl, and
this very awkwardness is what would make a shell->perl converter
nigh-on impossible to write. By rewriting it, you'll think about what
you're really trying to do, and hopefully will escape the shell's
pipeline datastream paradigm, which while convenient for some matters,
causes many inefficiencies.
------8<-------
Have fun!
Steve
PS: On a lighter note: if you're like the shell programmers in my shop,
please, Please, PLEASE remember that commenting your script is NOT a
sign of weakness!!!
------------------------------
Date: Sun, 10 Oct 1999 04:36:12 GMT
From: chrisf@removethis.winterlink.net (Chris Fairbanks)
Subject: Parsing Config File
Message-Id: <38001670.2732146@news.wli.net>
I am trying to parse an apache config file to print out to a file the
virtualwebsite:homedirectory. I have searched but cannot find anyway
to do it. Any help would be appreciated.
Thanks
Chris
--------
Example
httpd.conf
----------
#about 50 lines of other data that needs to be skipped above this.
<VirtualHost 10.1.1.2>
ServerAdmin webmaster@joebob.com
DocumentRoot /home/j/joebob/public_html
ServerName www.joebob.com
</VirtualHost>
<VirtualHost 10.1.1.3>
ServerAdmin webmaster@joe.com
DocumentRoot /home/j/joe/public_html
ServerName www.joe.com
</VirtualHost>
<VirtualHost 10.1.1.4>
ServerAdmin webmaster@bob.com
DocumentRoot /home/b/bob/public_html
ServerName www.bob.com
</VirtualHost>
--------------
I need to get a list like this
www.joebob.com:/home/j/joebob
www.joe.com:/home/j/joe
www.bob.com:/home/b/bob
------------------------------
Date: Sun, 10 Oct 1999 21:15:47 +0000
From: Steve Cresawn <scresawn@ufl.edu>
Subject: Passing unknown filenames as arguments to another program
Message-Id: <38010203.9637FAE3@ufl.edu>
I'm new to perl, and my question is this: I have a directory on a
linux machine with hundreds of text files, whose filenames all end in
".seq". I need to be able to create an array that holds the filenames
for the all the files ending with .seq. I then need to pass each of the
files as arguments to an external program, called "blastcl3".
Any tips on how to do this would be greatly appreciated.
Thanks,
Steve
------------------------------
Date: 10 Oct 1999 21:54:45 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl CGI/Browser Output Bug - Help!
Message-Id: <7tr1v5$8kp@dfw-ixnews6.ix.netcom.com>
David Efflandt (efflandt@xnet.com) wrote:
: On Thu, 07 Oct 1999 14:42:12 -0400, Carlo Mantini <carlo.mantini@fmr.com>
: wrote:
: >The formatted output from the executable is handled via a pipe. Here it
: >is below:
: >open (CMD, "suncap $host $symbol |");
: ...
:
: This is a "common" problem for inexperienced programmers. You are not
: testing your open to see if it is successful. So you don't know why it is
: failing (path?, permissions?).
In the case of a pipe, though, the open will almost always succeed even
if it proves impossible to execute the piped-from program. It's still a
good idea to check the success of the open in case it fails due to things
like a full process table, but the most important thing to check is the
result of *closing* the pipe; *that's* where you'll find out if the
piped-to program ran properly.
------------------------------
Date: 10 Oct 1999 05:04:06 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Question? Writing to file
Message-Id: <slrn8007ec.36a.mgjv@wobbie.heliotrope.home>
On Sat, 9 Oct 1999 23:05:53 -0400,
ICEMOUNTAIN@prodigy.net <ICEMOUNTAIN@prodigy.net> wrote:
> I want to be able to write to a file but it's not working, the file path is
> correct and I have it chomd 666.
You mean the file is world writeable?
> Do you know what is wrong.
Nope. And you don't provide much information. What is it you expect?
What happens? Are there error messages? Are there error messages in
the server log file? Did you read perlfaq9? What happens if you run it
from the command line?
You say you have 'it chomd 666', which I presume means that you have
'it' assigned read and write permissions of user, group and world.
What is 'it'? Is it the file you are trying to append to? Does that
file exist? What are the permissions on the directories under the
file?
Again, please, read perlfaq9, and if you come back, please be prepared
to provide a bit more detailed information than "it doesn't work". I
know people who don't work, but that doesn't mean it's immediately
clear to me why they don't.
> here is the script, its a small part of a bigger script:
Next, time, make your submitted code even smaller, please. Most of the
submission is irrelevant print statement.
> #!/usr/local/bin/perl
No -w flag. Bad.
no use strict, worse.
> print "Content-type:text/html\n\n";
>
> @values = split(/\&/, $ENV{'QUERY_STRING'});
> foreach $value (@values) {
> ($name, $data) = split(/=/, $value);
> $FORM{$name} = $data;
> }
Trying to do CGI parameter parsing yourself, bad idea. The CGI module
does all this for you, and it does it correctly.
> if ($FORM{'action'} eq "addentrie") {
> &addentrie;
> }
>
> print <<add;
> <html>
[snip of enormous amount of irrelevant HTML]
> </html>
> add
>
> sub addentrie {
>
> open(OUTF,">>/home/3gc/www/cgi-bin/scripts/FD.txt") or &dienice("Couldn't
> open FD.txt for writing: $!");
You pass something to the dienice sub, but you don't actually use it
there. More later.
> print OUTF "$FORM{'name'}|$FORM{'email'}|$FORM{'comments'}";
> sub dienice {
my $msg = shift;
> print <<Die;
> <html>
> <head>
> <title>Error</title>
> </head>
> <body>
$msg
> </body>
> </html>
> Die
> }
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the world,
Commercial Dynamics Pty. Ltd. | back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Sun, 10 Oct 1999 23:14:04 GMT
From: bounce.waxwing@dnai.com (Scot Hacker)
Subject: Re: Redirecting output to /dev/null
Message-Id: <059M3.5389$Ko.248352@typ12.nn.bcandid.com>
On Thu, 07 Oct 1999 01:42:50 GMT, Martien Verbruggen wrote:
>If you use system() with more than one argument, perl will pass the
>arguments directly to execvp(2). This means that the shell never gets
>to see any of it.
Ah... this makes sense.
<snip>
>However, since the output of the program goes to stdout, and not
>stderr, you can also use the backticks or qx():
>
>my $output = qx#hey SoundPlay set file of track 0 to 'file($Current)'#;
This did the trick just fine. Many thanks. Ironically, I just convinced
the author of hey to include an -s flag to suppress output, so I just
got things working earlier today. But this is excellent information,
and much appreciated. I'm sure it will come in handy later in the
project.
>PS. It's a bit unusual for a unix command to need arguments with
>brackets. I don't know that util, but are you sure that it's
>necessary?
You're right. I was relying completely on the examples in
hey's documentation, but just tried it without the parentheses and
it worked perfecly.
Thanks again,
Scot
--
The BeOS Tip Server: http://www.betips.net/
The BeOS Bible: http://www.birdhouse.org/beos/bible/
The Alt.OS Usability Challenge: http://www.betips.net/challenge/
------------------------------
Date: Sun, 10 Oct 1999 23:01:14 GMT
From: darkon@one.net (David Wall)
Subject: Re: s/// used on a file slurped into a scalar
Message-Id: <38011af0_1@news2.one.net>
In article <r7_L3.2437$UG5.154585@typ11.nn.bcandid.com>, kragen@dnaco.net (Kragen Sitaker) wrote:
>In article <380002d9_1@news2.one.net>, David Wall <darkon@one.net> wrote:
>> ... The following code doesn't
>>work, and I'm not sure why. I used the same regular expression in the code
>>that worked, except that here I used s///sig instead of s///si.
>
>What, exactly, do you mean by "doesn't work"? What does it do?
Sorry, I should have been more explicit. The code I included in my post
didn't give any output, not even an error message. That's what confused me.
Usually when I do something boneheaded perl says something like "What did you
do THAT for?" (loosely translated <g>)
>>s#(<a
>>href="\./lib/Pod/perlfaq\d\.html">.*)perlfaq(\d).*(</a>)#$1$faq{$2}$3#sig;
>
>My PSI::ESP module tells me that you switched from modifying things a
>line at a time to modifying them a file at a time at the same time as
>you switched from /si to /sig. This regex -- with the /s modifier --
>will find the first <a href="matching stuff">, the last perlfaq\d, and
>the last </a> in the file, and chomp everything between them.
Not exactly, but close. The text I wanted to change was split over several
lines. e.g.;
<a href="./lib/Pod/perlfaq8.html">
perlfaq8
</a><BR>
I set $/ to "</a>" and then looped through the file. So you were basically
right, I guess. (BTW, if that PSI::ESP module really works, contact James
Randi and get his million bucks. <g>)
>The simple fix is to use .*? instead of .*. I do wonder why you have
>the .*'s in there at all, though. Can you constrain them a bit more?
Certainly I could, since all I was capturing was the newline. But I didn't
want to take for granted that the newline would be there the next time I
grabbed a new version of Perl from Activestate. You're right, though, I
should have contrained it more. Since all I was really detecting was
whitespace, \s* is a much better choice, and in fact,
s#(<a
href="\./lib/Pod/perlfaq\d\.html">)\s*perlfaq(\d)\s*(</a>)#$1$faq{$2}$3#gi;
works just the way I expected it to.
>(I haven't looked at the ActiveState docs.) If you can't constrain
>them, maybe the second one really ought to be captured inside () and
>included in the replacement string?
Since it was only whitespace, I didn't really care, but it's a good thought.
Thanks!
David Wall
darkon@one.net
------------------------------
Date: 10 Oct 1999 21:09:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Splash screen
Message-Id: <7tqv9e$6ak$1@gellyfish.btinternet.com>
On Sun, 10 Oct 1999 11:52:54 +0200 Edo wrote:
> ItsMe9905 <itsme9905@aol.comnojunk> wrote:
>> Edo,
>
>> If by "visualize" you mean if you can have a Perl script write out an HTML page
>> for you then the answer is yes.
>
> I actually didn't mean that! (My English's betraying me <G>!)
> I meant this:
> I have a script, which doesn't have anything to do with html. When it is
> launched, I'd like it to show this splash screen.
> To give an example, think about programs like free agent on win or the
> gimp on linux/unix: when they're launched, you see that kind of
> "presentation screen", and that's what I'd like to have!
>
OK then you will either have to look at some Gtk module or perhaps even
working directly with X if on Unix - you can use Win32::GUI on (er Win32).
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 11 Oct 1999 00:45:05 +0200
From: "Thomas Åhlen" <thomas2@dalnet.se>
Subject: Y2K and localtime
Message-Id: <7tr513$sq$1@gordon.dalnet.se>
I have seen this localtime usage in some scripts:
my @_localtime = localtime(time());
my $date = 19000000 + $_localtime[5]*10000 + ($_localtime[4]+1)*100 +
$_localtime[3];
What is the easiest way to make the above code Y2K SAFE?
-Thomas
------------------------------
Date: 10 Oct 1999 23:22:50 GMT
From: Tushar Samant <Tbone@pimpdaddy.com>
Subject: Re: Y2K and localtime
Message-Id: <7tr74a$4ll$1@eve.enteract.com>
thomas2@dalnet.se writes:
>I have seen this localtime usage in some scripts:
>
>my @_localtime = localtime(time());
>my $date = 19000000 + $_localtime[5]*10000 + ($_localtime[4]+1)*100 +
> $_localtime[3];
>
>What is the easiest way to make the above code Y2K SAFE?
Leave it alone.
...that will be $85...
------------------------------
Date: Sun, 10 Oct 1999 19:36:51 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Y2K and localtime
Message-Id: <Pine.GSO.4.10.9910101935360.14462-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 11, Thomas =C5hlen blah blah blah:
> I have seen this localtime usage in some scripts:
>=20
> my @_localtime =3D localtime(time());
> my $date =3D 19000000 + $_localtime[5]*10000 + ($_localtime[4]+1)*1=
00 +
> $_localtime[3];
>=20
> What is the easiest way to make the above code Y2K SAFE?
By not touching a single thing. If you can do math, and know what
localtime() returns, you'll know this is a perfectly fine -- and rather
interesting -- way of producing a date of the form YYYYMMDD.
--=20
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
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 1033
**************************************