[11022] in Perl-Users-Digest
Perl-Users Digest, Issue: 4622 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 11 19:07:18 1999
Date: Mon, 11 Jan 99 16:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 11 Jan 1999 Volume: 8 Number: 4622
Today's topics:
Re: "Email this page to a friend" script (Abigail)
Re: "Email this page to a friend" script (K. Krueger)
Re: "internal server error" (Abigail)
Re: "internal server error" (Abigail)
Re: Browser History with Perl (Abigail)
cgi - log and html re: <heli@vossnet.de>
Help with perl creating an xbm <zerocool@montana.campus.mci.net>
Re: How can I compare two arrays? <aqumsieh@matrox.com>
Re: how to greb whole words only? <aqumsieh@matrox.com>
Re: If Larry Wall's listening out there.... (Joonas Timo Taavetti Kekoni)
Re: new DBD::Sybase package problem <clerke@emirates.net.ae>
Re: newbee sort question (Abigail)
Re: newbie (Abigail)
parsing URL query strings geoff@logix.com
Re: parsing URL query strings <dgris@moiraine.dimensional.com>
Re: Perl Criticism (Craig Berry)
Re: Perl Criticism droby@copyright.com
Re: Perl Criticism <jeromeo@atrieva.com>
Re: Perl Criticism droby@copyright.com
Re: Perl Criticism <dropzone@mail.utexas.edu>
Re: Perl Criticism (Abigail)
Re: Perl within Perl dhosek@webley.com
Re: Perl within Perl (Abigail)
Re: Perl within Perl (Abigail)
Re: PGP system call (Abigail)
Re: Problem compiling perl script (Abigail)
Re: rounding <aqumsieh@matrox.com>
split not working... <kwoody@citytel.net>
Re: split not working... (Bart Lateur)
Re: subbing data into <IMG variable (Abigail)
Re: Trying to find day of week from date <michael_mongeau@stratus.com>
Re: uncuddled else? (Abigail)
Re: unpack?? Or how to extract binary data written by C <pixel_@geocities.com>
Re: using Perl as a telnet "shell" <bsh@rainey.blueneptune.com>
Re: Verify an email address (Martien Verbruggen)
Re: Verify an email address <due@murray.fordham.edu>
Re: Verify an email address (Abigail)
What is $1 ??? <r.partridge@dewynters.com>
Re: What is $1 ??? (I R A Aggie)
Re: Why doesn't it work? (Abigail)
Re: Yet another REGEX question <pixel_@geocities.com>
Re: Yet another REGEX question (John Moreno)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jan 1999 16:56:30 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "Email this page to a friend" script
Message-Id: <77dafu$q00$3@client3.news.psi.net>
Christopher Schulte (usenet@schulte.org) wrote on MCMLVII September
MCMXCIII in <URL:news:369dbce8.258308513@news.schulte.org>:
:: Does anyone know of a script that will allow a website user to:
::
:: 1) be viewing a specific html file
:: 2) click on a link that says "email this page to a friend"
:: 3) enter their address, the friend's, and possibly a message
:: 4) have the page be sent to the specified person, with a static
:: message added to the end of the email
<blink>Download Netscape Now</blink>
Abigail
------------------------------
Date: 11 Jan 1999 15:42:10 -0800
From: kirbyk@best.com (K. Krueger)
Subject: Re: "Email this page to a friend" script
Message-Id: <77e28i$sp3$1@shell2.ba.best.com>
In article <77dafu$q00$3@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Christopher Schulte (usenet@schulte.org) wrote on MCMLVII September
>MCMXCIII in <URL:news:369dbce8.258308513@news.schulte.org>:
>:: Does anyone know of a script that will allow a website user to:
>::
>:: 1) be viewing a specific html file
>:: 2) click on a link that says "email this page to a friend"
>:: 3) enter their address, the friend's, and possibly a message
>:: 4) have the page be sent to the specified person, with a static
>:: message added to the end of the email
>
><blink>Download Netscape Now</blink>
>
IE also has this capability - under File->Send->Page by Email.
This is really not the kind of thing you should spend your coding time
reinventing.
--
Kirby Krueger O- kirbyk@best.com
<*> "Most .sigs this small can't open their own jump gate."
------------------------------
Date: 11 Jan 1999 16:49:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "internal server error"
Message-Id: <77da32$q00$2@client3.news.psi.net>
Eirik Johansen (webpages@email.com) wrote on MCMLVII September MCMXCIII
in <URL:news:36973E3A.882879A2@email.com>:
() The suggestion from Eugene Sotirescu worked. Thank you so much! Also thank to
() James Ludlow who gave me a lot of advice. But I also have a simple(?) question. Is
() it possible to have to different operating systems on a PC (win95 AND Linux). And
() isn't Linux really hard to use?
No, Linux isn't hard to use, but no doubt it's way beyond your capabilities.
[ 184 lines of needless quoting ]
You are totally clueless. Go away.
Abigail
------------------------------
Date: 11 Jan 1999 16:47:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "internal server error"
Message-Id: <77d9ul$q00$1@client3.news.psi.net>
Eirik Johansen (webpages@email.com) wrote on MCMLVI September MCMXCIII in
<URL:news:36967E5C.733626E0@email.com>:
''
'' Abigail: What's your problem? Did you actually read my posting? The first
'' line goes something like this: "I've just started learning Perl..." Did it
'' ever occur to you that I either know what "-w" "use strict" or modules are
'' nor do I know how to use them. I'm supposing that modules are some pre-made
'' scripts since you say they are "made by people with a clue".(It's probably
'' not!) Well, you obviously didn't read the rest of the the first sentence,
'' cause it goes something like this: "...and I recently modified a CGI-script"
Buy a book and read it.
'' And did it ever occour to you that I might want to "have a clue" myself
'' someday? And the only way to leraning this, is by doing it myself !
'' I'm eager to learn CGI-scripting - so what if I "don't have the appropriate
'' environment to test my work with."? I want to learn it just the same, and I
'' will too, you'll see. And that I didn't give you an error message. The only
'' error message I can give is in the subject line, you see THAT'S THE PROBLEM.
Then you have to configure your server to give you the error message.
Get the Apache server, it will log the error message by default. Of
course, if you can neither configure the server, nor are able to grasp the
concept of actually reading a book about the language before modifying a
program written in that language, nor have access to the OS the program
is running on, one has the wonder why you are doing this. What's next?
Trying to paint your house while being locked out and blindfolded?
'' If I had an error msg, I would've worked out the problem myself.
Then see to it that you get the error message. Djees.
Abigail
------------------------------
Date: 11 Jan 1999 17:42:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Browser History with Perl
Message-Id: <77dd6h$qoa$1@client3.news.psi.net>
Bob Tate (btate@primary.net) wrote on MCMLVIII September MCMXCIII in
<URL:news:36991a93.0@news.primary.net>:
<> Looking for a way to view the browser history with Perl so that I can see
<> the last page visited before getting to my page.
Since you don't give any information about your browsing situation,
I propose 'open MEM, "/dev/mem" or die $!;' and start from there.
Abigail
------------------------------
Date: Mon, 11 Jan 1999 22:59:09 +0100
From: henning lind <heli@vossnet.de>
Subject: cgi - log and html re:
Message-Id: <369A742D.51180716@vossnet.de>
hi!
i just start learning perl _again_. so i thought starting with an easy
script that logs visitors on a nt-server, checking out my site (via
browser and cgi..).
the log-part works well - the giving back html-part to mozilla also
works well - as long as i don't use any var's like HTTP_USER_AGENT,
REMOTE_HOST. etc. then i get one of these _document contains no data_
cgi errors :( am i just too stupid or does it just work on an unix-sys?
here is the source and i marked the part where it breaks down:
#!c:\perl\bin\Perl.exe -w
require("Cgi-Lib.PL");
&ReadParse;
do log();
do html();
exit;
#########
sub log {
#########
$datei = "heli_main.txt";
open(l, ">>$datei");
print l
"------------------------------------------------------------\n";
# error must be in the following line
print 1 "$ENV{HTTP_USER_AGENT}\n";
print l
"------------------------------------------------------------\n";
close(l);
}
##########
sub html {
##########
print "Content-type: text/html\n\n";
print "<html><head><title>bla</title></head><body bgcolor=\#ffffff>\n";
print "text - bla bla";
print "</body></html>\n";
}
--
jon_doe@stones.com
------------------------------
Date: Mon, 11 Jan 1999 14:59:54 -0700
From: Tech-No <zerocool@montana.campus.mci.net>
Subject: Help with perl creating an xbm
Message-Id: <369A745A.1C0C@montana.campus.mci.net>
I have the following code that works fine to output 0-9 in black, I now
need to know how to change my @gened to get it ouput in white numbers
instead
# Sub: Make an x-bitmap image of the count
sub makeXbm
{
($printTtl,$digits,$XBM) = @_;
$printTtl = substr ($printTtl,0);
$pad = $digits - length ($printTtl);
$xbmWidth = $digits * 16;
for ($x=0; $x<$digits; $x++)
{ if ($x<$pad) { $printTtl = "0".$printTtl; }
push @xbmNbr, substr ($printTtl,$x,1);
}
# assign bitmap byte octals for numbers 0..9 to list of lists
@gened = (
['00','00','e0','07','f0','0f','30','0c','30','0c','30','0c','30','0c','30','0c',
'30','0c','30','0c','30','0c','30','0c','30','0c','f0','0f','e0','07','00','00'],
['00','00','80','01','c0','01','e0','01','80','01','80','01','80','01','80','01',
'80','01','80','01','80','01','80','01','80','01','e0','07','e0','07','00','00'],
['00','00','e0','07','f8','1f','18','18','18','18','18','1c','00','0e','00','07',
'80','03','c0','01','e0','00','70','00','38','00','f8','1f','f8','1f','00','00'],
['00','00','f0','07','f0','0f','30','0c','00','0c','00','0c','00','0c','c0','0f',
'c0','0f','00','0c','00','0c','00','0c','30','0c','f0','0f','f0','07','00','00'],
['00','00','00','06','00','0f','80','0f','c0','0d','e0','0c','70','0c','f0','0f',
'f0','0f','00','0c','00','0c','00','0c','00','0c','00','0c','00','0c','00','00'],
['00','00','e0','0f','f0','0f','30','00','30','00','30','00','30','00','f0','07',
'e0','0f','00','0c','00','0c','00','0c','30','0c','f0','07','e0','03','00','00'],
['00','00','20','00','30','00','30','00','30','00','30','00','30','00','f0','07',
'f0','0f','30','0c','30','0c','30','0c','30','0c','f0','0f','e0','0f','00','00'],
['00','00','f0','0f','f0','0f','30','0c','30','0c','00','06','00','03','00','03',
'80','01','80','01','c0','00','c0','00','60','00','60','00','60','00','00','00'],
['00','00','e0','07','f0','0f','30','0c','30','0c','30','0c','60','06','c0','03',
'c0','03','60','06','30','0c','30','0c','30','0c','f0','0f','e0','07','00','00'],
['00','00','e0','07','f0','0f','30','0c','30','0c','30','0c','e0','0f','c0','0f',
'00','0e','00','0e','00','07','80','03','c0','01','e0','00','60','00','00','00'],
);
# create image file of printTtl
open (XBM,">$XBM");
flock (XBM,2); seek (XBM,0,0);
print (XBM "#define hit_width $xbmWidth\n");
print (XBM "#define hit_height 16\n");
print (XBM "static char hit_bits[] = {\n");
for ($y=0; $y<=30; $y=$y+2)
{ foreach $x (@xbmNbr)
{ print (XBM "0x$gened[$x][$y],0x$gened[$x][$y+1],");
}
print (XBM "\n");
}
print (XBM "};\n");
truncate (XBM,tell(XBM)); close (XBM);
} # end makeXbm
1; # return true
------------------------------
Date: Mon, 11 Jan 1999 13:00:36 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How can I compare two arrays?
Message-Id: <x3yvhid4rln.fsf@tigre.matrox.com>
"Allan M. Due" <due@murray.fordham.edu> writes:
>
> cgi@higherlove.com wrote in message
> <36980967.32296180@news.phnx.uswest.net>...
> |I've been cracking the books and poring over code trying to figure
> |this out, but I can't find ANYTHING!
The following entry in perlfaq4 might help you:
How do I compute the difference of two arrays? How do I
compute the intersection of two arrays?
> |If I have two arrays
> |@a which consists of the words "here", "i", and "am"
> |@b which consists of the words "do", "i", and "too"
> |
> |How can I run some type of "for each" routine that compares each item
> |in @a to each item in @b and then exit when a match is found?
>
>
> Well, how about:
>
> #!/usr/local/bin/perl -w
> use strict;
> my @a = qw(here i am);
> my @b = qw(do i too);
> my $i=0;
>
> foreach (@a) {
> if ($a[$i] eq $b[$i]) {print "match of $a[$i] with $b[$i] at $i."; last}
> $i++;
> }
This has a potential problem.
What if @b was shorter than @a, and the two arrays have nothing in
common?
For scalar @b < $i < scalar @a, you will be trying to access an
undefined entry in @b.
Modify to:
my $end = scalar @b < scalar @a ? scalar @b : scalar @a;
for (0..$end) {
(print "MATCH $a[$_] at $_.\n" and last) if $a[$_] eq $b[$_];
}
PS. all the scalar()'s above aren't really necessary. But they make
things a bit clearer.
Ala
------------------------------
Date: Mon, 11 Jan 1999 13:48:23 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: how to greb whole words only?
Message-Id: <x3ysodh4pe0.fsf@tigre.matrox.com>
pigs_can_fly@mindless.com (Jason Q.) writes:
>
> Currently, now I'm using:
>
> @results = grep(/"God"/,@database);
>
> How do I grep whole words only?
Depending on your aim, you might need:
@results = grep { /\bGod\/ } @database;
------------------------------
Date: 11 Jan 1999 22:40:24 GMT
From: jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni)
Subject: Re: If Larry Wall's listening out there....
Message-Id: <77duko$hgk$1@news.cs.hut.fi>
Andrew Mayo (andrew@geac.co.nz) wrote:
: Those of us working in a Windows environment generally will use notepad as a
: text editor. Simple-mindedly, notepad does *not* display line numbers. (it
: also doesn't do brace matching, but this I can live with)
My wool socs are bad, since my soes don't fit when i wear them.
<offensive>
Is my dick ovesized, becouse i can't fit my other testicle inside a condom?
</offensive>
No offence but if installation of editor is too hard for you i recommend
some other career/hobby that programming...
PS.
Tree letters you can trust "pfe".
--
_- Joonas Kekoni OH2MTF I -_
_-internet: jkekoni@cc.hut.fi I DO NOT EAT. -_
_-slowmail: j{mer{ntaival 7a176 I -_
_- 02150Espoo I It is a monitor -_
_- Finland/Europe I -_
------------------------------
Date: Tue, 12 Jan 1999 02:49:18 +0400
From: "wayne clerke" <clerke@emirates.net.ae>
Subject: Re: new DBD::Sybase package problem
Message-Id: <77dv5p$e0c$1@nntp.or.nw.verio.net>
Michael Peppler <mpeppler@mbay.net> wrote in message
news:369A1A68.45A5C5BA@mbay.net...
>wayne clerke wrote:
>>
>> anyone seen this with 509 and the new DBD::Sybase package?
>> It all worked in previous versions and other modules install ok with 509.
>>
>> PPM> install DBD-Sybase
>> Error installing package 'DBD-Sybase': Couldn't open D:\TEMP/DBD-Sybase/
for
>> writing
>>
>
>This looks like a problem with the ppm.pl program. YOu should contact
>ActiveState about this.
Done. The ppd package file has an empty CODEBASE reference and this looks
like it causes the problem.
>
>Michael
>--
>Michael Peppler -||- Data Migrations Inc.
>mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler
>Int. Sybase User Group -||- http://www.isug.com
>Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: 11 Jan 1999 17:49:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbee sort question
Message-Id: <77ddie$qoa$2@client3.news.psi.net>
lexing (lexing@ibm.net) wrote on MCMLVI September MCMXCIII in
<URL:news:3696127C.FFE7CB43@ibm.net>:
;;
;; (or a hash for it.)
;; and i have to sort the 5 variables to the assosciated numbers and give
;; those variable in the sorted order like this:
;;
;; i know that the solution must be very simple but i can't find how i can
;; do this.
FAQ
Abigail
------------------------------
Date: 11 Jan 1999 17:50:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie
Message-Id: <77ddki$qoa$3@client3.news.psi.net>
Ron Spisak (bigsalmon@sprynet.com) wrote on MCMLVII September MCMXCIII in
<URL:news:776eic$qns$1@juliana.sprynet.com>:
[] I am new to programming, I was hoping that some here could help me. I am
[] looking for a GOOD wbe site to down-load perl manual(s) from. PLEASE emai
The manuals come with Perl.
[] me, as I DO NOT monitor the news group. E-mail me at bigsalmon@sprynet.com
Well, that just means the answer wasn't really important to you.
Oh well.
Abigail
------------------------------
Date: Mon, 11 Jan 1999 21:58:21 GMT
From: geoff@logix.com
Subject: parsing URL query strings
Message-Id: <369a73cd.6021135@area1.news.internex.net>
Anyone know how I can parse a query string passed to my script via a
link??
Thanks Geoff
------------------------------
Date: 11 Jan 1999 15:24:29 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: parsing URL query strings
Message-Id: <m3iued1m8y.fsf@moiraine.dimensional.com>
geoff@logix.com writes:
> Anyone know how I can parse a query string passed to my script via a
> link??
Nope, nobody here knows how to do that. We've all been working
on it, but nothing we've tried works.
If you make some progress, be sure to let us know. We'd all
be terribly, terribly excited.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 11 Jan 1999 22:05:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl Criticism
Message-Id: <77dsjb$di3$1@marina.cinenet.net>
Michael D. Schleif (mds-resource@mediaone.net) wrote:
: Yes, a single, discrete element can also be a subset of a set of
: elements.
No it can't; it can be a member (perhaps the only member) of a subset,
however.
: Yes, perhaps the parentheses are more grammatically correct.
:
: Nevertheless, I continue to fail to see the point of such discrimination
: -- to what end?
People naturally categorize; it's a good strategy for organizing the
world, so you don't have to start reasoning about every new thing you
encounter from scratch. I see a plant, and I know a few default things
about it -- likely to have leaves, likely to have roots, may be edible,
may provide building/craft material, and so forth. If I see a desert
plant, I add "may have spines or sharp parts," and thus handle it
carefully. The fact that I might needlessly shy away from grabbing a
cottonwood branch is well repaid by avoiding hugging a cholla. :)
Similarly, fuzzy concepts like "scripting language" allow us to reason
about languages about which we know almost nothing. The danger is that we
may draw false conclusions, or misclassify languages, but again,
categorization works because/when it's right more often than not.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "The hills were burning, and the wind was raging; and the
clock struck midnight in the Garden of Allah."
------------------------------
Date: Mon, 11 Jan 1999 21:59:42 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <77ds8e$ccp$1@nnrp1.dejanews.com>
In article <778jml$1b7$1@nnrp1.dejanews.com>,
topmind@technologist.com wrote:
> In article <yzhsbtk9y2xj.fsf@netcom15.netcom.com>,
> UG <mcampbel@netcom.com> wrote:
> > topmind@technologist.com writes:
> >
> > > >> What I'm saying is the leeky approch is the correct one, you may not
> > > like it but it is so usefull that it is neccery. <<
> > >
> > > Correct One!????
> > > Show me an example of where it is so indespensable!!!
> >
> > $counter = $index = $how_many_have_I_seen = 0;
> >
>
> How about this for initialization:
>
> Store 0 to counter, index, how_many, etc.
>
> It comes from a real language.
>
> It can even be done with a function.
>
> Init(0, counter, index, how_many, etc.)
>
> (How to process an infinite number of parameters
> makes for some interesting thinking.)
>
> No need to introduce leaky assigments and their related
> headaches to initialize stuff.
>
If you insist on not using the so-called leaky assignment for variable
initialization, why not just do the obvious?
$counter = 0;
$index = 0;
$how_many_have_I_seen = 0;
But this entire question is rather inane. What you insist on thinking of as
an "assignment statement" is, in C and its derivatives/borrowers, an
"assignment expression". The "=" is an operator. As "a = b' is an
expression, it has a value. If you use that expression as the RHS of another
assignment, the value gets assigned. It is NOT leakage.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 11 Jan 1999 14:01:52 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Perl Criticism
Message-Id: <369A74D0.62790598@atrieva.com>
Charles R. Thompson wrote:
>
> >> >> Example #2, for instance. I have written
> >> mission critical military applications<<
>
> use COFFEE::Filter
If you only knew! However, I recomend this to filter out the lifers.
if(is_girly_man()){
my @condiments=('sugar','milk')
addcondiments(@condiments);
}else{
$chesthair = THICK;
}
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Mon, 11 Jan 1999 22:26:36 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <77dtqq$dtc$1@nnrp1.dejanews.com>
In article <775hso$fs9$1@nnrp1.dejanews.com>,
topmind@technologist.com wrote:
>
> The type of OS people work on depends mostly on circumstances
> not controlled by them. Since it is tough to switch sub-specialties
> in IT, most end up using what their college or first employer
> used. Therefore, I see no mechanism in place to filter or separate
> idiots into Windows instead of Unix.
>
Nonsense. My college had a Univac 1108, and taught me Fortran, APL, Algol and
Snobol. I have used none of these professionally.
I have had no difficulty with moving around among several operating systems,
programming languages and network protocol stacks.
But then of course, I do pre-date both Microsoft and Unix.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 11 Jan 1999 17:04:54 -0600
From: Forrest Reynolds <dropzone@mail.utexas.edu>
Subject: Re: Perl Criticism
Message-Id: <369A8396.A75FF78@mail.utexas.edu>
I don't know of any language out there that can stop someone from writing
spaghetti code if they want to. To broaden the analogy, English has been in
use far longer than Perl and still it gets abused, sometimes in beautiful ways
(e.g. Ulysses).
> Comprehension is not my major complaint. Abusability is.
> You should have known that if you have been following.
> Programmers are not altruistic--they don't give flying
> fudge about who has to maintain and fiquire out their
> software. Therefore, the language has to protect the
> future because programmers wont.
A language protecting the future? That sounds pretty interesting--- good short
story material. Perhaps your energy is misplaced.
Forrest
> -tmind-
> http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Jan 1999 18:10:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Criticism
Message-Id: <77depv$qoa$4@client3.news.psi.net>
topmind@technologist.com (topmind@technologist.com) wrote on MCMLVII
September MCMXCIII in <URL:news:778hoh$vom$1@nnrp1.dejanews.com>:
<>
<> Writing code that the next guy cannot figure out is not "productivity".
<> It may make the original programmer LOOK good and the
<> followon guy LOOK back, but that is superficial productivity.
This is a very old argument.
Many moons ago, the following was said in this group:
> You can program badly in any language (even Pascal if you try hard enough).
> [Nick Kew in `nascent FMTEYWTK on OO Perl vs C++']
Abigail
------------------------------
Date: Mon, 11 Jan 1999 20:56:58 GMT
From: dhosek@webley.com
Subject: Re: Perl within Perl
Message-Id: <77doio$93d$1@nnrp1.dejanews.com>
In article <77d4l2$mac$1@nnrp1.dejanews.com>,
backslashxt@yahoo.com wrote:
> In article <3699EFB5.ABEF1351@marvin.informatik.uni-dortmund.de>,
> Sascha Kimmel <kimmel00@marvin.informatik.uni-dortmund.de> wrote:
> > backslashxt@yahoo.com wrote:
> > > In article <3697D23C.6ABF927C@snailgem.org>,
> > > Eugene Sotirescu <eugene@snailgem.org> wrote:
> > > > backslashxt@yahoo.com wrote:
> > > > > The call I'm using:
> > > > > print "<!--\#exec cgi=\"/cgi-bin/topad.cgi\"--> \n"; (Calls
> banner)
> > > > >
> > As far as I know a server only parses .html (or sometimes only .phtml
> > or.shtml) files, so if you let a perl script print that onto the page,
> > it does not become interpreted by the SSI parser.
> > Why don't you simply include the source code which implements the banner
> > in the script which now is writing the ssi line on the page?
> I'm not quite sure what you mean by why don't i just implement the source code
> in the ssi line on the page? I can't include the actual script on the page
> because it's a perl script. As for the ssi interpreter not reading it, I think
> your right on that. Can you please send via email or post how you implemented
> this on your website?
OK, the first thing that I'd try is changing the content-type header to
parsed-html from html and see if that does the job.
If that doesn't work, then what you could do is open the SSI script from the
CGI script, along the lines of open (SSI, "scriptname|"); # Your turn to
code: Gobble the content header and blank line
# My turn to code: Copy the rest of it straight to output
print while <SSI>;
close(SSI);
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Jan 1999 18:42:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl within Perl
Message-Id: <77dgnf$riu$1@client3.news.psi.net>
backslashxt@yahoo.com (backslashxt@yahoo.com) wrote on MCMLVII September
MCMXCIII in <URL:news:778emg$t7g$1@nnrp1.dejanews.com>:
##
## The call I'm using:
## print "<!--\#exec cgi=\"/cgi-bin/topad.cgi\"--> \n"; (Calls banner)
This isn't a Perl question. Fix your server configuration; in the
appropriate server group you can find help.
Abigail
------------------------------
Date: 11 Jan 1999 18:45:24 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl within Perl
Message-Id: <77dgs4$riu$2@client3.news.psi.net>
Sascha Kimmel (kimmel00@marvin.informatik.uni-dortmund.de) wrote on
MCMLIX September MCMXCIII in <URL:news:3699EFB5.ABEF1351@marvin.informatik.uni-dortmund.de>:
||
|| As far as I know a server only parses .html
Of course not. The server only parses what you tell it to parse. Don't be
a slave to your servers default settings! RTFM and configure it. And go
ask about servers somewhere else. rec.antartic.palmtrees for instance.
Abigail
------------------------------
Date: 11 Jan 1999 18:46:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: PGP system call
Message-Id: <77dgtk$riu$3@client3.news.psi.net>
Forrest Reynolds (dropzone@mail.utexas.edu) wrote on MCMLVI September
MCMXCIII in <URL:news:36968B31.1EE9A09D@mail.utexas.edu>:
**
** system "/local/trew/.pgp/pgp -f +batch -z $pass < $temp >> $perm";
**
** Can anyone explain to me what these parms are:
** -f, -z, +batch, and maybe a little about how this works
RTFM. The PGP manual that is. This is not at all a Perl question.
Abigail
------------------------------
Date: 11 Jan 1999 18:47:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Problem compiling perl script
Message-Id: <77dh0m$riu$4@client3.news.psi.net>
Michelle Looi (lylooi@ncs.com.sg) wrote on MCMLIX September MCMXCIII in
<URL:news:3699FC49.5F282ABC@ncs.com.sg>:
// Hi Everyone,
// Currently I have install perl v 5.005_02 in my machine and use it to
// help me to compile my perl script into a binary format . I have try to
// compile a normal perl script without using "require '...'" (eg require
// 'cgi-lib.pl') it works fine. However, when I compile a perl script
// which use the "require 'cgi-lib.pl' it will give me compilation error.
There must be a bug in line 17.
Abigail
------------------------------
Date: Mon, 11 Jan 1999 13:45:50 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: rounding
Message-Id: <x3yu2xx4pia.fsf@tigre.matrox.com>
Tom Cruce <tom@vitesse.com> writes:
>
> Whats the best way to to round a floating point scalar into an integer ?
> I've looked around for a function
> to do this, but I can't seem to find one. Any ideas ?
check out perlfaq4:
Does perl have a round function? What about ceil() and
floor()? Trig functions?
------------------------------
Date: Mon, 11 Jan 1999 14:29:23 -0800
From: Keith Woodworth <kwoody@citytel.net>
Subject: split not working...
Message-Id: <Pine.BSI.3.95.990111141907.11367A-100000@rosencrantz.citytel.net>
Need some fresh eyes on this: split does not seem to be splitting.
Part of what I'm trying to split:
wtrowell 431
wwscpr 13
wylie 58
xwiselan 4
ykangas 1
ymurland 33
yoshi 3
youth 38
zapco 1
zog 820
Code I'm using:
#!/usr/local/bin/perl5 -w
use diagnostics;
$user="kwoody";
open(FILE,"kwoody.test") || die "File $!\n";
@_ = <FILE>;
close(FILE);
@_ = grep(/$user/,@_);
print "@_, $user";
($user_name, $total_mins) = split(/\s+/);
print "$user_name, $total_mins";
I have something very similar to the above in another program and it
works. Any reason why this wont? BAsically it prints out whats in @_ and
$user then after it splits (or doesnt) the next print just gives me a ,
I'm thinking is the format of the file I"m trying to split. Ive tried
changing the format of the kwoody.test file to be nicely lined up and
formated via a sprintf. Ive tried putting in a | char and split on that
but it doesnt work either. I even tried escaping the | char thinking it
might be reserved.
Anyone help on this?
Thanks,
Keith
kwoody@citytel.net
------------------------------
Date: Mon, 11 Jan 1999 23:05:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: split not working...
Message-Id: <369a826d.4224885@news.skynet.be>
Keith Woodworth wrote:
>@_ = grep(/$user/,@_);
>print "@_, $user";
>($user_name, $total_mins) = split(/\s+/);
>print "$user_name, $total_mins";
>
>I have something very similar to the above in another program and it
>works. Any reason why this wont?
Because @_ isn't $_ .
What do you want, to split one line, or to split each line? I guess the
second, but what do you want to do with all the results? You only have
room for one.
This should get you started (although I personally don't like the use of
@_ if not to pass parameters in a sub):
@_ = grep(/$user/,@_);
foreach(@_) {
($user_name, $total_mins) = split/\s+/;
print "$user_name, $total_mins\n";
}
Bart.
------------------------------
Date: 11 Jan 1999 23:04:36 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: subbing data into <IMG variable
Message-Id: <77e024$4cm$1@client3.news.psi.net>
A Melton (melton@diagdata.com) wrote on MCMLVIII September MCMXCIII in
<URL:news:3698D7A9.E56873E7@diagdata.com>:
:: Have a datafile:source.dat containing:
:: 12327214673
:: 76576576576
:: 78787878788
::
:: What kind of script to write to automatically substitute
:: these three numbers into the values below after "content"
perl -i -pwe and a substitution.
Abigail
------------------------------
Date: Mon, 11 Jan 1999 16:47:34 -0500
From: "Michael Mongeau" <michael_mongeau@stratus.com>
Subject: Re: Trying to find day of week from date
Message-Id: <77drba$6cu@transfer.stratus.com>
Thomas Merlin <antispam@antispam.com> wrote in message
news:369A4035.41561C2@antispam.com...
>Hello,
>
>I'm trying to find which day matches a date.
>Example : I have 01/07 in a text file I'm parsing, I'd like to get the
>information that that date is a Thursday.
Take a look at the Date::Calc module on CPAN. I has many date/time
routines, including what you're looking for.
Michael Mongeau
------------------------------
Date: 11 Jan 1999 23:10:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: uncuddled else?
Message-Id: <77e0e3$4cm$2@client3.news.psi.net>
Bart Lateur (bart.lateur@skynet.be) wrote on MCMLVIII September MCMXCIII
in <URL:news:3698c6cf.10441242@news.skynet.be>:
||
|| The "uncuddled" version says something like:
||
|| IF ...
|| ...
|| ENDIF
|| ELSE
|| ....
|| ENDIF
||
|| which is nonsense.
That's indeed nonsense, and it doesn't mean something like that.
IF .... THEN
....
ENDTHEN
ELSE
....
ENDELSE
and you might have some point.
My preference is the ALGOL like:
IF ....
THEN
....
ELSE
....
FI
But alas....
Abigail
------------------------------
Date: 11 Jan 1999 22:32:18 +0100
From: Pascal Rigaux <pixel_@geocities.com>
Subject: Re: unpack?? Or how to extract binary data written by C++.
Message-Id: <4wsodha42l.fsf@dre2.polytechnique.fr>
>struct Thing {
> unsigned long arg1;
> unsigned long arg2;
> unsigned short arg3;
>};
>open( . . . .)
>seek(FILE,somewhere,0);
>read(FILE, $buffer, $size_of_Thing);
simply
($arg1, $arg2, $arg3) = unpack "LLS", $buffer;
L = unsigned long
S = unsigned short
cf perlfunc(1)
Pixel.
------------------------------
Date: 11 Jan 1999 23:46:49 GMT
From: brian hiles <bsh@rainey.blueneptune.com>
Subject: Re: using Perl as a telnet "shell"
Message-Id: <77e2h9$qqv$2@remarQ.com>
In comp.unix.shell Big Jim <big.jim@no.spam.here.thanks.com> wrote:
> Possibly I could use the telnet facility in Perl to get some use
> out of my last two months' sub?
CPAN has many modules to interface with Usenet. Go to:
http://www.cpan.org/modules/by-module/News
-Brian
------------------------------
Date: Mon, 11 Jan 1999 22:18:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Verify an email address
Message-Id: <NMum2.68$Ax2.2245@nsw.nnrp.telstra.net>
In article <77cn1l$m35$0@206.165.165.138>,
"Allan M. Due" <due@murray.fordham.edu> writes:
>|m{
>| ^ # match from start of string
gone is my careful formatting :)
>|The plus that I believe you think is in the wrong place, is marked
>|with (*) above. It is in the correct place.
>
> Correct placing but unnecessary?
Not entirely, but yes.
>|What is missing is a plus
>|in the constuct marked with a (+) above. It should read [\w.-]+\.
>|>
>|> works:
>|> /^[\w.-]+\@[\w.-]+\.\w+$/
>
>|
>|But this will fail on simple email adresses like foo@bar.bar.com.au,
>|because it only matches the [\w.-]\. once. You need to allow it to
>|match more than once, by grouping it, and adding a '+'
> Umm, it doesn't seem to fail for me. If you will note, in the
> original post the + is moved so it is after the [\w.-] and before
> the \. and it is greedy so the regexp matches. Because it is greedy
> we don't need the + after the parens even if they are included.
> Including the ():
You are correct. It matches, but not in the way it should. My regexp
corrections were almost correct, but you'll have to take out the .
from the second character class. I had mentally done that, but failed
to do it in the examples. Mea culpa.
/^[\w.-]+\@([\w-]+\.)+\w+$/
The above is a more controlled regexp. The part between the brackets
matches the 'foo.' or 'bar.' part of a host or domain name. The last
bit matches the country specifier, or for the us,. the com, gov, etc
stuff.
While both will match correctly formatted ones, mine will reject more
incorrectly formatted ones (like user@foo...bar.com)
> I was just kind of interested because it works fine, with no
> warnings under -w and use strict if you don't escape the @. Good
> practice would seem to indicate the use of the escape but I was just
> curious.
Let me qualify the 'yes' a bit more. You are free to not backwack it
in many cases. However, if you do, you will have to be aware that
stuff in the re can be an expression. If the @ is followed by anything
that makes it a valid perl array, then extrapolation will happen.
Since many things can make it a valid perl array, I would never advise
anyone to leave it unescaped.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In the fight between you and the world,
Commercial Dynamics Pty. Ltd. | back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: 11 Jan 1999 22:53:27 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Verify an email address
Message-Id: <77dvd7$e5b$0@206.165.165.137>
Martien Verbruggen wrote in message ...
|In article <77cn1l$m35$0@206.165.165.138>,
| "Allan M. Due" <due@murray.fordham.edu> writes:
|>|m{
|>| ^ # match from start of string
|
|gone is my careful formatting :)
Sorry, stupid POB newsreader (I am truely a prisoner-long story). I am sure
it was very nice :-).
|
|>|The plus that I believe you think is in the wrong place, is marked
|>|with (*) above. It is in the correct place.
|>
|> Correct placing but unnecessary?
|
|Not entirely, but yes.
|
|>|What is missing is a plus
|>|in the constuct marked with a (+) above. It should read [\w.-]+\.
|>|>
|>|> works:
|>|> /^[\w.-]+\@[\w.-]+\.\w+$/
|>
|>|
|>|But this will fail on simple email adresses like foo@bar.bar.com.au,
|>|because it only matches the [\w.-]\. once. You need to allow it to
|>|match more than once, by grouping it, and adding a '+'
|
|> Umm, it doesn't seem to fail for me. If you will note, in the
|> original post the + is moved so it is after the [\w.-] and before
|> the \. and it is greedy so the regexp matches. Because it is greedy
|> we don't need the + after the parens even if they are included.
|> Including the ():
|
|You are correct. It matches, but not in the way it should. My regexp
|corrections were almost correct, but you'll have to take out the .
|from the second character class. I had mentally done that, but failed
|to do it in the examples. Mea culpa.
absolution is yours <g>.
|
|/^[\w.-]+\@([\w-]+\.)+\w+$/
|
|The above is a more controlled regexp. The part between the brackets
|matches the 'foo.' or 'bar.' part of a host or domain name. The last
|bit matches the country specifier, or for the us,. the com, gov, etc
|stuff.
|
|While both will match correctly formatted ones, mine will reject more
|incorrectly formatted ones (like user@foo...bar.com)
a good thing indeed.
|> I was just kind of interested because it works fine, with no
|> warnings under -w and use strict if you don't escape the @. Good
|> practice would seem to indicate the use of the escape but I was just
|> curious.
|
|Let me qualify the 'yes' a bit more. You are free to not backwack it
|in many cases. However, if you do, you will have to be aware that
|stuff in the re can be an expression. If the @ is followed by anything
|that makes it a valid perl array, then extrapolation will happen.
|Since many things can make it a valid perl array, I would never advise
|anyone to leave it unescaped.
Thanks for your input. Edification is always appreciated.
AmD
------------------------------
Date: 11 Jan 1999 23:15:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Verify an email address
Message-Id: <77e0mq$4cm$3@client3.news.psi.net>
Richard Zilavec (rzilavec@titan.tcn.net) wrote on MCMLVIII September
MCMXCIII in <URL:news:369914f6.148149139@199.166.4.3>:
** I need a way to verify that an email address is the correct format,
** this is what I came up with but it doesn't completely work:
**
** $ii =~ /^.+\@.+[(.)](com|net|edu|gov|ca|org)/
You're about a few thousand lines short. Not to mention you don't deal
well with bangpaths. All you say it needs to contain a '@' (which isn't
at the front), followed by string that contains a '(', '.' or ')'
followed by 'com', 'net', 'edu', 'gov', 'ca' or 'org'.
The people in Japan won't be happy with you. Except those from the
many.calories.jp domain.
You might consider reading the FAQ.
Abigail
------------------------------
Date: Mon, 11 Jan 1999 11:12:02 -0000
From: "Richard Partridge" <r.partridge@dewynters.com>
Subject: What is $1 ???
Message-Id: <3699dcba.0@nnrp1.news.uk.psi.net>
Hi,
I'm new to perl and am deciphering some code and have come
across the following snippet of code:
if $things[0] =~/id=([0-9]+)/)
{
$ID=$1;
.
.
is $1 a special scalar? There's no other reference in the script to this
variable so I assume that it's just a null? Does it have anything to do with
Environment variables etc?
All help gratefully received !
Richard :O)
------------------------------
Date: Mon, 11 Jan 1999 18:20:30 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: What is $1 ???
Message-Id: <fl_aggie-1101991820300001@aggie.coaps.fsu.edu>
In article <3699dcba.0@nnrp1.news.uk.psi.net>, "Richard Partridge"
<r.partridge@dewynters.com> wrote:
+ Hi,
+ I'm new to perl and am deciphering some code and have come
+ across the following snippet of code:
+
+ if $things[0] =~/id=([0-9]+)/)
^I think you need a '(' there...
+ {
+ $ID=$1;
+ is $1 a special scalar?
Yes. It is the contents of the match within the '()' in the if line,
in this case, a number I think. Unfortunately, I don't parse regex's
nearly as well as perl...
If there is no match, I would expect $1 to be 'undef'.
James
------------------------------
Date: 11 Jan 1999 23:25:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Why doesn't it work?
Message-Id: <77e18c$4cm$4@client3.news.psi.net>
Martin Harrigan (harrigan@mailexcite.com) wrote on MCMLVII September
MCMXCIII in <URL:news:778p9v$dqs$1@news2.news.iol.ie>:
~~ I'm trying to write a perl script to redirect a user to a page based on the
~~ argument after the ?. Can anyone tell me where I'm going wrong?
You don't use -w. You don't use 'use strict;'. You don't specify
what you expect it to do, and what's happening.
I bet that if you use -w and 'use strict;', Perl will tell you what
goes wrong!
Abigail
------------------------------
Date: 11 Jan 1999 23:05:37 +0100
From: Pascal Rigaux <pixel_@geocities.com>
Subject: Re: Yet another REGEX question
Message-Id: <4wlnj9a2j2.fsf@dre2.polytechnique.fr>
Oups...
Maybe what you wanted is more like :
join ",",
map { /\d+/ ? $_ : "\"$_\"" }
split /\t+/, $_;
Or \d+ replaced by something more complicated (negative, reals...)
Pixel.
------------------------------
Date: Mon, 11 Jan 1999 16:55:40 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Yet another REGEX question
Message-Id: <1dlh7nm.cmkhucz55x8cN@roxboro0-051.dyn.interpath.net>
K.T. <death@N-O-S-P-A-M.solaris1.mysolution.com> wrote:
> Anyone know how to do this?
>
> string1<TAB>string2<TAB>number3<TAB>string4<NEWLINE>
>
> any of the strings or numbers can be not present so it might be <TAB><TAB>
>
>
> convert to
>
> "string1","string2",number3,"string4"<NEWLINE>
>
> Heres what I got so far:
>
> s/\t/\","/g; - converts all tabs to ","
> s/^/\"/; - adds in " at beg of line
> s/\n/\"\n/; - adds in " at end of line
>
> But I cannot figure out how to unquote the number...anyone got any ideas?
$_="string1\tstring2\t-305\tstring4";
s/([^\t]*?)\t([^\t]*?)\t([+-]*\d*?)\t(.*)/"$1","$2",$3,"$4"/;
gives:
"string1","string2","-305","string4"
The newline didn't need to be touched and if you have more than one line
you'll have to add the /g -- other than that this should do just what
you want (note that you'll end up with ,, for the number if it's
absent).
--
John Moreno
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4622
**************************************