[15561] in Perl-Users-Digest
Perl-Users Digest, Issue: 2974 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 8 00:08:54 2000
Date: Sun, 7 May 2000 21:05:08 -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: <957758708-v9-i2974@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 7 May 2000 Volume: 9 Number: 2974
Today's topics:
Re: @array holding %hash (brian d foy)
Re: associating a filename with a FileHandle <dcljr@obkb.com>
Re: BerkeleyDB3.0.55 <rootbeer@redcat.com>
CGI Problem <jamalone@earthlink.net>
Re: converting input to <p></p> pairs via perl (brian d foy)
Re: converting input to <p></p> pairs via perl <nospam@devnull.com>
Re: DIRHANDLE problems <djberg96@hotmail.com>
Flat File Processing <martin@mert.globalnet.co.uk>
Re: Flat File Processing <mj.stevenson@auckland.ac.nz>
Re: Flat File Processing (Tad McClellan)
Free hosting with Mod_perl ? <daveb@banet.net>
Re: global variable with perl-cgi scripts ? (Bart Lateur)
Re: Grokking the parser <uri@sysarch.com>
Re: Grokking the parser (Tad McClellan)
How do I redirect a banner using IMG tags (Columbo)
Re: How do I redirect a banner using IMG tags <rootbeer@redcat.com>
Re: how to link my dinamic result html page into home p <rootbeer@redcat.com>
Re: Idiots guide to PERL Modules <aahz@gol.com>
Re: More CPerl-mode problems under NT <aqumsieh@hyperchip.com>
Re: More CPerl-mode problems under NT <aqumsieh@hyperchip.com>
Re: parsing Unix mailbox <elaine@chaos.wustl.edu>
Re: problem with "system" and file copy <rootbeer@redcat.com>
Re: reading char by char in a string (Tad McClellan)
Search engine script change trick@tig.com.au
Socket Modual <robynbatrouney@bigpond.com>
Substitution <grichards@flashcom.net>
Re: Substitution <wyzelli@yahoo.com>
Re: Substitution <uri@sysarch.com>
Suggest 'use Carp' to modify the messages of -w <johnlin@chttl.com.tw>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 07 May 2000 17:41:26 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: @array holding %hash
Message-Id: <brian-0705001741260001@99.new-york-71-72rs.ny.dial-access.att.net>
In article <MPG.137eb2ba1425abd298aa1d@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <brian-0605002307060001@75.providence-05-10rs.ri.dial-
>access.att.net> on Sat, 06 May 2000 23:07:06 -0400, brian d foy
><brian@smithrenaud.com> says...
>> In article <8f2irt$qmo$1@216.155.33.54>, The WebDragon <nospam@devnull.com> wrote:
>
>...
>
>> >I'm just curious, being a *gag choke* newbie to some pf the more elegant
>> >ways that perl works. what is so 'tricky' about
>> >
>> > | + @{ $AoA[$i] } = @array; # way too tricky for most programmers
>> >
>> >and how and when would I use such a construct?
>>
>> it's probably better just to write
>>
>> $array[$i] = \@array;
>
>You mean:
>
> $AoA[$i] = \@array;
oops. i meant to use different names. obviously i failed. ;)
>But that has different semantics. The exact equivalent is:
>
> $AoA[$i] = [ @array ];
to be clear,
$AoA[$i] = \@array;
references an array that can be accessed by name as well. changes
to @{$AoA[$i]} changes @array since they use the same data.
$AoA[$i] = [ @array ];
unrolls @array into a new, anonymous array. changes to @{$AoA[$i]}
do not affect the named array @array.
which you use depends on what you are trying to do.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Mon, 08 May 2000 00:06:11 GMT
From: Donald Lancon Jr <dcljr@obkb.com>
Subject: Re: associating a filename with a FileHandle
Message-Id: <391604ED.51D78A67@obkb.com>
I (as my work persona) mused:
> Since a FileHandle object is just an anonymous glob, you should be able
> to use its hash member however you want, right?
>
> In particular, you could store the filename for an opened FileHandle in
> the hash and it would be passed around with the FileHandle:
Randal S. suggested:
> The filename may not exist later, or may be changed.
True...
> At most, you've
> recorded something of historic interest only. What's your goal here?
Just thinkin'...
> What
> problem are you solving?
Given a FileHandle, what's the name of the file it's associated with (if
any)?
Of course, my "solution" assumed I was the one who opened it in the
first place, so I could use any number of other ways of remembering the
filename...
BTW, I also asked:
> Why isn't this discussed anywhere in the documentation?
Tom P. cautioned:
> Well, the implementation _probably_ won't change in the future.
That would probably be why. :-)
- dcljr
------------------------------
Date: Sun, 7 May 2000 17:17:10 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: BerkeleyDB3.0.55
Message-Id: <Pine.GSO.4.10.10005071715560.3921-100000@user2.teleport.com>
On Sun, 7 May 2000 rob@[remove] wrote:
> Building Perl5.6 on Solaris8/SunUltra/BerkeleyDB and continue to get
> core dumps on make test regarding BerkeleyDB3.0.55 and also failed
> during Perl make test.
Does that last mean that you haven't gotten perl itself to build without
failures yet? You probably shouldn't try installing modules until you've
gotten that much working - or at least, explained. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 08 May 2000 03:52:34 GMT
From: "Jason Malone" <jamalone@earthlink.net>
Subject: CGI Problem
Message-Id: <6SqR4.37691$x4.1209356@newsread1.prod.itd.earthlink.net>
I am having the wierdest thing happen.
I have written a script that opens a file and writes some data to it that it
is getting from an HTML GET. The problem is that sometimes it writes the
correct data and sometimes it writes old data.
i.e. it is like it is caching data that i submitted a couple of times before
and it writes that instead of what i just submitted.
Does anyone have any suggestions.
Jason Malone
------------------------------
Date: Sun, 07 May 2000 17:37:42 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: converting input to <p></p> pairs via perl
Message-Id: <brian-0705001737430001@99.new-york-71-72rs.ny.dial-access.att.net>
In article <8f3736$920$0@216.155.33.54>, The WebDragon <nospam@devnull.com> wrote:
>In article
><brian-0605002311250001@75.providence-05-10rs.ri.dial-access.att.net>,
>brian@smithrenaud.com (brian d foy) wrote:
> | this seems like a rather complicated way of doing this. it's much
> | easier to:
> |
> | $/ = "\n\n";
> |
> | while( <> )
> | {
> | print "<p>$_</p>";
> | }
>well, since the input is coming from a TEXTAREA input field and being
>passed to the *same* script (since the entire form is being generated
>via CGI.pm) the while( <> ) construct won't work for me ..
then do what's appropriate. don't get caught up in the details
to lose sight of the goal. just wrap the data appropriately.
you can still split on the paragraph separator to get the appropriate
chunks.
> | if all of this is wrapped in <p> tags, then there is no need for
> | the <br> tags. if there are going to be <br> tags everywhere, why
> | use <p>? ;)
>two reasons.
>#1 : correct html. correct html. correct html. correct html. I like
>correct html. I like things that work because they are done correctly
>and thus their behaviour is predictable. correct html. need I go on?
i think we agree. i don't see why you need the <br> tags, which i
don't necessarily consider to be "correct" HTML. it might not violate
the DTD, but it certainly violates the spirit of content markup.
>#2 :
><p>this is a long multiline paragraph that is going to wrap properly
>within a table and probably have a lot of text inside it rambling on and
>on and on and on etc etc ad nauseum til I terminate it with </p>
or it encounters another <p>. i didn't say to not use </p>, and
even used it in my example. i'm not sure you are responding to the
same message that i wrote ;)
><p>this is a short list of items<br>
>that I don't want to break up<br>
>and have show a paragraph break<br>
>like \n\n show up until I'm ready for it</p>
>
><p>I like this for these reasons:<br>
> + this is a good thing<br>
> + this is another good thing</p>
>
><P>I dislike it for these reasons:<br>
> - this is a bad thing<br>
> - this is another bad thing<br>
> - this is yet another very bad thing</p>
>
>get the idea ?
it looks like you want to use a list construct rather than
a paragraph construct.
>arbitrary <br> tags within a resizable table paragraph do NOT good
>formatting practices make.
i think that's what i was saying.
maybe you should not be so quick to disagree ;)
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 8 May 2000 01:27:35 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: converting input to <p></p> pairs via perl
Message-Id: <8f5567$mhc$0@216.155.33.54>
In article <957725299.28467@itz.pp.sci.fi>, Ilmari Karonen
<usenet11084@itz.pp.sci.fi> wrote:
If you respond via e-mail rather than via usenet, note the sig below for
the correct address.. I don't use it normally via usenet for obvious
reasons.
| Yuck. What's wrong with:
Yuck indeed. your code works, theirs does not.
I tried your examples in my code thusly:
-=-begin snip-=-
#let's try some other challengers:
$reviewText = param('reviewtext');
#um, not quite, but close
#$reviewText =~ s!\r\n?!\n!g;
#$reviewText =~ s!\n\n+!</p><p>!g;
#$reviewText =~ s!\n!<br>!g;
# getting closer, works well, but still missing <br> placement
$reviewText =~ s!\r\n?!\n!g;
$reviewText =~ s!\n!<br>\n!g;
$reviewText =~ s!(<br>\n){2,}!</p>\n\n<p>!g;
$reviewBody = "<p>$reviewText";
-=-end snip-=-
| Yuck. What's wrong with:
| s!\r\n?!\n!g;
| s!\n\n+!</p><p>!g;
| s!\n!<br>!g;
this one gives me the output all on one line which makes editing my
comments, after generating and saving the page, a little difficult.
-=-output from snip one-=-
<p>Enter your comments separated by double-returns like normal
paragraphs. </p><p>If you want lines to break </p><p>like this, then
enter it that way. </p><p>The parser will automatically produce the
correct paragraph and linebreak tags so please DO NOT enter them on your
own... they'll get removed =)</p><p>Lorem ipsum dolor sit amet,
consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim
veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut
aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in
hendrerit in vulputate velit esse molestie consequat, vel illum dolore
eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
dignissim qui blandit praesent luptatum zzril delenit augue duis dolore
te feugait nulla facilisi.</p><p>
-=-end
| ..or an alternative approach that preserves the newlines as well:
|
| s!\r\n?!\n!g;
| s!\n!<br>\n!g;
| s!(<br>\n){2,}!</p>\n<p>!g;
this produces nearly the most correct results I've seen so far, namely
this:
-=-output from snip two
<p>Enter your comments separated by double-returns like normal
paragraphs. </p>
<p>If you want lines to break </p>
<p>like this, then enter it that way. </p>
<p>The parser will automatically produce the correct paragraph and
linebreak tags so please DO NOT enter them on your own... they'll get
removed =)</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero
eros et accumsan et iusto odio dignissim qui blandit praesent luptatum
zzril delenit augue duis dolore te feugait nulla facilisi.</p>
-=-end
however it is still lacking in two respects, (however you DO get my
applause for correctly interpreting the paragraphs and getting them
surrounded properly ! (you are, by the way, the first to correctly post
an example here that worked :)) *applause*
#1 the <br> tags on
<p>If you want lines to break<br>
like this, then enter it that way.</p>
are not present.
#2 I'd really like to have it separate the </p><p> with \n\n instead..
would this change have the correct effect or do I misunderstand this?
change the line s!(<br>\n){2,}!</p>\n<p>!g; to read
s!(<br>\n){2,}!</p>\n\n<p>!g;
this still doesn't solve #1 but .. does everything else it's supposed
to.
Any ideas on how to resolve that last bit of the puzzle ?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Sun, 7 May 2000 21:17:41 -0500
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: DIRHANDLE problems
Message-Id: <3916235c$0$26036@news.execpc.com>
using 'chdir' fixed it. I take it passing a new
value to opendir doesn't actually change the current
working directory?
Thanks for the info.
Dan
"Tom Phoenix" <rootbeer@redcat.com> wrote in message
news:Pine.GSO.4.10.10005051729571.6766-100000@user2.teleport.com...
> On Fri, 5 May 2000, Daniel Berger wrote:
>
> > whenever I change directories (via win32dirselect - which is
> > why I'm posting in the tk newsgroup), I can no longer read the
> > files in the (new) current directory.
>
> If you change files with chdir(), do you see the same thing?
>
> > In other words, I no longer get a return value from
> > 'telldir DIRHANDLE'. I've tried various permutations
> > of rewinddir and seekdir, all to no avail.
>
> If you get no return value, that's telling you something. :-)
>
> > $cwd = cwd;
> > opendir(DIRHANDLE, "$cwd") || die "\nCouldn't open directory : $!";
>
> Those first double-quote marks are merely misleading. But why not simply
> use '.' as the directory name? Should be faster and more reliable, unless
> you need the directory's full name - which, I suspect, you might. :-)
>
> > while(defined ( $fileName = readdir (DIRHANDLE) ) ){
> > if( -f "$fileName" ){
>
> Now, if you change directory somewhere while this while loop is running,
> there's your problem. You're looking for $filename in one directory, but
> it's really in another. Is that it?
>
> > open(FILE, "$fileName") || die "\nUnable to open file $filename :
> > $!";
> > $curDir = telldir DIRHANDLE;
> > print "\n$curDir";
>
> It's unusual to do anything with the return value of telldir other than
> save it to pass back to seekdir later. But there's no law against printing
> it. :-) (Still, if you'll be using it much later, remember that the
> directory's contents may have changed, making it invalid.)
>
> Cheers!
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
------------------------------
Date: Sun, 7 May 2000 23:38:10 +0100
From: "Martin Elliott" <martin@mert.globalnet.co.uk>
Subject: Flat File Processing
Message-Id: <8f4rl9$3q9$1@gxsn.com>
I'm trying to process a flat file database, in order to produce a report.
The database is of the form :
Code=cd1
Quantity=2
Code=cd2
Quantity=3
XCoord=44
YCoord=45
Code=cd3
Quantity=22
XCoord=23
YCoord=47
...
(don't ask about the coords :-) )
I want to match the corresponding codes and quantities, and add the quantity
value to a variable (e.g. $cd1 for Code=cd1). Is there a way to skip to the
next line in Perl, (e.g. if Code = cd1 then $cd1 += *next lines Quantity
value*)??
I hope this is clear enough, although I know what I want I'm finding it
quite hard to explain :-)
Thanks in advance for any help,
Martin Elliott
------------------------------
Date: Mon, 08 May 2000 11:47:02 +1200
From: Matthew Stevenson <mj.stevenson@auckland.ac.nz>
Subject: Re: Flat File Processing
Message-Id: <39160076.B6C75995@auckland.ac.nz>
Martin Elliott wrote:
>
> I'm trying to process a flat file database, in order to produce a report.
> The database is of the form :
>
> Code=cd1
> Quantity=2
> Code=cd2
> Quantity=3
> XCoord=44
> YCoord=45
>
> Code=cd3
> Quantity=22
> XCoord=23
> YCoord=47
> ...
>
> (don't ask about the coords :-) )
>
> I want to match the corresponding codes and quantities, and add the quantity
> value to a variable (e.g. $cd1 for Code=cd1). Is there a way to skip to the
> next line in Perl, (e.g. if Code = cd1 then $cd1 += *next lines Quantity
> value*)??
Something like this should work. You probably want a hash rather than
$cdXX.
#!/usr/bin/perl -w
use strict;
my %hash;
open(DB_FILE,'<file.dat') or die;
while(<DB_FILE>){
if( my ($code) = m/Code=(.*)/ ) {
my $quantity=<DB_FILE>;
die("Database read format error\n") if($quantity !~
m/Quantity=(\d+)/);
$hash{$code}=$1;
}
}
for ( keys %hash ){
print("$_ $hash{$_}\n")
}
>cat file.dat
Code=cd1
Quantity=2
Code=cd2
Quantity=3
XCoord=44
YCoord=45
Code=cd3
Quantity=22
XCoord=23
YCoord=47
>./read.pl
cd1 2
cd2 3
cd3 22
Matthew
--
Matthew Stevenson
University of Auckland
mj.stevenson@auckland.ac.nz
mavricknz@yahoo.com
------------------------------
Date: Sun, 7 May 2000 18:35:41 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Flat File Processing
Message-Id: <slrn8hbrtt.ac4.tadmc@magna.metronet.com>
On Sun, 7 May 2000 23:38:10 +0100, Martin Elliott <martin@mert.globalnet.co.uk> wrote:
>I'm trying to process a flat file database, in order to produce a report.
>I want to match the corresponding codes and quantities, and add the quantity
>value to a variable (e.g. $cd1 for Code=cd1).
Use a hash ( $codes{cd1} ), not a bunch of named
scalar variables ( $cd1 ).
>Is there a way to skip to the
>next line in Perl,
^^^^
^^^^
while (<>) {
next if /something/;
}
But you don't want to "skip" the next line!
You want to "read" the next line:
-------------------
#!/usr/bin/perl -w
use strict;
my %codes; # key = Code, value = accumulated quantity for that Code
while ( <DATA> ) {
if ( /^Code=(.*)/ ) { # found Code line
my $code = $1; # remember Code
chomp(my $quan = <DATA>); # read next line
die "bad Quantity!" unless $quan =~ s/^Quantity=//; # strip label
$codes{$code} += $quan;
}
}
foreach (sort keys %codes ) {
print "Code: $_ Quan: $codes{$_}\n";
}
__DATA__
Code=cd2
Quantity=3
Code=cd1
Quantity=2
XCoord=44
YCoord=45
Code=cd3
Quantity=22
XCoord=23
YCoord=47
-------------------
output:
Code: cd1 Quan: 2
Code: cd2 Quan: 3
Code: cd3 Quan: 22
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 7 May 2000 23:32:06 -0400
From: "Dave" <daveb@banet.net>
Subject: Free hosting with Mod_perl ?
Message-Id: <391635e3_1@news1.prserv.net>
Anyone know of any companies which offer free hosting which also have
Mod_perl installed. This is for personal/semi-commercial use.
Or failing that does anyone know of a hosting company with Mod_perl which is
both dirt cheap yet really reliable.....get what you pay for I know, but any
suggestions gratefully received.
Regards,
Dave
------------------------------
Date: Sun, 07 May 2000 23:39:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: global variable with perl-cgi scripts ?
Message-Id: <3915fda1.124624@news.skynet.be>
Ed Bras wrote:
>But how do I know that a session has been terminated, such that his session
>file can be deleted ?
>For example when someone, during placing an order, just exit his browser,
>and so terminates his session. How do I detect this ?
What I do is check the modification date of the session file. For
everthing the user does, the file is "touched" (the date updated). If
the file is too old, say, over a few hours, then it may be deleted.
I even continue using the same session if the user logs in again within
a small amount of time. You never know if the user's browser simply
crashed...
--
Bart.
------------------------------
Date: Sun, 07 May 2000 22:32:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Grokking the parser
Message-Id: <x7em7evvn3.fsf@home.sysarch.com>
>>>>> "WI" == Wayne Izatt <wayne.izatt@myself.com> writes:
WI> %spacers = (husband => 'george', wife => 'june', son => 'elroy');
WI> @spacers = ('a', 'b');
WI> delete @spacers{'son', 'wife'}; # line 5
that is not refering the the array @spacers. it is a slice of the hash
%spacers.
WI> Which means that line 5 works. Yet it would appear to reference the
WI> spacers array. So I guess what Im not getting is the way the parser
WI> takes this line apart.
see my hash slice tutorial at:
http://www.sysarch.com/perl/tutorials/hash_slices.txt
read that and then you will grok the syntax and semantics of hash slicing.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 7 May 2000 18:40:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Grokking the parser
Message-Id: <slrn8hbs7q.ac4.tadmc@magna.metronet.com>
On Sun, 07 May 2000 22:03:34 GMT, Wayne Izatt <wayne.izatt@myself.com> wrote:
>I'm having trouble wrapping my head around this (based on an altered
>chunk from Essential Perl).
>%spacers = (husband => 'george', wife => 'june', son => 'elroy');
>@spacers = ('a', 'b');
>delete @spacers{'son', 'wife'}; # line 5
>Which means that line 5 works. Yet it would appear to reference the
>spacers array. So I guess what Im not getting is the way the parser
>takes this line apart.
>
>Ideas, oh enlightened ones?
You cannot tell what is being referenced by scanning only
the "punctuation char" (e.g. @) and the name (e.g. "spacers").
You must continue scanning beyond the end of the name to
see if there is further relevant punctuation (e.g. '[' or '{')
before you can know what is being referred to.
In your line
delete @spacers{'son', 'wife'}; # line 5
You are taking a hash slice from the %spacers hash.
The @spacers array is not mentioned on that line.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 07 May 2000 22:41:19 GMT
From: han_siu@hotmail.com (Columbo)
Subject: How do I redirect a banner using IMG tags
Message-Id: <jimR4.21623$g62.321196@news1.rdc1.ab.home.com>
I would like to redirect a banner using IMG tags. on my webpage I would like
to have a banner link like the following:
<a href="http://www.blah.com/cgi-bin/banner.cgi"><img
src="http://www.blah.com/cgi-bin/banner.cgi"></a>
How can I write a small program that will replace those links with links
specified in the perl file:
such as:
http://www.peewee.com/
http://www.peewee.com/banners/banner.gif
Thanks!
------------------------------
Date: Sun, 7 May 2000 17:18:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How do I redirect a banner using IMG tags
Message-Id: <Pine.GSO.4.10.10005071717360.3921-100000@user2.teleport.com>
On Sun, 7 May 2000, Columbo wrote:
> How can I write a small program that will replace those links with
> links specified in the perl file:
Probably by subclassing HTML::Parser. Let it be a challenge to you. :-)
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 7 May 2000 17:21:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how to link my dinamic result html page into home page.
Message-Id: <Pine.GSO.4.10.10005071718470.3921-100000@user2.teleport.com>
On Sat, 6 May 2000, yoon wrote:
> How can I make my html so that user can be connected to this dinamic
> page (the result of script)?
Are you asking, what do you need to do so that you can run your program on
a webserver? Because for that, you'll need to turn to your local expert.
Even if we knew how webservers like yours usually work, we don't know how
yours is configured and what policies your admin uses. And if we knew
those things, we'd know better than to discuss them in a newsgroup about
perl! :-)
> opendir(BASE,$path);
Just as with open(), you should always check the return value from
opendir().
> $script = "http://csweb2.xxx.yyy:8000;
One double quote mark isn't as good as two single quote marks. :-)
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.cpan.org/
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
http://www.cpan.org/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 07 May 2000 23:13:23 GMT
From: "Chris Williams" <aahz@gol.com>
Subject: Re: Idiots guide to PERL Modules
Message-Id: <nMmR4.1317$uL2.103728@nnrp.gol.com>
Try the module overview in the second chapter of "Object Oriented Perl."
It's pretty much just a list of steps: Don't try to figure out what's going
on, just do what it says and in time understanding will come.
"Greg Griffiths" <greg2@surfaid.org> wrote in message
news:3915701C.576D35C1@surfaid.org...
> Does anyone know of an idiots guide to writing your own PERL modules ?
> The ones I've seen so far seem pretty confusing. thanks
------------------------------
Date: Sun, 07 May 2000 23:15:58 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: More CPerl-mode problems under NT
Message-Id: <7a3dnu9cjz.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU> writes:
> ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
>
> > [A complimentary Cc of this posting was sent to Andrew Perrin - Demography
> > <aperrin@davis.DEMOG.Berkeley.EDU>],
> > who wrote in article <u5kitwr5f4d.fsf@davis.DEMOG.Berkeley.EDU>:
> > > This behavior is reproducible under the following condition:
> >
> > [etc]
> >
> > Not with 4.29. ;-) [I did not make it the default yet.]
> >
> > Ilya
>
> Nor with 4.30, which I just grabbed. Thanks!
I can only find 4.24 on CPAN! Where can I find later versions?
--Ala
------------------------------
Date: Mon, 08 May 2000 00:07:27 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: More CPerl-mode problems under NT
Message-Id: <7azoq19a69.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
Ala Qumsieh <aqumsieh@hyperchip.com> writes:
> Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU> writes:
>
> > ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> >
> > > [A complimentary Cc of this posting was sent to Andrew Perrin - Demography
> > > <aperrin@davis.DEMOG.Berkeley.EDU>],
> > > who wrote in article <u5kitwr5f4d.fsf@davis.DEMOG.Berkeley.EDU>:
> > > > This behavior is reproducible under the following condition:
> > >
> > > [etc]
> > >
> > > Not with 4.29. ;-) [I did not make it the default yet.]
> > >
> > > Ilya
> >
> > Nor with 4.30, which I just grabbed. Thanks!
>
> I can only find 4.24 on CPAN! Where can I find later versions?
Found it.
ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl/cperl-mode/
Should be on CPAN though.
--Ala
------------------------------
Date: Mon, 08 May 2000 03:49:39 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: parsing Unix mailbox
Message-Id: <B53BB192.3A7C%elaine@chaos.wustl.edu>
in article 39151374.C9B8963B@teleport.com, Christopher Adams at
cadams@teleport.com quoth:
> I am fairly new to Perl, so I would like to find out if my approach is
> a good one and if anyone has done this sort of thing before. Are there
> any scripts that I could look at to get some ideas?
:) Think of CPAN as the wheel...don't reinvent it.
http://search.cpan.org/search?dist=Mail-Audit
e.
------------------------------
Date: Sun, 7 May 2000 17:08:22 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: problem with "system" and file copy
Message-Id: <Pine.GSO.4.10.10005071706450.3921-100000@user2.teleport.com>
On Sun, 7 May 2000, David Pautler wrote:
> Strangely, glob("$path/*") doesn't seem to return filenames that have
> extensions.
Are you using a version of perl prior to 5.6 on a system like DOS/Windows,
perhaps? You should get filenames that have extensions if you're using
5.6, though.
> Is using a system call the only option in these cases?
Not a system call, but maybe system() is. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 7 May 2000 19:09:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: reading char by char in a string
Message-Id: <slrn8hbttk.ac4.tadmc@magna.metronet.com>
On Sun, 07 May 2000 20:44:43 +0200, Ola Jetlund <jetlund@tele.ntnu.no> wrote:
>How can I read special parts from a string? say:
>
>i have string that contains: someinfo_moreinfo_evenmoreinfo_
That is not the same question that you put in your Subject header.
Please be a bit more precise in wording your questions.
I don't know which one to answer...
reading char by char in a string
perldoc -f sysread
(but nobody really wants to do this, it will be slow)
_processing_ char by char in a string
foreach ( split //, $string ) {
# do something with char in $_
}
>I would like to store the info between the underscores ("_").
So there should be two "matches"
moreinfo
evenmoreinfo
since someinfo is NOT between underscores?
>But I'm
>still new at this and need help....
Though split(), as pointed out in another followup, will do the
job with the particular problem you presented, you can do it
with a regex too.
perldoc perlre
perldoc perlop
-----------------------------
#!/usr/bin/perl -w
use strict;
$_ = 'someinfo_moreinfo_evenmoreinfo_';
#while ( /_([^_]*)(?=_)/g ) { # same thing, all on one line
while ( /_ # underscore
( # start remembering matched chars in $1
[^_]* # zero or more of anything except underscore
) # stop remembering matched chars
(?=_) # see if the next char is underscore, without
# counting it in this match (because we
# need it at the beginning of the _next_ match)
/gx ) {
print "$1\n"; # do something with the matched chars in $1
}
-----------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 08 May 2000 11:39:33 +1000
From: trick@tig.com.au
Subject: Search engine script change
Message-Id: <39161AD4.54CF90FB@tig.com.au>
I found a good search engine script that i need
(http://www.getcgi-freescripts.com/search/) the only problem is it spits
out results unnumbered or as unordered <li>. Does anyone know how to
chnage it so the results are numbered, eg 1-10 on first page and 11-20
on second.
------------------------------
Date: Mon, 8 May 2000 13:43:14 +1000
From: "Justin Batrouney" <robynbatrouney@bigpond.com>
Subject: Socket Modual
Message-Id: <DAqR4.6455$X4.13173@newsfeeds.bigpond.com>
Hi
I am trying to establish a connection in Perl to my ISP's POP3 mail server.
I have obtained the connection, and now wish to send my username and
password to the server to login.
My question is....How do I send this data to the server. I assumed it would
be the same as a file handle and I could just use print SOCKET "user
$username"; but this doesn't work.
I have established the connection using the code below.
use Socket;
$port = 110;
$host = "mail.mailserver.com";
$proto = getprotobyname("tcp");
socket(SOCKET,PF_INET,SOCK_STREAM,$proto);
$iaddr = inet_aton($host);
$paddr = sockaddr_in($port,$iaddr);
connect(SOCKET,$paddr) || die "can't connect to $host";
while ($data = <SOCKET> ) {
print $data;
}
close(SOCKET);
--
Thanks
Justin Batrouney
------------------------------
Date: Sun, 7 May 2000 20:03:19 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Substitution
Message-Id: <shcbeompqil65@corp.supernews.com>
$foo contains 'compinsureblahblah'
I want $bar to contain 'blahblah'
I tried:
my $bar = ($foo =~ s/'compinsure'//);
Doesn't work. Help.
Gabe
------------------------------
Date: Mon, 8 May 2000 12:55:30 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Substitution
Message-Id: <LsqR4.13$1w.1595@vic.nntp.telstra.net>
Gabe <grichards@flashcom.net> wrote in message
news:shcbeompqil65@corp.supernews.com...
> $foo contains 'compinsureblahblah'
> I want $bar to contain 'blahblah'
>
> I tried:
>
> my $bar = ($foo =~ s/'compinsure'//);
>
Try :
$foo = 'compinsureblahblah';
($foo, $bar) = ($foo =~ /(compinsure)(.*)/);
print "$foo\n$bar\n";
Wyzelli
------------------------------
Date: Mon, 08 May 2000 03:32:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Substitution
Message-Id: <x766spwwbh.fsf@home.sysarch.com>
>>>>> "W" == Wyzelli <wyzelli@yahoo.com> writes:
W> Gabe <grichards@flashcom.net> wrote in message
W> news:shcbeompqil65@corp.supernews.com...
>> $foo contains 'compinsureblahblah'
>> I want $bar to contain 'blahblah'
>> my $bar = ($foo =~ s/'compinsure'//);
W> $foo = 'compinsureblahblah';
W> ($foo, $bar) = ($foo =~ /(compinsure)(.*)/);
W> print "$foo\n$bar\n";
why the grouping?
( $bar = $foo ) =~ s/compinsure// ;
the OP had quotes in there and assigned the result of the s/// to $bar
which are wrong. s/// works only by side effect unless you do grouping.
a common newbie mistake is thinking it returns the new string.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Mon, 8 May 2000 10:57:37 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Suggest 'use Carp' to modify the messages of -w
Message-Id: <8f5age$g2h@netnews.hinet.net>
Dear all,
With -w active, when our programs are not mature enough,
we often see warning messages like this:
Use of uninitialized value in concatenation (.)
at C:/Perl/lib/CGI.pm line 950.
This kind of messages often give me the first impression:
'Oh, this module does not carefully deal with "-w"',
although eventually I will find the bug is actually in my own code.
Besides, it doesn't provide useful enough information for us to catch
the bug at the first spot. Although later we can 'use diagnostics',
the bug might be difficult to reproduce by then.
Just like 'Carp::carp' improves the messages of 'warn',
I suggest 'use Carp' modify the "-w" messages to be like:
Use of uninitialized value in concatenation (.)
at C:/Perl/lib/CGI.pm line 950, called at main.pl line 15.
(1) It suggests the bug might be from your own code, not the module.
(2) You know where to begin with debugging (main.pl line 15).
What do you think about that?
Thank you.
John Lin
------------------------------
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 2974
**************************************