[8024] in Perl-Users-Digest
Perl-Users Digest, Issue: 1649 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 15 17:17:15 1998
Date: Thu, 15 Jan 98 14:00:23 -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 Thu, 15 Jan 1998 Volume: 8 Number: 1649
Today's topics:
Apache and PerlIS: How to get together? <thiele@berlin.snafu.de>
Re: Can I create a Linked List in Perl (Andrew M. Langmead)
Re: Can one Use Image Maps? <melton@pitnet.net>
Re: Can one Use Image Maps? <melton@pitnet.net>
Re: Can one Use Image Maps? (brian d foy)
Re: Can one Use Image Maps? (brian d foy)
Re: Could use some perl help! (Tad McClellan)
Re: Critique My Code! (Please) (Tad McClellan)
Re: Critique My Code! (Please) dg50@chrysler.com
Re: Critique My Code! (Please) <jason@primal.ucdavis.edu>
Re: deleting old files (James Amihara)
Re: does anyone know . . . (brian d foy)
Efficiency: for high number indicies, use array or hash <dha@panix.com>
Re: EMTY FILE? (Charles DeRykus)
GLOB HELP <sjenifer@isc.mds.lmco.com>
Re: Location, Redirection (brian d foy)
newbie regex question <bkiefer@hollandhart.com>
Re: newbie regex question (brian d foy)
Re: output as hex (brian d foy)
Pattern match of no character, any character, or space cotal@delphi.com
Re: perl script for deleting text between two markers? (Charles DeRykus)
Re: Printing quote punctuation in strings to e-mail (brian d foy)
Re: Quick Perl tutorial? (brian d foy)
Search Script -Comment please <andrew.spiers@virgin.net>
Re: Simple script for posting data and reading result (brian d foy)
Re: source into binary code <ajohnson@gpu.srv.ualberta.ca>
Re: source into binary code (I R A Aggie)
Re: source into binary code (brian d foy)
Re: Syntax coloring for POD format (Ken)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 15 Jan 1998 21:50:26 +0100
From: Heiko Thiele <thiele@berlin.snafu.de>
Subject: Apache and PerlIS: How to get together?
Message-Id: <34BE7692.718336FF@berlin.snafu.de>
Hi all,
I successfully installed both Perl 5.003_07 Build 315 and Apache 1.3b3
on a Windows NT workstation. Apache has built-in ISAPI support. How do I
configure Apache for NT to support PerlIS (or, at least, Perl by CGI)?
TYIA
Heiko
--
Heiko Thiele
Application Developer
SDC GmbH, Berliner Str. 5, 13467 Berlin, Germany
mailto:h.thiele@sdc.de
phone:[+49] [177] 631 22 66
------------------------------
Date: Thu, 15 Jan 1998 21:49:07 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Can I create a Linked List in Perl
Message-Id: <EMuHxv.78w@world.std.com>
draggs@hawkeye.idx.com writes:
>In answer to the question of 'why?', the answer is that I have a
>flat-file database to write. In C, its a matter of storing each
>record into a linked list of structures.
The perl version would probably be a two dimensional array. (or maybe
a two dimensional hash.)
For example if you take the /etc/passwd file as a flat file database
with lines like:
aml:x:101:101:Andrew M. Langmead:/home/aml:/bin/tcsh
(A colon separated record with the fields being username,password (or
a placeholder if password shadowing is used), uid, gid, gecos, home
directory, and default shell. The username is a unique field in the
database.)
#!/usr/bin/perl -w
open PW, '/etc/passwd' or die "Can't open the password file\n";
while(<PW>) {
chomp;
@record = split /:/;
$data{$record[0]} = [@record]; # each account, keyed by username
}
for $user (@ARGV) {
print "$user: Fullname=$data{$user}[4] home=$data{$user}[5] " .
"shell=$data{$user}[6]\n";
}
or less efficient, but somewhat more C like, as a two dimensional
array:
#!/usr/bin/perl -w
open PW, '/etc/passwd' or die "Can't open the password file\n";
while(<PW>) {
chomp;
@record = split /:/;
push @data, [@record];
}
for $user (@ARGV) {
for ($account = 0; $account < @data; $account++) {
print "$user: Fullname=$data[$account][4] home=$data[$account][5] " .
"shell=$data[$account][6]\n" if $user eq $data[$account][0];
}
}
--
Andrew Langmead
------------------------------
Date: Thu, 15 Jan 1998 15:04:18 -0600
From: EntreprenuerOnline <melton@pitnet.net>
To: "Nathan V. Patwardhan" <nvp@shore.net>
Subject: Re: Can one Use Image Maps?
Message-Id: <34BE79D0.38340970@pitnet.net>
Thanks! Can you tell me where I might find it?
Sincerely,
April
Nathan V. Patwardhan wrote:
> EntreprenuerOnline (melton@pitnet.net) wrote:
> : This may sound like a newbie question but CAN & HOW does one use Image
> : maps in Perl 5 generated pages? I have written several scripts that
> : generate pages but have never tried to incorporate an Image Map. I
>
> There's a CGI::ImageMap module kicking around -- it'll do what you
> want.
>
> --
> Nathan V. Patwardhan
> please don't send spam to president@whitehouse.gov
------------------------------
Date: Thu, 15 Jan 1998 15:31:22 -0600
From: EntreprenuerOnline <melton@pitnet.net>
To: brian d foy <comdog@computerdog.com>
Subject: Re: Can one Use Image Maps?
Message-Id: <34BE8028.A3406146@pitnet.net>
Dear Mr. d foy:
Have you used image maps in your script generated pages? Perhaps you could give a brief
example of what tags might work.
And Please forgive me for sounding uneducated but what is (<BASE>) ? Is it a Tag or a module,
if so where can I get?
Sincerely,
April
brian d foy wrote:
> In article <34BDB3CB.FA8A6931@pitnet.net>, EntreprenuerOnline <melton@pitnet.net> posted:
>
> > This may sound like a newbie question but CAN & HOW does one use Image
> > maps in Perl 5 generated pages?
>
> data are data. perl doesn't care what they are. output any HTML
> that you like, but be aware of that the browser may not be
> resolving references as you think it is when the HTML comes from
> a script (<BASE> can usually fix that up).
>
> good luck :)
>
> --
> brian d foy <http://computerdog.com>
------------------------------
Date: Thu, 15 Jan 1998 16:55:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Can one Use Image Maps?
Message-Id: <comdog-ya02408000R1501981655090001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BE8028.A3406146@pitnet.net>, EntreprenuerOnline <melton@pitnet.net> posted:
>Dear Mr. d foy:
brian is enough. no need for formality.
>Have you used image maps in your script generated pages?
the design department tends to do that sort of thing without
telling me about it, but we've never had a problem if they use
correct HTML.
>example of what tags might work.
see the HTML specs or ask in an HTML forum.
>And Please forgive me for sounding uneducated but what is (<BASE>) ? Is it a Tag or a module,
>if so where can I get?
i usually just type it in myself, but see the preceeding comment.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 16:56:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Can one Use Image Maps?
Message-Id: <comdog-ya02408000R1501981656240001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BE79D0.38340970@pitnet.net>, EntreprenuerOnline <melton@pitnet.net> posted:
>Thanks! Can you tell me where I might find it?
>Nathan V. Patwardhan wrote:
>> There's a CGI::ImageMap module kicking around -- it'll do what you
>> want.
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 14:12:38 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Could use some perl help!
Message-Id: <mjql96.hvc.ln@localhost>
brian d foy (comdog@computerdog.com) wrote:
: In article <EMtq93.6vJ@world.std.com>, yi@world.std.com (Marty Lebowitz) posted:
: > Anyone out there with perl knowledge able to help out by making a minor
: > mod (if its more, we can talk about it!), to an existing routine?
: we can't help you until you explain the modification and post a
: bit of code.
Putting a subject in the Subject: header would be a Good Idea too.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Jan 1998 14:11:41 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Critique My Code! (Please)
Message-Id: <thql96.hvc.ln@localhost>
dg50@chrysler.com wrote:
: Here's a little (heh - it got a little bloated) utility I wrote to strip
: those annoying ^M characters from the ends of files imported from MS/DOG
: or WinDoze.
: Sure, it's overkill, but I'm releasing it into the public domain, and
: want it to be robust. ;)
: What I'd like though, is some constructive de-construction of my code.
: Have a look, and tell me where I can make speed improvements, take
: shortcuts, etc to make it smaller/faster/better.
^^^^^^^^^^^^^^^^^^^^^
1) use -w
2) use strict;
3) use here-doc instead of all those print statements.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Jan 1998 14:51:41 -0600
From: dg50@chrysler.com
Subject: Re: Critique My Code! (Please)
Message-Id: <884895756.473628678@dejanews.com>
Jason Christian wrote:
> On Thu, 15 Jan 1998 dg50@chrysler.com wrote:
> ^^^^^^^---------vvvvvvv !
>> Here's a little (heh - it got a little bloated) utility I wrote to strip
Surely you're not attempting to equate "Chrysler" with "bloated"....
I defy anyone to typify a Neon as "bloated"
> I dunno about faster and better, being a dumb economist who can
> judge the price of everything and the value of nothing, but I usually just
> write
> perl -pi.bak -e 's/\cM$//' <listofGatesiana>
Well, memorizing "-pi.bak -e 's/\cM$//'" as a collection of command line
arguments to perl is a bit of a bitch for a non-perl-programmer-type.
This isn't another instance of the Yet Another Perl One-Liner Contest,
but an attempt to improve the code as written - with all of the
gloriously bloated (and user friendly) usage templates, error checking,
and version info intact.
Oh, and yours doesn't recurse into directories. So there. :P Thppppppt!
Distribute :) as appropriate.
DG
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 15 Jan 1998 13:22:01 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: Critique My Code! (Please)
Message-Id: <Pine.OSF.3.95.980115125724.18385A-100000@primal.ucdavis.edu>
On Thu, 15 Jan 1998 dg50@chrysler.com wrote:
> Jason Christian wrote:
>
> > On Thu, 15 Jan 1998 dg50@chrysler.com wrote:
> > ^^^^^^^---------vvvvvvv !
> >> Here's a little (heh - it got a little bloated) utility I wrote to strip
>
> Surely you're not attempting to equate "Chrysler" with "bloated"....
>
> I defy anyone to typify a Neon as "bloated"
Sorry. I'm not just a dumb economist, I am a dumb *agricultural*
economist, therefore stuck in the past. I was thinking more "New
Yorker" than "Neon."
> > I dunno about faster and better, being a dumb economist who can
> > judge the price of everything and the value of nothing, but I usually just
> > write
>
> > perl -pi.bak -e 's/\cM$//' <listofGatesiana>
>
> Well, memorizing "-pi.bak -e 's/\cM$//'" as a collection of command line
> arguments to perl is a bit of a bitch for a non-perl-programmer-type.
True enough, as is your paragraph below. OTOH, if you mess around on a
unix with a lot of files from Those Other Machines, or simply with text
files in general, a little tiny bit of perl can come in pretty handy...and
if you are going to work on unices at all, even if you are just a dumb
ag economist, knowing a little bit of regular-expressionism is not dumb
(alas, most of the folks around here use pico, and think that R.E.'s are
some arcane magic). But this is a 'how-to-live-with-unix' question.
Perl is not just fun, not just a language that helps me, at least, to get
my work done...it is also a great little unix tool, of which there are
many. And if I can get someone to understand *that* trivial piece of
r.e.ism, I might also get then to try something really useful, like
perl -pi \
-e 's/(Christian)/Dr. $1, sir,/g#note useless storage of lame original file omitted.' ./chrysler/plymouth/valiant/*
> This isn't another instance of the Yet Another Perl One-Liner Contest,
> but an attempt to improve the code as written - with all of the
> gloriously bloated (and user friendly) usage templates, error checking,
> and version info intact.
>
> Oh, and yours doesn't recurse into directories. So there. :P Thppppppt!
>
> Distribute :) as appropriate.
Hmmph.
perl -pi -e 's/[:;8][-\W]*[()}\[\]|]/You don\'t need no steenking smileys/g'\
$mailfolder/Inbox
or something like that.
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
>
>
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: 15 Jan 1998 19:51:57 GMT
From: amihara@Hawaii.Edu (James Amihara)
Subject: Re: deleting old files
Message-Id: <69lpct$37@news.Hawaii.Edu>
: BTW. next time you post, spend some time reading through some other
: messages as well. Questions like this come up all the time. References
: to perldoc come up all the time. You SHOULD have known.
well thanks for all your responses... but i was able to
do it with the following code (if anyone is interested), without
struggling thru all that documentation (which i couldn't decipher
anyway) that was suggested that i read.
#!/usr/bin/perl
$name_match="...";
# Get the list of files in the current directory
opendir(current_directory, ".");
@directory_list = readdir(current_directory);
closedir(current_directory);
foreach $filename (@directory_list)
{
# If the filename matches, and it is more than 7 days old
# delete file
if (($filename =~ /$name_match/) && (-M $filename > 7))
{
print "$filename is ", -M $filename, " days old\n";
unlink $filename;
}
}
------------------------------
Date: Thu, 15 Jan 1998 16:47:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: does anyone know . . .
Message-Id: <comdog-ya02408000R1501981647250001@news.panix.com>
Keywords: from just another new york perl hacker
Please check this information on how to choose a good subject for a post:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
In article <34BE47D5.568D69DF@erols.com>, mw231@columbia.edu posted:
>Does anybody know a perl search engine akin to swish (with wwwwais) or
>glimpse that would grab the paragraph in which the string was found,
>and report it with the file info/link?
why does it have to be Perl? why not just use one of the engines
that you mentioned.
>If no one knows one, does anyone want to write one?
how much are you paying?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 15 Jan 1998 15:31:49 -0500
From: David Adler <dha@panix.com>
Subject: Efficiency: for high number indicies, use array or hash?
Message-Id: <vx9vhvlo4we.fsf@panix.com>
I'm working on a project that will involve indexing information by
invoice number. Since they're numbered, I figured, hey, why not just
use an array? Then I thought about it and realized that the lowest
number would be around 100000, which set me to wondering if I'd be
taking an efficiency hit by doing this. This comes straight from the
hindbrain, so it may have no relation to reality, but I have this
niggling feeling that a whole bunch of memory might get allocated that
I'm never going to use (i. e. for all those lower numbered pieces of
array). Am I losing it, or is this the case? Are there any other
efficiency issues I'm glossing over? Would a hash be a better way to
go?
Any ideas on this would be greatly appreciated.
Thanks.
--
David H. Adler - <dha@panix.com>
"The perversity of the Universe tends towards a maximum."
------------------------------
Date: Thu, 15 Jan 1998 18:59:30 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: EMTY FILE?
Message-Id: <EMuA37.FHq@bcstec.ca.boeing.com>
In article <34BE1434.F478E6F0@xarch.tu-graz.ac.at>,
Jahnel Klaus <jahnel@xarch.tu-graz.ac.at> wrote:
> How can i test a file weather its empty or not (but not with the testing
> of the file size)
perl -ne 'END {print "empty\n" unless $.}' file
HTH,
--
Charles DeRykus
------------------------------
Date: Thu, 15 Jan 1998 14:11:00 -0500
From: Shade Lawrence Jenifer <sjenifer@isc.mds.lmco.com>
Subject: GLOB HELP
Message-Id: <34BE5F44.5035@isc.mds.lmco.com>
Hi everyone,
I'm trying to edit code which contains a trillion subroutines
that take glob variables as arguments. I'm having some
trouble getting the glob concept down. Is there any material
out there which explains globbing well? thanks!
shade
------------------------------
Date: Thu, 15 Jan 1998 16:50:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Location, Redirection
Message-Id: <comdog-ya02408000R1501981650510001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BE37B6.6D3D79BB@usa.net>, drax@usa.net posted:
>Why does the following code work with MS Internet Explorer but not with
>Netscape Browsers?
the browsers don't know anything about the code. something is wrong
with the HTTP portion of this project, so it is only incidently
related to Perl.
>$url = "http://www.myserver.com";
>print "Location: $correcturl\n\n";
>
>How do I have to modify it to make it work with every browser, or at
>least with the above mentioned?
what in $correcturl ?
details about CGI and HTTP are best asked in a forum dedicated to
those topics. however, you can use HTTPeek (a nifty Perl script) to
see what your CGI script is sending to the browser.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
HTTPeek <URL:http://computerdog.com/httpeek/>
------------------------------
Date: 15 Jan 1998 20:31:01 GMT
From: "b_kiefer" <bkiefer@hollandhart.com>
Subject: newbie regex question
Message-Id: <01bd21f4$d80e6200$1c1c2f81@bkiefer.hh.com>
What's the best way to find empty characters at the end of a string?
thanks
bekiefer
------------------------------
Date: Thu, 15 Jan 1998 16:38:50 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: newbie regex question
Message-Id: <comdog-ya02408000R1501981638500001@news.panix.com>
Keywords: from just another new york perl hacker
In article <01bd21f4$d80e6200$1c1c2f81@bkiefer.hh.com>, "b_kiefer" <bkiefer@hollandhart.com> posted:
>What's the best way to find empty characters at the end of a string?
what's "empty"?
perhaps you want to use the matching operator, m//, and look for
characters by their octal code. see the perlre manpage for the
details.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 16:43:58 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: output as hex
Message-Id: <comdog-ya02408000R1501981643580001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BD7166.B117F38B@fnet.gr>, DjPaul <djpaul@fnet.gr> posted:
>I'm trying to convert an ascii array to hexadecimal format and save it
>in a file (or another array) as binary information.
data is saved as binary - it's a number. you choose some other
base when you want to see it. perhaps you wanted to pack it
as an integer?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 14:51:25 -0600
From: cotal@delphi.com
Subject: Pattern match of no character, any character, or space (word boundary)
Message-Id: <884895682.461111315@dejanews.com>
I need a SIMPLE way to match all 3 of the following;
as/400 as 400 as400
as*400 matches as400 and as/400
as.400 matches as 400 and as/400
as*400 or as.400 of course matches all, (as will as400 or as.400)
Is there a special character that will match all without having
to use a boolean?
gs
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 15 Jan 1998 18:27:48 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: perl script for deleting text between two markers?
Message-Id: <EMu8MD.DCG@bcstec.ca.boeing.com>
In article <34BD9066.10E6@tio.com>, Adolf Chavez <adolf@tio.com> wrote:
> Hello. I'm working with a directory with a large number
> of html files in it and am trying to find a simple perl
> script that will go through each html file and remove everything between
> two markers. And optionally replace everything between the markers with
> another piece of text.
>
>
> For example if I had this html file :
>
> <html>
> <head>stuff</head>
> <body>
> text of file
> <!-markerstart-->
> more test
> <!-markerend-->
> <body>
> </html>
>
> so that after the perl script was run on it you would have :
>
> <html>
> <head>stuff</head>
> <body>
> text of file
> <body>
> </html>
>
> Please don't flame. I tried doing some net searches for
> an example of script like this - but couldn't find anything that would
> do it. I'm not a Perl programmer - but understand that this language
> may be well suited for doing this. If you know of any scripts that are
> at all similar or have a way of doing this - I would greatly appreciate
> any information or pointers.
>
man perlop and look for the "range operator".
To eliminate the marked section, you could do this, e.g.,
perl -ni -e 'print unless /^<!-markerstart-->/../^<!-markerend-->/' file
To insert is a bit messier, but I know you're eager to accept
the challenge so I'll jump out of the way :)
HTH,
--
Charles DeRykus
------------------------------
Date: Thu, 15 Jan 1998 16:46:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Printing quote punctuation in strings to e-mail
Message-Id: <comdog-ya02408000R1501981646170001@news.panix.com>
Keywords: from just another new york perl hacker
In article <Zwebmaster-1501981242510001@205.133.76.196>, Zwebmaster@formz.com (Dave Barak) posted:
>I've got a (hopefully) simple question (I'm new to Perl, and my books are
>at home). I need to have a form mailer script print the quote sign ( " )
>to my e-mail. Do I need some sort of special code for that? The string I'm
>printing is, of course, enclosed in quotes, but I need to include quotes
>as part of the string.
depending on what you are doing, a here document might make sense:
print <<"MAIL";
To: this@address
From: that@address
Subject: some quotes
this has some "quote" 'thingys' in it
MAIL
you might also check out Perl's other generalized quoting facilities,
such as q//, qq//, and so on.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 16:41:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Quick Perl tutorial?
Message-Id: <comdog-ya02408000R1501981641260001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BE5A9A.DBE4312A@ultranet.com>, Jim Goss <jgoss@ultranet.com> posted:
>I'm looking to learn the basics of perl so I can whip together
>some scripts. I don't need to use it a lot, nor do I need to
>do anything complex, just enough to do some quick and dirty
>deeds on occasion.
Learning Perl
Randal L. Schwartz & Tom Christiansen
ISBN 1-56592-284-0
<URL:http://www.oreilly.com>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 21:31:17 +0000
From: Andrew Spiers <andrew.spiers@virgin.net>
Subject: Search Script -Comment please
Message-Id: <34BE8024.F720DC06@virgin.net>
I have written a script to search through my site and return urls of
pages found and the number of matches. I am looking for comments about
the way I have done this, problems that could be encounted etc. It is
not a full blown script yet the basic bits are there.
Regards,
Andrew Spiers
================================
I dont have a SIG file but for
those that like reading them.
GET A LIFE !!!!!!!!!!!!!!!!
Major respect to Randal.
================================
#!/usr/bin/perl
use File::Find;
use CGI qw(:standard);
print header(),
start_html("Search Engine"),
h1("Search Engine");
find (\&wanted, '/web');
sub wanted { return unless /htm/; push @ARGV, $File::Find::name; };
sub TRANSFORM ($;) {local($_) = @_;
s!/web/!http://www.sw.oaktree.co.uk/!; $_; }
while (<>) {
if (eof) {
if ($per_file) {
$url = TRANSFORM $ARGV;
print pre("Hits: $per_file, in file <a href='$url'>$url</a>");
};
close ARGV;
$per_file = 0;
}
chomp;
$per_file++ if (/spiers/i);
}
print end_html;
------------------------------
Date: Thu, 15 Jan 1998 16:40:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Simple script for posting data and reading result
Message-Id: <comdog-ya02408000R1501981640250001@news.panix.com>
Keywords: from just another new york perl hacker
In article <wkvhvl37gm.fsf@nwu.edu>, Yusuf Pisan <y-pisan@nwu.edu> posted:
>Could somebody suggest a simple perl4/perl5 script to 'POST' some data
>to a search engine and read back the result?
LWP [1] seems perfectly suited to this. there might even be this script
in the documentation.
[1]
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 15 Jan 1998 13:49:35 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: source into binary code
Message-Id: <34BE684F.1BE53308@gpu.srv.ualberta.ca>
Dan Boorstein wrote:
!
! Andrew Johnson wrote:
! >
! > Dan Boorstein wrote:
! > !
!
! [snip]
!
! > if you have a security problem (or don't know if you do) with
! > a script, then just trying to hide the problem by compiling
! > a) does not fix the problem
!
! i never said it would
!
! > b) only hides it from people who know as little about such
! > things as you
!
! exactly my point. it is a barrier in gaining knowledge. that is
! security. not foolproof, not even good, but still security. key
not even good, but still security? I think this just underlines
the meaning Tom C's statement:
Tom Christiansen wrote:
> Security through obscurity is a terribly dangerous miscarriage
> of truth.
[snip]
! > compilation is not designed to be a good (or
! > any kind of) encryption system,
! > and thinking that it provides some
! > measure of encryption is simply false security.
!
! sorry i disagree. encryption is encoding. it does not mean
! encoding for the sake of security, though that is a likely usage.
! do you disagree that compilation is good at encoding source code
! into machine or byte code?
well, I won't argue the semantics of encryption/encoding...
But, if my hypothetical bank vault happens to have a gaping
hole in one wall and I cover it with a large poster advertising
lower banking rates then you would consider this to be
at least some measure of security because well, no one can see
the hole so the danger is lessened? sure its not good security,
but its still security? I would disagree... its a security
compromise waiting to happen --- had you left the hole open you'd
be forced to take active steps like hiring another armed guard or
rebuilding the vault---covering it up only means you won't be
prepared if someone happens to lean on that part of the vault
wall.
compilation of source has its uses, obviously,...but I would not
count hiding security problems (real or potential) among them, nor
would I recommend it as even a minimalist step in that direction.
we are, of course, free to disagree.
regards
andrew
------------------------------
Date: Thu, 15 Jan 1998 15:51:50 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: source into binary code
Message-Id: <fl_aggie-1501981551510001@aggie.coaps.fsu.edu>
In article <34BE684F.1BE53308@gpu.srv.ualberta.ca>, Andrew Johnson
<ajohnson@gpu.srv.ualberta.ca> wrote:
+ Tom Christiansen wrote:
+ > Security through obscurity is a terribly dangerous miscarriage
+ > of truth.
Quote-file material...
+ But, if my hypothetical bank vault happens to have a gaping
+ hole in one wall and I cover it with a large poster advertising
[snip]
+ rebuilding the vault---covering it up only means you won't be
+ prepared if someone happens to lean on that part of the vault
+ wall.
And if the person who leans gets hurt, then they can sue the bank into
next month for damages, and can forgo the danger of robbing the place.
I believe the commonly used term would be 'negligence'.
+ compilation of source has its uses, obviously,...but I would not
+ count hiding security problems (real or potential)
"Hiding" a security problem is at _best_ a _short_ term solution. Fixing
it would be optimal.
I suspect the originator of this thread simply wishes to prevent potential
customers from stealing code. That's best prevented via copyright and
contract law.
The rich culture in the perl community exists because everything is in the
open. Perl is more than _just_ a programming language, and far more than
the sum of its parts.
Hiding code just goes against that culture.
James - unless its an obsfucated perl contest, that is... :)
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Thu, 15 Jan 1998 16:36:11 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: source into binary code
Message-Id: <comdog-ya02408000R1501981636110001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BE2AFA.E94BF263@ixl.com>, Dan Boorstein <dboorstein@ixl.com> posted:
>Tom Christiansen wrote:
>> Compiling produces no security.
>taken from the merriam webster dictionary:
>
>security - "measures taken to guard against espionage or sabotage,
>crime, attack, or escape"
>
>obscure - "not readily understood or clearly expressed"
>
>i'm not submitting that compiling is good security, only that it is
>security. based on this definition, or one from your favorite
>dictionary, do you agree or disagree with tom c's original statement?
*heh* forget about the dictionary. your enemy is a hacker - a person
with seemingly unlimited curiousity, unending devotion to the task
at hand, and a master of technical trivia. "not clearly expressed"
and "not readily understood" are big flashing signs saying "k3\/\/1
probl3m ah3ad".
if this person also knows the innards of perl, or decides to
learn it, and cracks your pseudo hidden code, he's going to brag
about it all over the place. he's going to take great pains
to ensure that others know he did something k3wl.
>second, the blanket statements that have followed concerning poorness
>of security through obscurity i believe to be in error as well. isn't
>key based cryptography security through obscurity?
the algorithms for useful encryption schemes are well known. they
rely on the fact that a brute force approach is either infeasible
or resourcefully impossible even when the attacker knows how they
work.
perhaps it's time that you did a bit of reading before you debate
any further.
--
brian d foy <comdog@computerdog.com>
Applied Cryptography is a nice book with which to start. or the
phone book under "Attorney - Intellectual Property"
------------------------------
Date: Thu, 15 Jan 1998 16:18:03 -0500
From: ken@forum.swarthmore.edu (Ken)
Subject: Re: Syntax coloring for POD format
Message-Id: <ken-1501981618030001@news.swarthmore.edu>
>Jay Rogers <jay@rgrs.com> wrote:
># ken@forum.swarthmore.edu (Ken) writes:
># Well, since you asked for our opinion - I'd argue against coloring POD
># text as a comment. Since POD is just plain ole documentation, I'd say
># it should be "colored" like plain text.
Hmm, I hadn't thought of coloring it as plain text - the main thing I want
is to not color it as regular code, because that makes it really hard to
look at a file and distinguish the real code from the pod, especially if
you're mixing code and pod.
My personal preference would be to color pod like comments, so I can see
immediately that it's not real code.
pudge@pobox.com (Chris Nandor) wrote:
>Hm. BBEdit 4.5.1 is colored as normal code. In fact, =pod stuff is
>included in the function list, too (as are "subs" in here-docs, I think).
>
>Regardless, I think =pod should look like commented text, and currently it
>is not. They also do stuff wrong with lots of quoting facilties. But I
>gave them a list of Perl 5 words, and they got all those in, so I am
>happy. :-)
Yeah, the fact that BBEdit thinks pod and here-docs can be kind of
annoying - especially pod, because real-looking perl code frequently
happens in pod and it would be nice to know it's not going to be executed.
As regards the rest of BBEdit's coloring, it's gotten a lot better than it
used to be. I use version 4.5.1a or something, and the only thing I
notice consistent failure on is special variables like $" or $`. They've
gotten a lot better about recognizing when a quote is in a regexp
character class (and isn't really a quote) and the like.
-Ken Williams
The Math Forum
ken@forum.swarthmore.edu
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 1649
**************************************