[18141] in Perl-Users-Digest
Perl-Users Digest, Issue: 309 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 18 03:06:15 2001
Date: Sun, 18 Feb 2001 00:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982483511-v10-i309@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 18 Feb 2001 Volume: 10 Number: 309
Today's topics:
\w{1} matches more than 1 character <bertilow@chello.se>
Re: Help understanding Lists of Lists or Multi-dimensio <Jodyman@usa.net>
Help understanding variable naming convention in Perl <Jodyman@usa.net>
Re: Help understanding variable naming convention in Pe <tony_curtis32@yahoo.com>
Re: Help understanding variable naming convention in Pe (Gwyn Judd)
Re: Help understanding variable naming convention in Pe <godzilla@stomp.stomp.tokyo>
Re: How to check variable to see if uninitialized. <Jodyman@usa.net>
Re: How to check variable to see if uninitialized. <bwalton@rochester.rr.com>
Re: Linda, this is cool! <sheila@spamcop.net>
Re: Linda, this is cool! <brondsem@my-deja.com>
Re: Newbie Question: How to upload a file from a form <michael@NOSPAM.vilain.com>
Re: Newbie Question: How to upload a file from a form <brondsem@my-deja.com>
Re: Newbie Question: How to upload a file from a form <gtoomey@usa.net>
Re: OO, class keeping track of its objects <jll63@easynet.be>
Re: perl help (Another Way)
Re: perl help (Gwyn Judd)
Re: PROPOSAL: Graphics::ColorNames <comdog@panix.com>
Re: Re: Linda, this is cool! <mindfield@badgers.emulationnet.com>
Reading NewsGroups <tom75@MailAndNews.com>
Re: Reading NewsGroups <tony_curtis32@yahoo.com>
Regular Expression (tim leung)
Re: Regular Expression <bwalton@rochester.rr.com>
sorting a delimited flatfile db by an arbitrary field <jeff@enko.com>
Re: sorting a delimited flatfile db by an arbitrary fie <bwalton@rochester.rr.com>
Re: striping HTML <comdog@panix.com>
Re: striping HTML (Tad McClellan)
Re: translating crlf in a string (Garry Williams)
Re: translating crlf in a string <no@email.com>
Re: translating crlf in a string <c_clarkson@hotmail.com>
use Net::FTP; fails <David@TheAkers.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 18 Feb 2001 02:44:07 GMT
From: "Bertilo Wennergren" <bertilow@chello.se>
Subject: \w{1} matches more than 1 character
Message-Id: <XFGj6.888$MU.8225@nntp1.chello.se>
The following two scripts do not produce the same output for me.
I think they should, as the only difference should be totally
irrelevant:
-----------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
$_ = "aaa";
$_ =~ s/(\w{1})/\U$1/;
print; # Prints "Aaa"
-----------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
$_ = "aaa";
$_ =~ s/(\w{1})/\U$1/;
print; # Prints "AAA"
-----------------------------------------------------------
In the second version "\w{1}" matches all three characters,
which is crazy, no?
Is the "utf8" pragma bonkers?
For your information:
perl -v
This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2000, Larry Wall
Binary build 623 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 16:27:07 Dec 15 2000
--
#####################################################################
Bertilo Wennergren
<http://purl.oclc.org/net/bertilo>
<bertilow@chello.se>
#####################################################################
------------------------------
Date: Sat, 17 Feb 2001 21:49:23 -0500
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Re: Help understanding Lists of Lists or Multi-dimensional arrays
Message-Id: <96nd77$ffo$1@plonk.apk.net>
Michel Dalle wrote in message <96ggvq$ld2$1@news.mch.sbs.de>...
>In article <96fk2g$1ie$1@plonk.apk.net>, "Jody Fedor" <Jodyman@usa.net>
wrote:
>>First, I've read and re-read Programming Perl pg 257-264. Also Perl
>>Cookbook
>>pg 97-105 I don't understand them
>>..
>
>I'd recommend that you read the following documentation :
>
>1) perldoc perldata
>2) perldoc perldsc
>3) perldoc perlfaq4
I'm reading these over AGAIN and trying to understand the
hash, array, list, reference, dereference thing. It's difficult.
>If I understand your description correctly, you're looking for a hash of
>hashes, and not an array of arrays...
>
>After you've gone through those three and solved your problem, have a
>quick look at perllol, perlreftut and perlref as well for later use.
Thanks Michel,
This is probably what I need but I don't understand this yet.
Old
Basic Programmers die hard. If I could just use array$(1,2) and get
the answers I need! :-)
Jody
------------------------------
Date: Sat, 17 Feb 2001 23:08:20 -0500
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Help understanding variable naming convention in Perl
Message-Id: <96nhr9$hkk$1@plonk.apk.net>
Can you name variables with a variable name?
I.E. $$variable Where $variable = test
Can you name an array with a variable name?
I.E. @$variable and get an array named @test?
Can you name a hash with a variable name?
I.E. %$variable and get a hash named %test?
If you can name a hash with a variable how can
you poplulate a variable named hash with
key/value pairs? I've tried:
%$unit = ();
foreach $inrec (@$unit) {
($name, $value) = split(/=/, $inrec);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
${$unit}{$name} = $value;
print "\${$unit}{$name} = ${$unit}{$name}\n";
}
And it works.
TIA
Jody
------------------------------
Date: 17 Feb 2001 22:10:35 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help understanding variable naming convention in Perl
Message-Id: <87u25szl50.fsf@limey.hpcc.uh.edu>
>> On Sat, 17 Feb 2001 23:08:20 -0500,
>> "Jody Fedor" <Jodyman@usa.net> said:
> [ snip stealth CGI question ]
perldoc CGI
hth
t
--
The avalanche has already started.
It is too late for the pebbles to vote.
------------------------------
Date: Sun, 18 Feb 2001 04:27:13 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Help understanding variable naming convention in Perl
Message-Id: <slrn98ujov.kdu.tjla@thislove.dyndns.org>
I was shocked! How could Jody Fedor <Jodyman@usa.net>
say such a terrible thing:
>Can you name variables with a variable name?
>I.E. $$variable Where $variable = test
>Can you name an array with a variable name?
>I.E. @$variable and get an array named @test?
>Can you name a hash with a variable name?
>I.E. %$variable and get a hash named %test?
Yes but you don't want to (to all three). See the FAQ:
perldoc -q 'How can I use a variable as a variable name?'
Also the more or less definitive document on the subject (in three
parts):
http://perl.plover.com/varvarname.html
What you want to use is a hash. Possibly in your case you also want to
look at the CGI module.
perldoc CGI
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
One of the penalties for refusing to participate in politics is that
you end up being governed by your inferiors.
-Plato
------------------------------
Date: Sat, 17 Feb 2001 22:43:07 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Help understanding variable naming convention in Perl
Message-Id: <3A8F6EFB.3CFE9022@stomp.stomp.tokyo>
Jody Fedor wrote:
> Can you name variables with a variable name?
> I.E. $$variable Where $variable = test
> Can you name an array with a variable name?
> I.E. @$variable and get an array named @test?
> Can you name a hash with a variable name?
> I.E. %$variable and get a hash named %test?
(snipped)
Randal, want me to give this one a smack
on the forehead with my Duncan yo-yo?
Just say the word.
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: Sat, 17 Feb 2001 22:06:11 -0500
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Re: How to check variable to see if uninitialized.
Message-Id: <96ne6m$fv3$1@plonk.apk.net>
Bob Walton wrote in message <3A8F2432.34D256C8@rochester.rr.com>...
>Jody Fedor wrote:
>>
>> I have the following subroutine:
>>
>> sub printstats {
>>
>> foreach $unit (@unit) {
>> foreach $desc (@desc) {
>> print "${$unit}{$desc}\n";
>>
>> }
>> &pause;
>> }
>> }
>Jody, first of all, you're doing a *bad thing* when you use symbolic
>references. What if $unit contains the name of a hash you use otherwise
>in your program? Plus, I don't think there is a simple foolproof way of
>testing for the existence of variable used via a symbolic reference.
>The fix? Use a hash, with the keys of the hash being the names you are
>now using for your variables. If you do that, then you will be able to
>use the exists function to test for the presence of particular hash
>elements, something like [UNTESTED]:
>...
> for $unit(@unit){
> for $desc(@desc){
> next unless exists $hash{$unit};
> next unless exists $hash{$unit}{$desc};
> print "$hash{$unit{$desc}}\n";
> }
> &pause;
> }
Thanks for the help Bob. My problem is I have multiple data
files with key=value pairs. I've read them into arrays i.e.
@unit1 through @unit2 using the following program. The
printstats subroutine is where the I get the warnings. It works
and I get the results I want when there is information in the
array. But as you said, maybe my thinking is wrong here.
Could you point me in the correct direction? Where I might
change? Thanks.
Jody
#### A little more of the whole program
%unit = (
akrn => "Akron Ward",
alli => "Alliance Ward",
ashl => "Ashland Branch",
can1 => "Canton Ward",
can2 => "Canton II Ward",
medi => "Medina Ward",
newp => "New Philadelphia Ward",
root => "Rootstown Ward",
stow => "Stow Branch",
tall => "Tallmadge Ward",
wads => "Wadsworth Branch",
woos => "Wooster Ward",
);
@unit = keys %unit;
print "Checking for files\n";
foreach $unit (@unit) {
$filename = "c:/www/akronohiostake/cgi-bin/reports/$yr$mo$unit.dat";
if (-e "$filename") { print "$filename exists\n"; &process;}
else { print "$filename does not exist!\n"; }
}
&printstats;
sub process {
$in = "";
open (INFILE, "$filename" ) or die "Can't open $filename: $!\n";
while (<INFILE>) {$in .= $_;}
close (INFILE) or die "Can't close $filename: $!\n";
@$unit = split (/\n/,$in);
foreach $inrec (@$unit) {
($name, $value) = split(/=/, $inrec);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
${$unit}{$name} = $value;
}
}
sub printstats {
foreach $unit (@unit) {
foreach $desc (@desc) {
print "${$unit}{$desc}\n";
}
}
}
------------------------------
Date: Sun, 18 Feb 2001 06:35:53 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How to check variable to see if uninitialized.
Message-Id: <3A8F6DC8.B2E50B9B@rochester.rr.com>
Jody Fedor wrote:
...
(see my comments on lines not starting with >)
> Thanks for the help Bob. My problem is I have multiple data
> files with key=value pairs. I've read them into arrays i.e.
> @unit1 through @unit2 using the following program. The
> printstats subroutine is where the I get the warnings. It works
> and I get the results I want when there is information in the
> array. But as you said, maybe my thinking is wrong here.
>
> Could you point me in the correct direction? Where I might
> change? Thanks.
>
> Jody
>
> #### A little more of the whole program
>
> %unit = (
> akrn => "Akron Ward",
> alli => "Alliance Ward",
> ashl => "Ashland Branch",
> can1 => "Canton Ward",
> can2 => "Canton II Ward",
> medi => "Medina Ward",
> newp => "New Philadelphia Ward",
> root => "Rootstown Ward",
> stow => "Stow Branch",
> tall => "Tallmadge Ward",
> wads => "Wadsworth Branch",
> woos => "Wooster Ward",
> );
>
> @unit = keys %unit;
>
> print "Checking for files\n";
>
> foreach $unit (@unit) {
>
> $filename = "c:/www/akronohiostake/cgi-bin/reports/$yr$mo$unit.dat";
> if (-e "$filename") { print "$filename exists\n"; &process;}
> else { print "$filename does not exist!\n"; }
> }
>
> &printstats;
>
> sub process {
> $in = "";
Delete the above line.
> open (INFILE, "$filename" ) or die "Can't open $filename: $!\n";
> while (<INFILE>) {$in .= $_;}
Replace the above line with:
@in=<INFILE>;
> close (INFILE) or die "Can't close $filename: $!\n";
>
> @$unit = split (/\n/,$in);
Delete the above line (no need to crease a unique array for each unit).
>
> foreach $inrec (@$unit) {
Make the above line:
foreach $inrec (@in) {
> ($name, $value) = split(/=/, $inrec);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $value =~ s/<!--(.|\n)*-->//g;
> ${$unit}{$name} = $value;
Replace above line with:
$hash{$unit}{$name} = $value;
> }
> }
>
> sub printstats {
> foreach $unit (@unit) {
Add:
next unless exists $hash{$unit};
> foreach $desc (@desc) {
Add:
next unless exists $hash{$unit}{$desc};
> print "${$unit}{$desc}\n";
Replace above line with:
print "$hash{$unit}{$desc}\n";
> }
> }
> }
HTH. Using a hash instead of symbolic references gets rid of the worry
about corrupting your namespace (yes, I see that you have a well-defined
set of names for your symbolic variables, but using symbolic references
is a bad habit to get into). It also permits you to use the "exists"
function on a supposed element of the hash to see if that key has been
created in the hash or not (which is something that is hard to do with a
symbolic reference).
--
Bob Walton
------------------------------
Date: Sun, 18 Feb 2001 04:01:13 GMT
From: Sheila King <sheila@spamcop.net>
Subject: Re: Linda, this is cool!
Message-Id: <r5iu8tsqccj65ote3hfgo6dvjphskn15l3@4ax.com>
On Sun, 18 Feb 2001 03:27:19 GMT, Mindfield
<mindfield@badgers.emulationnet.com> wrote in comp.lang.python in article
<21gu8tsoknv01eegt4jak2lo7180kijno5@4ax.com>:
:It's really quite a loathesome little business,
:and I've never figured out why people are still stupid enough to think
:that it works, but I guess they still abide by the old motto, "There's
:no such thing as bad publicity."
It costs them next to nothing, and they must end up selling some of their
product or generating some revenue from the spam. If they didn't, the spamming
would decrease, but instead it is on the increase. Some people are stupid
enough to buy from spammers.
:Ah, but there is if you lose your ISP for violating their TOS/AUP.
:And there are plenty of people -- me, for instance -- who are
:perfectly happy to send a nice note to their ISP's abuse department.
Me, too.
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
------------------------------
Date: Sun, 18 Feb 2001 04:17:35 GMT
From: "Dave Brondsema" <brondsem@my-deja.com>
Subject: Re: Linda, this is cool!
Message-Id: <z1Ij6.5619$0u5.1057082@news1.rdc1.mi.home.com>
"Steve D. Perkins" <stevedperkins@NOSPAM.hotmail.com> wrote in message
news:96mv3102l3d@news2.newsguy.com...
> Untitled Document ARGH!
>
> I wll never understand why spam still exists, the internet reaching
the
> level of development and maturity is has. I can't imagine that there's
> ANYONE left anymore dumb and/or internet-inexperienced to purchase
anything
> advertised through spam. Even if there is, I don't understand why
spammers
> woud target newsgroups for Tcl, Python, and Perl... technologies most
often
> used by crusty old-timers LEAST likely of all to be an effective target
> audience...
>
>
there will always be dumb people
------------------------------
Date: Sat, 17 Feb 2001 19:50:23 -0800
From: "Michael Vilain <michael@NOSPAM.vilain.com>"
Subject: Re: Newbie Question: How to upload a file from a form WITHOUT using cgi.pm?
Message-Id: <michael-897F57.19502317022001@news.nanospace.com>
In article <fu8u8ts18nsbovrt52fssfcc6ct6mrct1l@4ax.com>,
Klondike@NOSPAM.canuslupus.com wrote:
> Hi,
>
> I'm a newbie (duh) ... I need to be able to upload a file through a web
> form using a Perl script ... but cgi.pm is not installed on the server,
> and the server owner refuses to install any modules.
>
> What is needed on the script side to grab the file ... without using
> cgi.pm (nor cgi-lib nor any other module)?
>
> Thanks,
> Klondike
If the owner won't install modules, will he allow you to even run CGI
programs? If not, look for another place to put your site or do without
your form.
If you get the O'Reily Programming Perl CGI (or something like that), it
has a detailed description of what's required to code forms in plain
perl. I used it before I found out about CGI.pm and haven't bothered
to modify my code accordingly.
--
Michael Vilain
Certified Advanced Rolfer(r)
rolfer@vilain.com
http://www.vilain.com
------------------------------
Date: Sun, 18 Feb 2001 03:53:41 GMT
From: "Dave Brondsema" <brondsem@my-deja.com>
Subject: Re: Newbie Question: How to upload a file from a form WITHOUT using cgi.pm?
Message-Id: <9HHj6.5569$0u5.1045220@news1.rdc1.mi.home.com>
"Klondike Wolf" <KlondikeWolf@mailops.com> wrote in message
news:fu8u8ts18nsbovrt52fssfcc6ct6mrct1l@4ax.com...
> Hi,
>
> I'm a newbie (duh) ... I need to be able to upload a file through a web
> form using a Perl script ... but cgi.pm is not installed on the server,
> and the server owner refuses to install any modules.
>
> What is needed on the script side to grab the file ... without using
> cgi.pm (nor cgi-lib nor any other module)?
>
> Thanks,
> Klondike
If you want to use CGI.pm (which you should, no reason not to save time),
you can specify a directory for perl to look for it.
use lib '/some/directory/to/my/files';
use CGI qw(:standard);
where /some/directory/to/my/files is the directory that you personally have
access to. Just put the CGI.pm file there.
------------------------------
Date: Sun, 18 Feb 2001 14:42:30 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Newbie Question: How to upload a file from a form WITHOUT using cgi.pm?
Message-Id: <nbIj6.28593$65.133229@newsfeeds.bigpond.com>
I'm new to Perl too and had a simar problem with the first ISP I used
(which used IIS - yuk!; I changed to an ISP that uses Linux).
One way around this is to copy the modules you require (from cpan.org)
into your local directories.
I've been writing a library of frequently used functions (instead of using
too many existing packages)
in case I need to change ISP again.
From experience, You should ask your ISP:
1. Will Perl be running on a Windows (IIS), Linux/Apache, or other platform.
( I prefer Linux/Apache).
2. Do they have telnet access (to Linux).
3. When Perl scripts are run as cgi, will they be able to read/write your
directories?
(When I first started using cgi with Perl, the web server was running the
scritps as user 'nobody'
which could not read/write my files)
gtoomey.
-----------------------------------------
"Klondike Wolf" <KlondikeWolf@mailops.com> wrote in message
news:fu8u8ts18nsbovrt52fssfcc6ct6mrct1l@4ax.com...
> Hi,
>
> I'm a newbie (duh) ... I need to be able to upload a file through a web
> form using a Perl script ... but cgi.pm is not installed on the server,
> and the server owner refuses to install any modules.
>
> What is needed on the script side to grab the file ... without using
> cgi.pm (nor cgi-lib nor any other module)?
>
> Thanks,
> Klondike
------------------------------
Date: 18 Feb 2001 07:27:31 +0100
From: Jean-Louis Leroy <jll63@easynet.be>
Subject: Re: OO, class keeping track of its objects
Message-Id: <m3d7cga4ks.fsf@enterprise.starfleet>
Carl Bingel <no_spam_please@dacom.se> writes:
> I'd like to define a destructor that removes the object's reference from
> @MY_INSTANCES, but the problem is that the destructor method would never
> be called since the object is still being referenced in @MY_INSTANCES..
> of course i could create my own "manual" destructor method and make the
> user call that one, but it would neat if it could be solved more
> automagically...
You use Perl 5.6 or above? Use weak references: WeakRef.pm, available
from CPAN.
--
Jean-Louis Leroy
http://users.skynet.be/jll
------------------------------
Date: 18 Feb 2001 02:43:29 GMT
From: anotherway83@aol.com (Another Way)
Subject: Re: perl help
Message-Id: <20010217214329.05368.00001982@ng-ch1.aol.com>
>I'd be glad to try to help you out a bit, as would many others, but
>you'll have to give us something to try out. You gave us no links or
>code.
first off, thanks for agreeing to help me out
just tell me, sould i post it up here as a binary or should i email it as an
attachment to u
thanks again, and don't worry, the file is not very big
thanks again
peace
------------------------------
Date: Sun, 18 Feb 2001 04:38:40 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: perl help
Message-Id: <slrn98ukee.kdu.tjla@thislove.dyndns.org>
I was shocked! How could Another Way <anotherway83@aol.com>
say such a terrible thing:
>>I'd be glad to try to help you out a bit, as would many others, but
>>you'll have to give us something to try out. You gave us no links or
>>code.
>
>first off, thanks for agreeing to help me out
>
>just tell me, sould i post it up here as a binary or should i email it as an
>attachment to u
Well if you have any actual specific questions then post whatever
relevant parts you think are related to your question here. But not as a
binary. Usenet custom says that binaries should never ever ever be
posted to groups that don't have the word "binary" in the name. If you
don't have a specific question then just post a link with a short
description and people will download it if it looks interesting to them.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Keep cool, but don't freeze.
-- Hellman's Mayonnaise
------------------------------
Date: Sat, 17 Feb 2001 20:21:44 -0800
From: brian d foy <comdog@panix.com>
Subject: Re: PROPOSAL: Graphics::ColorNames
Message-Id: <comdog-BF2077.20214417022001@news.panix.com>
In article <3A8EE438.EB0043DD@unix.asb.com>, Robert Rothenburg
<wlkngowl@unix.asb.com> wrote:
> I think 'Gaphics::NamedColors' is a good name for the module.
are you basing this on the X11 rgb.txt?
there is also GD::Graph::colour which might be a good
starting place.
--
brian d foy <comdog@panix.com>
------------------------------
Date: Sun, 18 Feb 2001 03:27:19 GMT
From: Mindfield <mindfield@badgers.emulationnet.com>
Subject: Re: Re: Linda, this is cool!
Message-Id: <21gu8tsoknv01eegt4jak2lo7180kijno5@4ax.com>
On Sat, 17 Feb 2001 17:46:47 -0500, "Steve D. Perkins"
<stevedperkins@NOSPAM.hotmail.com> drooled an embarassing wet spot in
his lap as he typed:
>Untitled Document ARGH!
>
> I wll never understand why spam still exists, the internet reaching the
>level of development and maturity is has. I can't imagine that there's
>ANYONE left anymore dumb and/or internet-inexperienced to purchase anything
>advertised through spam. Even if there is, I don't understand why spammers
>woud target newsgroups for Tcl, Python, and Perl... technologies most often
>used by crusty old-timers LEAST likely of all to be an effective target
>audience...
Blame spambots. They retrieve all available newsgroups on the
spammer's ISP, then post their crap to every single one of them.
Fortunately many ISPs have gotten wise and have placed posting caps on
duplicate messages, but spambots have found ways to circumvent that --
by placing a random number after the subject line, by rotating the
subject line from a list of subject lines, by placing random ASCII
text at the end of each message, etc. so the server doesn't think it's
a duplicate message. It's really quite a loathesome little business,
and I've never figured out why people are still stupid enough to think
that it works, but I guess they still abide by the old motto, "There's
no such thing as bad publicity."
Ah, but there is if you lose your ISP for violating their TOS/AUP.
And there are plenty of people -- me, for instance -- who are
perfectly happy to send a nice note to their ISP's abuse department.
:)
--
Almost there...
"Ignorance breeds confidence more often than does knowledge." -Darwin
The Emulation Newbie FAQ: http://www.emulationnet.com/emufaq.html
Remove the badgers before E-Mailing.
------------------------------
Date: Sat, 17 Feb 2001 22:38:29 -0500
From: Tom <tom75@MailAndNews.com>
Subject: Reading NewsGroups
Message-Id: <3ABDF6F0@MailAndNews.com>
Hi,
I have working knowledge of perl and trying to read usenet through a
perl/cgi
script.
I'll be grateful if someone can help me out with related procedures.
Regards,
------------------------------------------------------------
Get your FREE web-based e-mail and newsgroup access at:
http://MailAndNews.com
Create a new mailbox, or access your existing IMAP4 or
POP3 mailbox from anywhere with just a web browser.
------------------------------------------------------------
------------------------------
Date: 17 Feb 2001 21:41:31 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Reading NewsGroups
Message-Id: <87y9v4zmhg.fsf@limey.hpcc.uh.edu>
>> On Sat, 17 Feb 2001 22:38:29 -0500,
>> Tom <tom75@MailAndNews.com> said:
> Hi, I have working knowledge of perl and trying to read
> usenet through a perl/cgi script.
> I'll be grateful if someone can help me out with related
> procedures.
http://search.cpan.org/search?mode=module&query=nntp
should be soemthing to be going on with...
hth
t
--
The avalanche has already started.
It is too late for the pebbles to vote.
------------------------------
Date: Sun, 18 Feb 2001 06:06:50 GMT
From: m_010@yahoo.com (tim leung)
Subject: Regular Expression
Message-Id: <3a906648.9208631@enews.newsguy.com>
Hi,
Could any one give me some hint on how to write a regular expression
that checks a field in a HTML Form.
1) The field contains a string of one or more version numbers
2) If the field has more than 1 version number, then needs a comma and
space to separate the version.
3) Version number must be separate by 3 dots (e.g. 1.1.1.1 )
Examples:
3.12.0.256 (ok)
1.0.0.0, 3.12.1.256, 2.2.2.2 (ok)
1.0.22 (not ok)
1.0.0.0, 3.12.1.256 (ok)
how can I must sure the version string is in the form of :
version# ( \,\s version# )*
which means a vesrion# followed by 0 or more (, vesrion#)
thanks
------------------------------
Date: Sun, 18 Feb 2001 07:13:46 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Regular Expression
Message-Id: <3A8F76A9.A272A86A@rochester.rr.com>
tim leung wrote:
...
> Could any one give me some hint on how to write a regular expression
> that checks a field in a HTML Form.
>
> 1) The field contains a string of one or more version numbers
> 2) If the field has more than 1 version number, then needs a comma and
> space to separate the version.
> 3) Version number must be separate by 3 dots (e.g. 1.1.1.1 )
>
> Examples:
> 3.12.0.256 (ok)
> 1.0.0.0, 3.12.1.256, 2.2.2.2 (ok)
> 1.0.22 (not ok)
> 1.0.0.0, 3.12.1.256 (ok)
>
> how can I must sure the version string is in the form of :
> version# ( \,\s version# )*
>
> which means a vesrion# followed by 0 or more (, vesrion#)
...
if($field=~/^(\d+\.){3}\d+(, (\d+\.){3}\d+)*$/){
print "field $field is OK\n";
}
else{
print "field $field is not OK\n";
}
--
Bob Walton
------------------------------
Date: Sun, 18 Feb 2001 05:36:03 GMT
From: jeff enko <jeff@enko.com>
Subject: sorting a delimited flatfile db by an arbitrary field
Message-Id: <3A8E294E.5F5821AB@enko.com>
I have a text file database which I have no control over, but I need to
be able to sort it by one of its delimited fields.
The data file is of the form
field1:field2:field3:field4
I need to produce a version of this that is sorted by an arbitrary
field, say field 2.
This is roughly what I need to do, but I am unsure how to do it with
Perl.
$inPath="/usr/home/data.db";
open(FILEIn,$inPath);
@lines = <FILEIn>;
foreach $line (@lines) {
@startTime= split(/:/, $line);#this should be 2 d instead
}#end for each
#I need startTime to be 2D, then sort by startTime[][1] (column 1 which
is field 2)
I know that this is straight forward, but it is not comming to me. I
tried searching the web, but with deja gone I came up blank.
------------------------------
Date: Sun, 18 Feb 2001 07:02:52 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: sorting a delimited flatfile db by an arbitrary field
Message-Id: <3A8F741A.A1E5BCF0@rochester.rr.com>
jeff enko wrote:
>
> I have a text file database which I have no control over, but I need to
> be able to sort it by one of its delimited fields.
>
> The data file is of the form
>
> field1:field2:field3:field4
>
> I need to produce a version of this that is sorted by an arbitrary
> field, say field 2.
>
> This is roughly what I need to do, but I am unsure how to do it with
> Perl.
>
> $inPath="/usr/home/data.db";
> open(FILEIn,$inPath);
> @lines = <FILEIn>;
>
> foreach $line (@lines) {
> @startTime= split(/:/, $line);#this should be 2 d instead
> }#end for each
>
> #I need startTime to be 2D, then sort by startTime[][1] (column 1 which
> is field 2)
>
> I know that this is straight forward, but it is not comming to me. I
> tried searching the web, but with deja gone I came up blank.
Try something like:
open FILEIn,"$inPath" or die "Oops, $!";
print sort {(split /:/,$a)[1] cmp (split /:/,$b)[1]} <FILEIn>;
Also see:
perldoc -q sort anything
If your data is numeric, use <=> instead of cmp. HTH.
--
Bob Walton
------------------------------
Date: Sat, 17 Feb 2001 20:13:32 -0800
From: brian d foy <comdog@panix.com>
Subject: Re: striping HTML
Message-Id: <comdog-A12137.20133217022001@news.panix.com>
In article <KgCj6.437223$U46.12848308@news1.sttls1.wa.home.com>, "Frank
Miller" <no@email.com> wrote:
> Tell you what. You do it your way, I'll do it my way and we'll all live in
> peace.
and you'll live without help from the people who know the answers.
*plonk*
--
brian d foy <comdog@panix.com>
------------------------------
Date: Sat, 17 Feb 2001 21:31:23 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: striping HTML
Message-Id: <slrn98ucvq.8gl.tadmc@tadmc26.august.net>
[ Jeopardectomy performed ]
Frank Miller <no@email.com> wrote:
>"Scott R. Godin" <dontspamthewebmaster@webdragon.net> wrote in message
>news:<96laou$2nv$1@216.155.33.113>...
>> In article <pEoj6.435107$U46.12741080@news1.sttls1.wa.home.com>, "Frank
>> Miller" <no@email.com> wrote:
>>
>> don't do this.. what I'm doing right here, and what you did right
>> below.. it's called top-posting
>Tell you what. You do it your way, I'll do it my way and we'll all live in
^^^^^^^^ ^^^^^^
>peace.
How about we do it *our* way in *our* newsgroup?
You are not being sufficiently selfish (sometimes selfish is OK).
You *want* people here to read what you post, don't you?
Many of the regulars here will not read (some won't even _see_)
your post if you use that style.
You are certainly free to do it the way _you_ want rather than the
way most of the folks you are writing to want, but you should
know that many regulars will killfile you. I have.
You have an inappropriate disregard for your audience. That is
poor writing.
>I personally don't like the reply after the message.
We are not talking about you personally.
We are talking about what is socially acceptable in this newsgroup.
You are new here, you cannot know. So now you do. You are not
required to conform to society though. Do as you choose.
>It's really sad that I come onto
>this group to try and get help and am just flamed by people like you.
It's really sad that you (and perhaps 50 others each day) come
into this group to ask a question that has already been answered here
hundreds and hundreds of times.
But the time of the thousands of people who read your article
is not as valuable as your time, so we understand.
>Do you treat people in
>real life like this?
Do you walk in on a foreign society and tell them they are doing
it wrong and that you have the right way in real life?
>Or only on the Internet?
Or only on the Internet?
>Are you one of those people
>that carries a baseball bat in their car and "flames" the driver in front of
>you when he doesn't something you don't like?
Are you one of those people who takes cuts in line because they
do not know that there is a line?
>Probably not.
Probably not.
When someone says "the line forms over there", a well-socialized
response is something like "Oh. Sorry.", not "standing in line
is stupid, and I'm not going to".
You are taking the moral equivalent of the last quotation there.
>So why do you
>think you can do the virtual equivalent to me on-line. Why do you think that
>your way is the right way?
You miss the point.
The point is not "the way" of any particular poster. The point is
what is "the way" of this here newsgroup. Your way isn't *our* way.
You will get more help with your Perl questions if you attempt to
fit in rather than attempt to recast the newsgroup in your own image.
You are not going to change how we are in any case...
>Why does some guy that posts a flaming rant on a
>website suddenly get to be the dictator of what I do on the Internet.
You misunderstand again. It is *not* what _he_ wants.
It is what _we_ want. Expect ridicule if you do not conform
to social rules. Just shrug it off if you like, but it will
hurt your chances of getting help here.
You would have picked up on what is expected here and not
stepped on your di^H^H sensitive body part if you had lurked
for a couple of weeks before speaking. Your rush has done
you serious and permanent damage I'm afraid.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 18 Feb 2001 02:36:05 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: translating crlf in a string
Message-Id: <pyGj6.51$gw.3277@eagle.america.net>
[ fixed broken line wrapping ]
On Sun, 18 Feb 2001 01:29:35 GMT, Frank Miller <no@email.com> posts
upside down and quotes sigs:
>"Bob Walton" <bwalton@rochester.rr.com> wrote in message
>news:3A8F1F5B.CA3E24E9@rochester.rr.com...
>> Frank Miller wrote:
>> >
>> > OK, before anyone flames me, I've read the FAQ, I've also spent the last two
>> > hours on the web trying to find the answer...
>> >
>> > I have a string that contains at CRLF (0x0d, 0x0a) in it, I'd like to
>> > replace that with [br]. How do I do this? I've tried:
>> >
>> > $note =~ s/\x0D\x0A/\[br\]/m;
>> > $note =~ s/\n/\[br\]/m;
>> > $note =~ s/[\x0D\x0A]\[br\]/m;
>> > $note =~ s/$/\[br\]/m;
>> >
>> > and just about everything else I can think of...
>> >
>> How about:
>> $note =~ s/\015\012/[br]/;
>
>Nope, that didn't work...
Oh yes it did:
$ perl -wle '$_="->\015\012<-";print;s/\015\012/[br]/;print'
->
<-
->[br]<-
$ perl -wle '$_="->\015\012<-";print;s/\x0d\x0a/[br]/;print'
->
<-
->[br]<-
$ perl -wle '$_="->\015\012<-";print;s/\r\n/[br]/;print'
->
<-
->[br]<-
$
You have something different in your string than what you think.
--
Garry Williams
------------------------------
Date: Sun, 18 Feb 2001 06:19:40 GMT
From: "Frank Miller" <no@email.com>
Subject: Re: translating crlf in a string
Message-Id: <0QJj6.438494$U46.12925712@news1.sttls1.wa.home.com>
> You have something different in your string than what you think.
I have looked at the string several times. There is clearly a 0x0d followed
by a 0x0a. No question about it. I tried your example code, and it works
fine. I am at a loss. What else could be wrong. These crlf's are coming from
a submit on a web page. When the text lines get into the database, it has
the crlf in it. I've printed it out and there is a crlf in it, but the s///
command fails to find it. Is Perl storing it differently or something?
Is there a way in Perl to print the ascii value of each character in a
string? That way I can scan it to see exactly what Perl has stored.
FrankM
------------------------------
Date: Sat, 17 Feb 2001 20:36:55 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: translating crlf in a string
Message-Id: <61658859C9907CCA.CED97DDF313FD060.CD15DC7094F9B533@lp.airnews.net>
"Frank Miller" <no@email.com> wrote:
: > How about:
: > $note =~ s/\015\012/[br]/;
: > --
: > Bob Walton
:
: Nope, that didn't work...
It worked fine on a windoze system:
my $note = "The quick brown fox\r\njumped over the hedge.\n";
$note =~ s/\015\012/[br]/;
print $note;
output:
The quick brown fox[br]jumped over the hedge.
Can you show us your value for $note?
:
: FrankM
:
: "Bob Walton" <bwalton@rochester.rr.com> wrote in message
: news:3A8F1F5B.CA3E24E9@rochester.rr.com...
: > Frank Miller wrote:
: > >
: > > OK, before anyone flames me, I've read the FAQ, I've also spent the
last
: two
: > > hours on the web trying to find the answer...
: > >
: > > I have a string that contains at CRLF (0x0d, 0x0a) in it, I'd like to
: > > replace that with [br]. How do I do this? I've tried:
: > >
: > > $note =~ s/\x0D\x0A/\[br\]/m;
: > > $note =~ s/\n/\[br\]/m;
: > > $note =~ s/[\x0D\x0A]\[br\]/m;
: > > $note =~ s/$/\[br\]/m;
: > >
: > > and just about everything else I can think of...
: > >
: > > FrankM
: > How about:
: > $note =~ s/\015\012/[br]/;
: > --
: > Bob Walton
:
:
------------------------------
Date: Sat, 17 Feb 2001 22:39:39 -0800
From: "David Akers" <David@TheAkers.com>
Subject: use Net::FTP; fails
Message-Id: <3a8f6e51@news.dsldesigns.com>
I have a perl script that does some HTML parsing then posts the page to a
web server using FTP.
On my development machine (using activestate perl) it works fine
On my production server the use statement fails. I built both machines and
perl installs, and they are
identical. (Windows '98, Apache, Activestate Perl) -- Yes, I know windows
'98 and production are
mutually exclusive...
I imagine I have a problem with the perl install or the .om module in
question.
I am not sure if I need to look for Net.pm (thinking the ::FTP is a parm) or
if I am looking for FTP.pm
The following script will fail
#!c:/perl/bin/perl.exe
use Net::FTP;
Any thoughts will be most helpful.
David
------------------------------
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 V10 Issue 309
**************************************