[8070] in Perl-Users-Digest
Perl-Users Digest, Issue: 1689 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 21 02:07:43 1998
Date: Tue, 20 Jan 98 23: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 Tue, 20 Jan 1998 Volume: 8 Number: 1689
Today's topics:
[Q]: my variables not showing up in perl debugger (Sean O'Neill)
Re: automatically running a perl script (Michael Budash)
Email Autoresponder <mikey@iexpress.net.au>
Re: Embedded variable names in text files....possible? (Nicholas J. Leon)
Re: Example of select listening to socket and STDIN nee <catty@catty.catty>
Re: FAQ too big (Was: Re: PERL forking) (Michael Budash)
Re: help with sorting (Tad McClellan)
Help! Quick Flat File DB/PERL Search Script??? (bgg)
Re: I need a man to lick me in to a frenzy!!! (Jay Flaherty)
Re: I need some help pleeze <rjk@coos.dartmouth.edu>
Re: living and free software (was: Re: source into bina <rjk@coos.dartmouth.edu>
Re: Logical 'and' in regex? <rjk@coos.dartmouth.edu>
Re: Modifying \n\r on a directory tree of html files to (Tad McClellan)
Re: Modifying \n\r on a directory tree of html files to (Tad McClellan)
Perl 5.004_04 Make Test problem <barry@educ.lsuc.on.ca>
Perl vs C++ for CGI <gedavis3@vt.edu>
Re: Perl vs C++ for CGI (brian d foy)
Re: Perl Win32: iterating a folder, is it file or folde (David Efflandt)
Re: Question about outputting HTML w/ images (David Efflandt)
readdir problem <298@mp3search.com>
Retreiving File from Remote Server <Webmaster@csa.clpgh.org>
Re: source into binary code <lovegod@earthling.net>
Re: source into binary code <lovegod@earthling.net>
Re: source to binary pt. II (was Re: Simple example of (brian d foy)
Re: source to binary pt. II (was Re: Simple example of <rjk@coos.dartmouth.edu>
Re: space searching? <rjk@coos.dartmouth.edu>
Re: Strange construct /(Word|other)(?=<>)/ <rhodri@wildebst.demon.co.uk>
Re: Strange construct /(Word|other)(?=<>)/ <*@qz.to>
sysread vs <> (Mike Linksvayer)
The camel and llama -- together at last! <joseph@5sigma.com>
Re: triming whitespace <rhodri@wildebst.demon.co.uk>
Re: triming whitespace (Tad McClellan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Jan 1998 04:46:19 GMT
From: swoneill@erols.com (Sean O'Neill)
Subject: [Q]: my variables not showing up in perl debugger
Message-Id: <34c57cc8.453302750@news.erols.com>
Can anyone explain to me why using the following code segment:
sub subroutinename() {
my %rpt_obshash;
my %rpt_pathash;
my @rpt_patches;
blah blah blah
}
in the perl debugger do the variables beginning with rpt not show up using the
"X ~rpt" command? If I comment out the my'd lines, it works fine. Isn't the
debugger like the perl "god" of its environment and see everything in its
domain?
Any idea?
-------------------
Sean O'Neill
swoneill@erols.com
------------------------------
Date: Tue, 20 Jan 1998 18:59:11 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: automatically running a perl script
Message-Id: <mbudash-2001981859120001@d107.pm10.sonic.net>
In article <laP$tHA28Ox0EwFK@cydaps.co.uk>, James
<James@cydaps.nospam.co.uk> wrote:
>> Hi,
>>
>> I have a script that I need to get to automatically startup at 10.00am
>> GMT each day, everyday. Does anyone know how I can do this?
>>
>> The script is running on a UNIX server with Perl5. Basically it is a
>> script that sends emails out to each registered user of the site each
>> day, but at the moment I cannot figure a way to automatically start the
>> script at 10.00am without any human involvement.
>>
this is not a perl question, but an os (in this case, unix) question.
anyway, set up an entry in the crontab. if you don't know what that is,
then ask your sysadmin. they'll fill you in, and tell you whether you can
do it or not.
hth-
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: Wed, 21 Jan 1998 11:01:21 +0800
From: "Michael Slater" <mikey@iexpress.net.au>
Subject: Email Autoresponder
Message-Id: <6a3oip$gr5$1@loomi.telstra.net>
Hello,
Anybody know of an Email Autoresponder script written perl, and where
it can be obtained from.
Thanks,
Michael
------------------------------
Date: Tue, 20 Jan 1998 22:39:59 -0500
From: nicholas@binary9.net (Nicholas J. Leon)
Subject: Re: Embedded variable names in text files....possible?
Message-Id: <MPG.f2f381e586d219a989682@client.news.psi.net>
In article <34C533E7.A473D2CD@seanet.com>, dawfun@seanet.com says...
> Hi,
>
> I'm kind of stuck on this one....
>
> I have a file called 'contact1.txt', and I want to open it and print the
> contents to the screen. Within the text of this file I have what I
> hoped would have been a variable name '$emailaddress', however upon
> opening and printing this file, instead of printing the contents of
> '$emailaddress' it instead prints "$emailaddress". See example:
Try something like this,
-- the text file, contact1.txt --
Hello, my email address is %ADDRESS. Goodbye!
-- the perl script that outputs it --
#!/usr/bin/perl
my $email="dawfun\@seanet.com";
open IN,"<contact1.txt" || die $!;
while (<IN>) {
s/%ADDRESS/$email/g;
print;
}
close IN;
-- end --
I use %XXXX notation for substitutions instead of $xxxx so that they can
easily be written into regex's.
------------------------------
Date: Wed, 21 Jan 1998 03:27:43 +0000
From: catty <catty@catty.catty>
Subject: Re: Example of select listening to socket and STDIN needed
Message-Id: <34C56B2F.22041300@catty.catty>
Paul Ryder wrote:
> Could someone post an example (of just this if possible) using select
> to listen to a tcp/ip socket connection and the keyboard STDIN at the
> same time and acting upon both .. so i can make a connection and send
> data to the server via STDIN through the keyboard
Something like this? Assuming that STDIN is first set to be
the connected socket and STDOUT is your screen and keyboard.
sub doit {
my $b0 = ''; vec( $b0, fileno(STDIN ), 1) = 1;
my $b1 = ''; vec( $b1, fileno(STDOUT), 1) = 1;
my ( $nfound, $rbits, $text );
my $tmot = 0.1;
while ( 1 ) {
$nfound = select( $rbits=$b0, undef, undef, $tmot );
if ( $nfound > 0 ) {
if (sysread( STDIN, $text, 256 ) > 0) { print "$text"; }
else { last; }
}
$nfound = select( $rbits=$b1, undef, undef, $tmot );
if ( $nfound > 0 ) {
if (sysread( STDOUT, $text, 256 ) > 0) { print STDIN
"$text"; }
}
}
return 1;
}
------------------------------
Date: Tue, 20 Jan 1998 19:05:10 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <mbudash-2001981905170001@d107.pm10.sonic.net>
In article <01bd25e8$5f0a68c0$a041f9a5@dyyfc1.aca.arcochem.com>, "Kevin
Hawley" <cchkxh@ARCO.com> wrote:
>> I don't have 40 years to read the FAQ. I use lots of languages
>> not just perl, if I read all the FAQ's I would be one smart dude,
>> but out of a job! That is why I appreciate people like you that take
>> the time to answer questions. By the way I do nibble at the FAQ
>> when I get some spare time (sometimes I even read it :^).
>>
>> -Kevin Hawley
>>
>> Tom Phoenix <rootbeer@teleport.com> wrote in article
>> <Pine.GSO.3.96.980120112716.6319F-100000@user2.teleport.com>...
>> > On Mon, 19 Jan 1998, ARCO Chemical Company wrote:
>> >
>> > > P.S. The Perl FAQ is TOO big!!
>> >
>> > If everybody would only read it before posting, none of the questions
>> > would be frequently asked any longer, and then we could virtually
>> > eliminate the FAQ, couldn't we? Oh, wait...
>> >
>> > --
Kevin -
I hate to add to the bandwidth waste on this subject, but Tom's right. The
FAQ is to be read **before** we post questions. If it's too big, that's a
good thing. It means the answer you seek is more than likely there. Use it
or be ignored in this newsgroup, or get an answer that says (wait for it,
infinite loop coming...): READ THE FAQ.
My .02
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: Tue, 20 Jan 1998 22:27:28 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: help with sorting
Message-Id: <gft3a6.sg2.ln@localhost>
Michael D Sohn (msda+@andrew.cmu.edu) wrote:
: I have a table of information that is delineated by tabs that I want to
: sort. The problem is that the column that I want to sort on is in
: scientific notation. For example:
The problem is no problem ;-)
Perl uses the C library to convert to a number, and the library
understands scientific notation.
Just use the usual <=> spaceship operator, and sort away, as
described in perlfunc and the sorting FMTEYEWTK.
( http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html )
: I'm not familier with Perl enough to know how to do this. I would like
: to sort on the second column and maintain the order of the information
: in the same row. I would think this is a basic problem. Any
: suggestions on doing this?
-----------------------
#!/usr/bin/perl -w
@data = <DATA>;
@sorted = sort by2nd @data; # VERY inefficient...
foreach (@sorted) { print; }
@sorted = map { $_->[0] } # Schwartzian Transform
sort { $a->[1] <=> $b->[1] } # use this if large list
map { [ $_, (split /\t/)[1] ] } @data;
foreach (@sorted) { print; }
sub by2nd { (split /\t/, $a)[1] <=> (split /\t/, $b)[1] }
__DATA__
19 39.27e-07 7.19
31 49.27e-07 37.19
41 69.27e-07 47.19
21 49.27e-07 57.19
52 51.97e-06 512.05
82 21.97e-06 142.05
42 71.97e-06 152.05
32 971.97e-06 152.05
-----------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Jan 1998 02:55:06 GMT
From: bgg@--please-remove-this--magpage.com (bgg)
Subject: Help! Quick Flat File DB/PERL Search Script???
Message-Id: <6a3o2b$5ne$0@208.222.91.45>
Help!
I'm a PERL know-nothing. I'm looking for a search script that will NOT
search the html root directory AT ALL, but will search ONLY a tab
delimited database, in what I'm assuming will be placed in my
cgi-local bin, AND will generate the results in a standard HTML
format.
I've been wowed by what I'm seeing people using for site search
engines with a C program called "cgic: an ANSI C library for CGI
Programming," found at http://www.boutell.com/cgic/ but my server
seems to only support PERL. Besides, I'm told PERL is nore universal.
This CGIC is, IMHO, quite impressive (at least for those of us not
managing gigantic db's, perhaps), a real example can be seen @
http://www.nannysweb.com/form.htm
Everything I'm seeing from at least 25 PERL-specific sites is ONLY for
returning HTML URL's, or returns everything in META tags, or is
Boolean, or has user query options, table-append, etc.
Does anyone know of a PERL script that could replicate this search and
html follow-up results performance, comparable to the CGIC coding???
Many, many thanks!
Note: please note anti-spam junk in my email address! Thanks!
------------------------------
Date: 21 Jan 1998 02:43:50 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: I need a man to lick me in to a frenzy!!!
Message-Id: <6a3nd6$cmq$1@gaia.ns.utk.edu>
Derek Balling (dballing@speedchoice.com) wrote:
: I would think
:
: while(!($frenzy)) {
: lick($me);
: }
:
: would be more appropriate. Always code your functions as general
: purpose. What if she wants you to lick her friend? Are you gonna rewrite
: a whole new function that does essentially the same task? Even better
: would be:
:
: push @licked, $me;
: while(!($frenzy)) {
: lick(\@licked);
: }
:
: So if it was a group grope thing your function would be covered as well.
: :)
:
: Derek
: (and there's no WAY I speak for my employers on this one)
You are so right, my employer would be appaled at my lack of generality.
In fact, he would suggest making it a module that had more versatility.
Why limit it to just licking? Why not biting? Tickling?
Package Frenzy;
sub new {
...
}
sub lick {
...
}
sub bite {
...
}
sub tickle {
...
}
__END__
#!/usr/bin/perl -Tw
use strict;
use Frenzy;
my $frenzy = new Frenzy;
my $me = ["tom","dick","harry"];
$frenzy->lick($me);
$frenzy->bite($me);
$frenzy->tickle($me);
__END__
Jay
(who has waaaaay too much free time on his hands)
--
**********************************************************************
Jay Flaherty fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************
------------------------------
Date: Wed, 21 Jan 1998 00:59:15 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: I need some help pleeze
Message-Id: <34C58EB3.156D0412@coos.dartmouth.edu>
Clay Irving wrote:
>
> If I was a bad boy and didn't have warnings turned on, it might look like
> "M" was equivalent to 0.
When converting M to a number, it *is* equivalent to 0:
DB<1> p "M" == 1
DB<2> p "M" == 0
1
When converting "M" to a boolean value, it is equivalent to 1:
DB<3> p !!"M"
1
Chipmunk
------------------------------
Date: Wed, 21 Jan 1998 00:25:39 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <34C586D4.EFFD0977@coos.dartmouth.edu>
Greg Bacon wrote:
>
> In article <6a19ht$cii$1@news.orst.edu>,
> stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
> : No Utopia exists when people are hungry. Somehow, equating the Internet
> : to Utopia lessens the value of Utopia, or inappropriately agrandizes
> : the Internet.
>
> This remark leads me to believe that either you haven't been using the
> Internet for very long or that you haven't realized the full potential,
> perhaps both.
You don't seriously believe the Internet is a Utopia, do you?!
This remark leads me to believe that you are either very naive,
or simply don't know what 'Utopia' means.
You recommended several things for John Stanley to read. Here's
one for you:
Silicon Snake Oil: Second Thoughts on the Information Superhighway
by Clifford Stoll (author of The Cuckoo's Egg)
Anchor Books, Copyright 1995
Chipmunk
------------------------------
Date: Wed, 21 Jan 1998 00:38:00 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Logical 'and' in regex?
Message-Id: <34C589B9.228E74D4@coos.dartmouth.edu>
Eli the Bearded wrote:
>
> has never seen the hip owls book in a bookstore
I bought it at Border's Bookstore in Ann Arbor.
Chipmunk
------------------------------
Date: Tue, 20 Jan 1998 22:00:49 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Modifying \n\r on a directory tree of html files to \n files for UNIX
Message-Id: <htr3a6.jc2.ln@localhost>
Brian Lavender (brian@brie.com) wrote:
: I am trying to figure out how to change an entire directory of html files
: which have the \r\n line termination to the unix style with just a \n. I
: looked at dejanews and I found this simple one line by Mr. McClellan to
: change a single file named joe.pl.
: On1997/04/27 tadmc@flash.net (Tad McClellan) wrote:
: You can do that with a perl one-liner too:
: perl -pi.bak -e 's/\r//' joe.pl
: (joe.pl.bak will hold the original (DOS) contents)
: How can I make this so it traverses down a directory tree and modifies
: all .html files? I could not find a recursive switch in the Camel book.
use the File::Find module.
: It seems that having the -i.bak switch is a good idea, but how would I
: get rid of the .bak files once I determine the perl command routine was a
: success?
use the File::Find module ;-)
along with unlink()
[ if you do: perl -pi -e ... then it won't save the original
^
^
Danger Will Robinson!
]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 20 Jan 1998 22:47:01 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Modifying \n\r on a directory tree of html files to \n files for UNIX
Message-Id: <5ku3a6.1o2.ln@localhost>
Brian Lavender (brian@brie.com) wrote:
: I am trying to figure out how to change an entire directory of html files
: which have the \r\n line termination to the unix style with just a \n. I
: looked at dejanews and I found this simple one line by Mr. McClellan to
: change a single file named joe.pl.
: On1997/04/27 tadmc@flash.net (Tad McClellan) wrote:
: You can do that with a perl one-liner too:
: perl -pi.bak -e 's/\r//' joe.pl
Uhhh. I should have said this instead, because it's faster:
perl -pi.bak -e 'tr/\r//d' joe.pl
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 20 Jan 1998 22:53:54 -0500
From: Barry Ayow <barry@educ.lsuc.on.ca>
Subject: Perl 5.004_04 Make Test problem
Message-Id: <34C57152.1982@educ.lsuc.on.ca>
Hi all,
I'm hoping one of you can provide me with some insight to my problem. I
have a Sparcstation
running Solaris 2.5.1 with the usual GNU compiler and utilities. The
program seemed to
compile without complaint or make didn't bail anyway. I should also
qualify this by
saying that I am not a Perl programmer or programmmer for that matter.
In any event, I
ran the "make test" to ensure everything was working properly and it was
successful with
the exception of one test "t/lib/odbm.t". It dumped core in the same
place in the script and
I have difficulty following the script. There are several variables
whose values I am
unable to derive easily so hopefully someone can enlighten me. The
values are $key, $value and %h.
I tend to think of % as modulos so I am not sure what significance it
has here. That aside
is this module or functionality important to the functioning of Perl
itself? The coredump
spits out "Signal BUS: no such file or directory" which suggests that
perhaps some hardware
routine or file required being attempted by the script is failing. I
have found nothing
particularly helpful in bug reports, hints or READMEs with the
distribution. If anyone
has seen a similar problem, I would be interested in your thoughts or
suggestions.
Thanks in advance.
barry
------------------------------
Date: Wed, 21 Jan 1998 10:30:37 -0500
From: "Jerry Davis" <gedavis3@vt.edu>
Subject: Perl vs C++ for CGI
Message-Id: <6a3q54$mo3$1@solaris.cc.vt.edu>
I have spent the last 2-3 months learning perl and I know why it is the
language of choice for cgi. I have written a fairly large script in perl
(two 18K files, plus an assortment of smaller ones). I recently learned that
c++ is a faster language for cgi programs. Since perl handles text
manipulation so easily rewriting my code into c would be a tiresome chore.
The question is:
How much speed increase is gained by using c instead of perl?
(Note: memory is not a concern, only speed)
Would you consider it worthwhile for the time required to rewrite huge
sections of code?
Jerry
------------------------------
Date: Wed, 21 Jan 1998 00:52:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl vs C++ for CGI
Message-Id: <comdog-ya02408000R2101980052090001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6a3q54$mo3$1@solaris.cc.vt.edu>, "Jerry Davis" <gedavis3@vt.edu> posted:
>How much speed increase is gained by using c instead of perl?
>(Note: memory is not a concern, only speed)
>Would you consider it worthwhile for the time required to rewrite huge
>sections of code?
if you are worried about speed use mod_perl or fast_cgi. mod_perl
scripts might even be faster than laod-every-time compiled code.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 21 Jan 1998 06:36:55 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Perl Win32: iterating a folder, is it file or folder?
Message-Id: <34ca9534.9194486@flood.xnet.com>
randy.suinn@fci.com wrote:
>This question applies to Win32:
>
>When iterating the contents of a folder, what is the method to determine
>if it's a file or folder?
>
>I have some folders that can be named just about anything.
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
Consider something as obvious as file test operators:
if (-d $foo) {
chdir $foo;
} else {
# it is most likely a file
if ($len = -s $foo);
print "The file size is $len\n";
} else {
print "The file is empty\n";
}
}
David Efflandt/Elgin, IL USA
efflandt@xnet.com http://www.xnet.com/~efflandt/
------------------------------
Date: Wed, 21 Jan 1998 06:10:36 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Question about outputting HTML w/ images
Message-Id: <34c88d12.7112743@flood.xnet.com>
Steve Ellis <sellis@vt.edu> wrote:
>Greetings all! Sorry to post in the wrong spot if this isn't an
>appropriate question....but:
>
>I'm trying to output an HTML page from a script. The text parts are
>just fine, but when it gets to an <IMG> tag, the browser window
>(Netscape) goes black and then displays the picture. After that, I have
>to hit ESC to get away from the image, and the rest of the script is
>locked up...
Image tags for CGI generated pages are just like for normal html
pages. What trips you up is if you fail to escape or otherwise handle
quotes in the string.
For example where $gif2 = img/some.gif instead of doing:
print "<IMG SRC=\"$gif2\">";
you can instead use an easier to read:
print qq(<IMG SRC="$gif2">);
You can also print large blocks of data (whole pages) with variables
and without having to escape double quotes like:
print <<EOF;
a whole "bunch" of $stuff
<P>
on and on and on
EOF # on left margin, not indented
Note that you cannot send html and binary image data at the same time
if that is what you are trying to do. But you can use a CGI as in
image source in a tag.
David Efflandt/Elgin, IL USA
efflandt@xnet.com http://www.xnet.com/~efflandt/
------------------------------
Date: Wed, 21 Jan 1998 00:29:39 -0600
From: Robert Towster <298@mp3search.com>
Subject: readdir problem
Message-Id: <34C595D2.ED10EFAC@mp3search.com>
Can anyone tell me how I can read the filenames of the files in a
directory
sorted in chronological order with the newest files first? From
everything
I can tell, readdir only will get the file list but not provide any
method for
controlling the sorting..
If you have any thoughts on this please CC your response to me too..
Thanks
Robert Towster
------------------------------
Date: Tue, 20 Jan 1998 22:25:12 -0500
From: John Kotwicki <Webmaster@csa.clpgh.org>
Subject: Retreiving File from Remote Server
Message-Id: <6a3pqt$3rs@bgtnsc01.worldnet.att.net>
Problem: I set up a standard socket connection with a Web server. I know
it works because I have tested it with random Web sites. However, some Web
sites do not return what I ask for. They simply did nothing and returned
no errors.
The code I use after the connection is made is:
print S "GET $url HTTP/1.0\n\n";
while ($_ = <S>) {
print $_;
}
Why doesn't this code work all of the time? Are some servers looking for a
different type of request? (I tried POST and even PUT but neither worked).
John Kotwicki
------------------------------
Date: Tue, 20 Jan 1998 23:41:54 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: Re: source into binary code
Message-Id: <34C58AA2.3B33@earthling.net>
I R A Aggie wrote:
> [lots of stuff - well, quoted lots of stuff]...
> "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>
Well, OK, I'm a newcomer to the perl community, but I LOVE perl! I'm
an old-time C programmer, and it gives me almost an orgasmic thrill
to write,
unless (open(NEWFILE,">$basedir/$mesgdir/$num\.$ext")) {
$error_string = "$basedir/$mesgdir/$num\.$ext: $!";
&tell_error;
exit;
}
But my point is, I agree that the code isn't what needs to be
hidden, because of the copyright laws and stuff; I'm working right
now on how to license the use of a certain script I wrote - I'll
keep it a secret by not giving its location away, and if anybody
tries to access it with a browser, it will just execute, and if
it wasn't called properly, dump. So what I do is not tell anybody
my FTP server, or account, or password. Duh. If somebody's gonna
hack some server that drastically, then I don't think my personal
script is the true moneymaker they're looking for. Protect Code?
That's like asking Brett Favre not to let anybody see his arm!
Rich Grise perl programmer nouveau extraordinaire
------------------------------
Date: Wed, 21 Jan 1998 00:02:29 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: Re: source into binary code
Message-Id: <34C58F74.1570@earthling.net>
John Stanley wrote:
>
...
>
> Yes, getting paid to write code is a viable option for making a living.
> Giving it away for free is not.
Maybe getting paid to write code is a viable option for you, but
I'm still working on the "getting paid" part!
Rich Grise
programmeur d'perl nouveau extraordinaire!
------------------------------
Date: Wed, 21 Jan 1998 01:17:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: source to binary pt. II (was Re: Simple example of Select needed please)
Message-Id: <comdog-ya02408000R2101980117290001@news.panix.com>
Keywords: from just another new york perl hacker
[follow-ups set]
In article <34C545AA.561A1EAB@negia.net>, Dan Boorstein <danboo@negia.net> posted:
>brian d foy wrote:
notice the spelling
>> the group did exist before your recent thread, as did this quote.
>> Dave's had it in his .sig since at least November of last year.
>
>i stand corrected on the quote. please accept my apologies dave.
>however, i still think it is more wrong than ever.
think anything you want. if you want to debate it, then you need
to do more homework.
>my thread? how on earth do you get that? i was not:
>
> a) the primary author
> b) the most frequent poster
> c) the largest user of bandwidth
your thread because you were focus of most the posts since you were
trolling.
--
brian d foy <comdog@computerdog.com>
i knew this would only lead to a killfile
------------------------------
Date: Wed, 21 Jan 1998 01:49:18 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: source to binary pt. II (was Re: Simple example of Select needed please)
Message-Id: <34C59A6E.E944955@coos.dartmouth.edu>
Dan Boorstein wrote:
>
> anyway what is wrong with this thread? it is certainly germane to this
> news group. made evident by its popularity.
I daresay the number of messages in a thread is not a good indication
of how relevant that thread is to the newsgroup's predefined topic.
Chipmunk
------------------------------
Date: Wed, 21 Jan 1998 01:36:03 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: space searching?
Message-Id: <34C59753.BF9AA20A@coos.dartmouth.edu>
Stephen Howe wrote:
>
> I have a line saying
> To: stephen@solamnia.demon.co.uk, stephen@bcl.com, daryn@blahblah.com
>
> etc..
> I need to know how to figure out the user associated with ONLY the
> bcl.com site...
Note that if you decide to go the regex route, as many people suggested
in their replies, there is an important difference between:
/\s\w+\@bcl\.com/
and
/\w+\@bcl\.com/
The first will be be much faster, because it will not have to backtrack
nearly as much.
Chipmunk
------------------------------
Date: Wed, 21 Jan 1998 02:34:50 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: Strange construct /(Word|other)(?=<>)/
Message-Id: <480bb27107rhodri@wildebst.demon.co.uk>
In article <tbwEn3rwE.n3n@netcom.com>,
Tom Burton-West <tbw@netcom.com> wrote:
> $stuff=~/(word|otherword)(?=<>)/ || $stuff =~s/(word/otherword)/text/;
> My guess is that if the first part of the expression is true then the
> word "text" gets substituted for the word "word" or the word
> "otherword" in the string $stuff.
Other way round! The substition happens if the first part of the
expression is false.
> What I don't understand is the expression (?=<>) inside the regular
> expression in the first part. Can anyone please explain? I couln't
> find a reference to the construct in the Camel book.
p68 of the Blue Camel (it's not in the Pink Camel). Basically "(?...)"
indicates a regular expression extension -- in this case (?=...) is a
lookahead assertion. It matches if rest of the expression in the brackets
matches, but doesn't move the matching point in the string on. It's
almost redundant in this case; the only difference between
/(word|otherword)(?=<>)/
and
/(word|otherword)<>/
is that in the former case $& will not contain the trailing "<>" if a
match occurs.
So what that expression actually does is nothing if $stuff contains either
"word<>" or "otherword<>", otherwise replace the first occurance of "word"
or "otherword" with "text".
--
Rhodri James *-* Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them
... "I can't believe it's not Rutter!"
------------------------------
Date: 21 Jan 1998 04:22:45 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Strange construct /(Word|other)(?=<>)/
Message-Id: <qz$9801202252@qz.little-neck.ny.us>
Keywords: from just another new york perl hacker
Tom Burton-West <tbw@netcom.com> wrote:
> I am trying to understand the following line of perl code:
>
> $stuff=~/(word|otherword)(?=<>)/ || $stuff =~s/(word/otherword)/text/;
^
^
You meant |, right?
> My guess is that if the first part of the expression is true then the
> word "text" gets substituted for the word "word" or the word
> "otherword" in the string $stuff.
Nope. It is an || not an &&, rethink your if-then.
> What I don't understand is the expression (?=<>) inside the regular
> expression in the first part. Can anyone please explain? I couln't
> find a reference to the construct in the Camel book.
(?=text) is the lookahead assertion that "text" follows the current
position. In this case it is asserting that word or otherword will be
followed by "<>". These are not terribly useful things, the negative
lookahead assertions is much handier, but they can do some fun stuff.
The RE /(?=text)book/ is guarranteed to fail.
The RE /(?=.*moo)(?=.*oort)/ will match a line that has both "moo" and
"oort", such as "oortmoo" or "moort".
The negative lookahead (?!text) assertion means that "text" will not
follow. They simplify some nasty REs considerably. Consider the case
of matching every line that begins with "S" but not "Subject" using
one RE.
/^S([^u]|.[^b]|..[^j]|...[^e]|....[^c]|.....[^t])/
doesn't quite work. (Why is an exercise for the reader.)
/^S(?!ubject)/
Does work.
Elijah
------
#!/usr/bin/perl -- -*- my ny.pm sig -*-
$_=$^ ;s;s;sss;;s^.^ju^&&s&P+&\n&&&(s(_..)(ers)||s|^|^^|)&&s(T)(q(st%eg))eg;
s<.(o).><$& new 1$$>i+s+\dst.+$a--||reverse(q(rep k))+ge;s*%.+u* so+*i;s=\++
="me"=mex&&s%ege%l$"hke%;$a||s/^\S+ /\/\//;s;\d+;yor;;s[KE]<ac$&>i;print $_;
------------------------------
Date: 20 Jan 1998 19:45:00 -0800
From: ml@gondwanaland.com (Mike Linksvayer)
Subject: sysread vs <>
Message-Id: <6a3qvs$se2$1@shell3.ba.best.com>
In my tests
my $buf;
open(F,"foo") || die $!;
my @stat = stat F;
sysread(F,$buf,$stat[7],length($buf));
close(F);
is over ten times as fast as
my $buf;
open(F,"foo") || die $!;
while (<F>) { $buf .= $_; }
close(F);
Is there any reason I should not use sysread to slurp up files in
a production environment?
--
Mike Linksvayer http://gondwanaland.com/ml/
------------------------------
Date: Tue, 20 Jan 1998 23:35:06 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: The camel and llama -- together at last!
Message-Id: <34C5967F.535B45A7@5sigma.com>
Actually this has nothing in particular to do with Perl, but:
http://www.cnn.com/EARTH/9801/20/cama.ap/index.html
-joseph
------------------------------
Date: Wed, 21 Jan 1998 02:37:41 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: triming whitespace
Message-Id: <480bb2b3aarhodri@wildebst.demon.co.uk>
In article <34c51a23.19941737@news.idx.com>,
<draggs@hawkeye.idx.com> wrote:
> Hello again. I'm a newbie and terible with regular expresions. I was
> wondering if there's a quick and easy way to get rid of extra spaces
> at the end of a variable?
$line ~= s/\s+$//;
"Find one or more whitespace characters (space, tab, newline, etc) at the
end of $line, and replace with nothing."
--
Rhodri James *-* Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them
... My heart is Danish, likewise is it blue
------------------------------
Date: Tue, 20 Jan 1998 20:16:06 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: triming whitespace
Message-Id: <6pl3a6.kr1.ln@localhost>
draggs@hawkeye.idx.com wrote:
: Hello again. I'm a newbie and terible with regular expresions. I was
: wondering if there's a quick and easy way to get rid of extra spaces
: at the end of a variable?
The Quick And Easy Way is to look up your Frequently Asked Question
in the Perl list of Frequently Asked Questions...
from Perl FAQ, part 4:
"How do I strip blank space from the beginning/end of a string?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 1689
**************************************