[8114] in Perl-Users-Digest
Perl-Users Digest, Issue: 1732 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 26 16:47:47 1998
Date: Mon, 26 Jan 98 13:00:34 -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, 26 Jan 1998 Volume: 8 Number: 1732
Today's topics:
Re: @ == @, comparing arrays (Craig Berry)
A Type Related Question <vchandra@mail.delcoelect.com>
Re: A Type Related Question <tchrist@mox.perl.com>
Re: Bad (Swear) Word Checking (I R A Aggie)
Re: BASE64 Decode <scottj@mthcsc.wfu.edu>
Re: Browser Identification? (brian d foy)
Re: CSV (comma separated, quoted) (Martin Vorlaender)
Re: Daemon for connection with Oracle <zenin@best.com>
Re: Decimal places <jefpin@bergen.org>
Re: diff that operates on Perl variables? <steveg_nospam@gcg.com>
do function (works on unix and doesn't on nt?) <keefner@kinetic.com>
Re: do function (works on unix and doesn't on nt?) <keefner@kinetic.com>
Evaluating stdin text (Roy S. Rapoport)
Re: Exporter/package question (dmouse)
Re: Help Setting up CGI.pm <keefner@kinetic.com>
Re: Help: file locking for writing into a file using fl <vallon@pearl.fi.bear.com>
Re: Help: file locking for writing into a file using fl (Andrew Williams)
Re: Howto match similar line item in different files? (Chip Salzenberg)
Re: HTML perl scripts for Windows NT (Earl Hood)
Re: living and free software (was: Re: source into bina (John Stanley)
Re: Local module bundles? <barnett@houston.Geco-Prakla.slb.com>
Localising $. (Neil Briscoe)
Re: multithread perl <zenin@best.com>
Re: OS shell in perl to do an FTP (I R A Aggie)
Re: OS shell in perl to do an FTP <david.x.corcoran@boeing.com>
Re: Perl Source Obfuscator <*@qz.to>
Re: Problem in deleteing temp files in Windows NT (Earl Hood)
Simple perl check. <ed@ncia.net>
Re: Simple perl check. (Tad McClellan)
Re: Some help with the 'reverse' command please..... <jefpin@bergen.org>
Re: Sort help please (M.J.T. Guy)
Re: substitute... (Tad McClellan)
Re: Survival Of perl <zenin@best.com>
Re: White Hats and Black (John Stanley)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Jan 1998 20:45:43 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: @ == @, comparing arrays
Message-Id: <6aisln$qe9$1@marina.cinenet.net>
Vladimir Alexiev (vladimir@cs.ualberta.ca) wrote:
: One can't answer this correctly before one knows what kind of equality
: is had in mind. Eg if you use stringization or (string) eq, these are
: not equal: ("5") and ("5.0"). They are equal if you use (numeric) ==.
True, but one could easily posit that the form of equality desired is
specfied by function reference, by analogy with the sort comparison
system. So one could phrase the specification as:
Given a comparison function on list elements, and two lists,
determine whether the two lists are identical in the sense that
they have the same number of elements, and each pair of same-index
list elements returns true from the comparison function.
I don't see any way to solve this general problem short of 'brute force':
sub arraysEqual # Untested!
{
my ($cfuncref, $aref, $bref) = @_;
return 0 unless scalar @$aref == scalar @$bref;
foreach my $ix (0..(@$aref - 1)) {
return 0 if &$cfuncref($aref->[$ix], $bref->[$ix]) != 0;
}
return 1;
}
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 26 Jan 1998 13:12:54 -0500
From: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: A Type Related Question
Message-Id: <34CCD226.4C79@mail.delcoelect.com>
I read in a time value from a disk file and use it as a
float value.
The code looks something like this:
while (<TESTDATA>) {
($time, @temp) = split(/\s+/,$_); # Line 2
$time = $time - 0.0; # Line 3
}
The $time in Line 2 is a string. I do the bogus Line 3
to convert it into a float.
The above seems to work. However, there must be a better
way than the above to perform type conversions and would
appreciate input.
Regards.
V.Chandrasekhar
------------------------------
Date: 26 Jan 1998 19:02:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: A Type Related Question
Message-Id: <6aimjj$2ac$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"V. Chandrasekhar" <vchandra@mail.delcoelect.com> writes:
:I read in a time value from a disk file and use it as a
:float value.
:
:The code looks something like this:
:
:while (<TESTDATA>) {
: ($time, @temp) = split(/\s+/,$_); # Line 2
: $time = $time - 0.0; # Line 3
:}
:
:The $time in Line 2 is a string. I do the bogus Line 3
:to convert it into a float.
:The above seems to work. However, there must be a better
:way than the above to perform type conversions and would
:appreciate input.
There is: simply ignore it. Perl doesn't care, so why should you?
Perl works hard to make life easy for you, and the facilities it provides
for manipulating numbers are no exception to that rule. If you treat
a scalar value as a number, Perl will convert it to one. This means
that when you read ages from a file, or extract digits from a string,
or acquire numbers from any of the other myriad textual sources that Real
Life pushes your way, you don't need to jump through the cumbersome "turn
this ASCII string into a number" hoops that other languages expect you to.
Perl tries its best to interpret a string as a number when you use
it as one (such as when you use it in a mathematical expression),
but has no direct way of reporting that a string doesn't represent a
valid number. Perl quietly converts (Somewhat quietly: the -w flag will
warn of improper conversions) non-numeric strings to zero, and will stop
converting the string as soon as it reaches a non-numeric character (so
"A7" is still 0).
See perlfaq4.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like
reading a suicide note -- three days too late."
--Tom Christiansen <tchrist@mox.perl.com>
------------------------------
Date: Mon, 26 Jan 1998 14:27:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Bad (Swear) Word Checking
Message-Id: <fl_aggie-2601981427120001@aggie.coaps.fsu.edu>
In article <6aie5q$msa$1@prometheus.acsu.buffalo.edu>,
pventura@cs.buffalo.edu (Philip R Ventura) wrote:
+ And of course all these posts saying the original does not belong here
+ because it was not /really/ dealing with perl are relevant.
Yes, they are.
+ Interesting double-standard.
No, it isn't. Its called 'maintenance' -- if we didn't say "go ask somewhere
else", we'd be eyeball-deep in CGI questions, most which have _nothing_ to
do with perl, per se. We also don't want people saying that clpm doesn't
answer questions.
Any other objections?
James
--
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: Mon, 26 Jan 1998 13:17:40 -0500
From: Kevin Scott <scottj@mthcsc.wfu.edu>
Subject: Re: BASE64 Decode
Message-Id: <34CCD344.35C7DFAE@mthcsc.wfu.edu>
The Smiths wrote:
>
> Hi,
>
> Before I write one, I was wondering if a BASE64 decode routine might already
> be available in PERL?
[snip]
There's a MIME::Base64 module available on CPAN. Check
http://www.perl.com to find the CPAN mirror nearest you.
Kevin.
--
****** Kevin Scott
******** Department of Mathematics & Computer Science
******** Wake Forest University
****** scottj@mthcsc.wfu.edu
------------------------------
Date: Mon, 26 Jan 1998 15:33:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Browser Identification?
Message-Id: <comdog-ya02408000R2601981533260001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34CC27F2.66F8@tuique.com>, Peter Crockford <wha@tuique.com> posted:
>darkcyde wrote:
>>
>> Hello,
>>
>> I am writing a Perl script to do browser identification, does anyone
>> know of a web site that has all the latest UserAgent variables for all
>> the latest browsers.
>>
>> I need them for Netscape Navigator 3.0, Netscape Communicator 4.0,
>> Internet Explorer 3.0, and Internet Explorer 4.0.
>>
>> Thanks,
>> Michael Bazaillion
>> --
>> So Brain, whatdya wanna do tonight?
>> Same thing we do every night, Pinky. Try to take over the world!
>
>Hi Michael,
>
>I have been compiling a list of USER_AGENT values for various browsers.
>Thanx go out to Eli for the Lynx info. Anyone else??
have you looked at the CGI::MozSniff module feature in the Perl
Journal's Perl News this issue?
you might also wander over to BrowserWatch [1].
[1] <URL:http://browserwatch.internet.com>
--
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: Mon, 26 Jan 1998 19:03:09 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: CSV (comma separated, quoted)
Message-Id: <34cccfdd.524144494f47414741@radiogaga.harz.de>
Andy Lester (petdance@maxx.mc.net) wrote:
: Ken Stevens (kordsmen@kordsmen.org) wrote:
: : I am very new to Perl programing... I have installed a great program
: : called PerlShop that works wonderfully. The only problem is that it
: : saves the data in CSV
: Look for the Text::CSV module.
The quotewords() function of the Text::ParseWords module comes with the
standard distribution. I recently used it with an Excel-generated CSV -
works like a charm.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: 26 Jan 1998 20:39:15 GMT
From: Zenin <zenin@best.com>
Subject: Re: Daemon for connection with Oracle
Message-Id: <885847370.816907@thrush.omix.com>
David Tauzell <dtauzel@uswest.com> wrote:
: You might be able to use a modified version of the DBI proxy module
: (can't think of the name) to do this. You would just have to modify the
: server part so that it maintained some kind of connection cache.
:
: Then all you would have to change in your applications is the call that
: loads your DBI driver.
DBD::pNET
Hmm, looks good from the readme. I'll have to check this out.
Thanks!
--
-Zenin
zenin@best.com
------------------------------
Date: Mon, 26 Jan 1998 15:19:39 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Honza Pazdziora <adelton@fi.muni.cz>
Subject: Re: Decimal places
Message-Id: <Pine.SGI.3.95.980126151650.8087A-100000@vangogh.bergen.org>
>> How do I control the number of decimal places or better still extract the
>> integer from a scalar variable. For instance :
>>
>> $a = 1234;
>> $b = 23;
>> $percent = $b/$a*100;
>>
>> How do I stop '$percent' displaying as 1.8638574 or whatever. Is there an
>> int() function or something similar to left(), mid() which I could use as if
>> it were a string.
Any C people (which I am not) could tell you that Perl is nice enough to
have imported printf... in other words, do:
$percent = sprintf "%.2f", $b*100/$a;
perldoc perlfunc
/----------------------------------------------------------\
| I only please one person a day, and today ain't your |
| day... (tomorrow's not looking good either!) |
| - Anonymous |
\----------------------------------------------------------/
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
techmaster@mindless.com | jpinyan@sdf.lonestar.org
techie@continuum.eu.org | too many addresses!!!
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: Mon, 26 Jan 1998 14:28:38 -0600
From: Steve Goldstein <steveg_nospam@gcg.com>
Subject: Re: diff that operates on Perl variables?
Message-Id: <34CCF1F6.41C6@gcg.com>
I don't know how a "diff" module might behave in general, I think it
should be consistent with UNIX diff (or gnudiff) in the following two
senses (which may not be consistent with each other):
1. The "perl diff" of two scalars should contain the same information
that you'd get from creating two text files from the scalars and then
doing a diff on the files.
2. A "perl diff" on two arrays might be like a unix diff on files whose
lines are the elements of the array. The line numbers in the unix diff
output could correspond to the indices of the elements of the array.
(Of course, you have to deal with the fact that line numbers start at 1
and array elements at 0.)
Joseph N. Hall wrote:
>
> I don't believe there is a module that does this at present.
> How exactly should the differences be represented in the output?
> ???
------------------------------
Date: Mon, 26 Jan 1998 12:51:55 -0600
From: "Craig A. Keefner" <keefner@kinetic.com>
Subject: do function (works on unix and doesn't on nt?)
Message-Id: <34CCDB4A.CEB7F0EA@kinetic.com>
I have a script that runs on my solaris just fine
to pop up states locations via CGI.p. the script part is
print "State: $nbsp";
$program="states.pl";
do "$program";
All states pl is
print "\n<select name=require:State>";
print "\n<option value=AK>AK</option>";
print "\n<option value=AL>AL</option>";
etc...
Under NT and 315 perl nothing happens and no error
reports. Screen comes up with no states scroll box.
Any help/bangs on the head appreciated!
Craig
------------------------------
Date: Mon, 26 Jan 1998 13:07:10 -0600
From: "Craig A. Keefner" <keefner@kinetic.com>
Subject: Re: do function (works on unix and doesn't on nt?)
Message-Id: <34CCDEDE.ADA11026@kinetic.com>
Craig A. Keefner wrote:
> I have a script that runs on my solaris just fine
> to pop up states locations via CGI.p. the script part is
>
> print "State: $nbsp";
> $program="states.pl";
> do "$program";
> Under NT and 315 perl nothing happens and no error
> reports. Screen comes up with no states scroll box.
Sorry to answer own question but once I moved the subroutine
from cgi-bin to usr/local//bin, it works fine. the sun box can run it fine
from cgi-bin.
------------------------------
Date: 26 Jan 1998 11:51:30 -0800
From: rsr@best.com (Roy S. Rapoport)
Subject: Evaluating stdin text
Message-Id: <6aipg2$igv$1@shell3.ba.best.com>
Got an interesting (for me :) ) problem:
I'm trying to do some text parsing on an input text file. Ideally,
I'd like the textfile to have lines of the form
This is a line with $i things in it
This is a line with $i++ things in it
This is another line with $i++ things in it
And, if the perl script defines $i = 0, it should output
This is a line with 0 things in it
This is a line with 0 things in it
This is another line with 1 things in it
Now, the perl faq ('How do I unescape a string?' and 'How do I expand
function calls in a string?') covers this. Sort of. The first
subject covers very well something like
"This is a line with $i in it", but not
"This is a line with $i++ in it"
The second covers $i++, but not when you're reading it from stdin. I
need something like "How do I unescape and expadn function calls in a
string?" I suppose.
Any ideas where I could look for examples?
-roy
------------------------------
Date: 26 Jan 1998 18:42:52 GMT
From: gt1535b@acmey.gatech.edu (dmouse)
Subject: Re: Exporter/package question
Message-Id: <6ailfc$gf0@catapult.gatech.edu>
Tom Phoenix (rootbeer@teleport.com) wrote:
: On 23 Jan 1998, dmouse wrote:
: > What I wanted to know is if, when I import variables from One in Two,
: > are those the same variables that weren't imported from One in Top,
: > or does Perl create a whole other instance of the the package One?
: Importing doesn't normally create new variables; it gives new names (in
: the current package) for existing ones (from another package). Is that
: what you needed to know? Hope this helps!
But what if two packages both import a variable from the same third package.
Do they work like references where a change is propogated throughout
the rest of the other packages?
And what about Exporter? When more than one package has 'use Exporter' does
Perl compile the Exporter code each time?
Thanks,
Daryl
: --
: Tom Phoenix http://www.teleport.com/~rootbeer/
: rootbeer@teleport.com PGP Skribu al mi per Esperanto!
: Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
: Ask me about Perl trainings!
--
<>< Daryl Bowen <><
Georgia Institute of Technology
E-mail: gt1535b@prism.gatech.edu
Siemens Telecom Networks Co-op
------------------------------
Date: Mon, 26 Jan 1998 12:36:32 -0600
From: "Craig A. Keefner" <keefner@kinetic.com>
To: corey andersen hammer <c-hammer@students.uiuc.edu>
Subject: Re: Help Setting up CGI.pm
Message-Id: <34CCD7AF.DDD6B4F3@kinetic.com>
corey andersen hammer wrote:
> I'm trying to set up CGI.pm for a project I'm working on
> for my research interests in psychology. Unfortunately, I know next to nothing about PERL. The CGI.pm webpages at www-genome.wi.mit.edu tell me I need patch 7or universal.pm to make cgi.pm work. Everything, I find at CPAN is tar or gz
> encoded, and I'm using Win95. I also can't even find patch 7 to PERL 5.
1. make sure you have the latest 315 build of perl off Activeware.
2. go to the genome site and get the released 2.36 zip.
3. unzip it and assuming you have perl in \usr\local\bin copy CGI.pm to \usr\local\lib
4. make a subdir in lib named CGI and copy all of the files in the
CGI distribution directory CGI into there (Carp.pm is the one).
All that is in the directions on L. Steins page too..
thats it I think
Craig
------------------------------
Date: 26 Jan 1998 13:10:10 -0500
From: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: Help: file locking for writing into a file using flock() and seek().
Message-Id: <x6ehg6rw1h9.fsf@pearl.fi.bear.com>
Tommy <tkho@technologist.com> writes:
> Does anyone know how to lock a file while a script is writing a file.
> What I need is to have a subroutine that:
> 1. check if the file is locked
> 2. lock a file from the next user when the file is not locked
> 3. wait for 5 retries, each 2 sec apart when the file is locked
> 4. prompt user if the waiting is timeout.
> 5. write data to a file
>
> Here is a part of my script which I have no idea whether it works.
>
> my $LOCK_EX= 2;
my $FLOCK_EX = 2;
> my $LOCK_UN= 8;
my $FLOCK_UN = 8;
>
> open(DATAFILE, "< Datafile.txt")
# I think you want to write, or append, right?
open(DATAFILE, ">> Datafile.txt") || die "Could not open file";
> || die &wait(30);
> flock(DATAFILE, $FLOCK_EX); # Lock
This mode will block (wait for the lock). Add $FLOCK_NB to mode to return
immediately, with or without the lock.
my $FLOCK_NB = 4; # NoBlock
{
local $num = 5;
local $retry = $num;
while (!flock(DATAFILE, $FLOCK_EX + $FLOCK_NoBlock)) {
if (!--$retry) {
print STDERR "Did not get lock after $num retries\n";
exit 1;
}
sleep 2;
}
}
> seek(DATAFILE, 0, 2); # No idea what it is
seek repositions for subsequent reads/writes. If you are writing to the file,
you should open(DATAFILE, "> Datafile.txt"). If you are always/only
appending, use ">> Datafile.txt".
>
> print DATAFILE "$FieldLn"; # Write Data
> ...
> ...
>
> flock(STDOUT, $FLOCK_UN); # Unlock
# Your locks are given up when you close. This flock is redundant adjacent to
# the following close.
> close(DATAFILE);
> return "Update Data ID:$KEY: Update Successfully";
>
> I'm really appreciate for your help.
> --
>
> Tommy =P
> E-mail & E-Voice Mail: tkho@technologist.com
>
>
--
-Justin
vallon@bear.com
------------------------------
Date: Mon, 26 Jan 1998 15:56:56 GMT
From: andrew@edoc.com (Andrew Williams)
Subject: Re: Help: file locking for writing into a file using flock() and seek().
Message-Id: <34ccb0d8.331253953@news.clark.net>
On Fri, 23 Jan 1998 17:13:59 -0800, Tommy <tkho@technologist.com>
wrote:
>Does anyone know how to lock a file while a script is writing a file.
>What I need is to have a subroutine that:
>1. check if the file is locked
>2. lock a file from the next user when the file is not locked
>3. wait for 5 retries, each 2 sec apart when the file is locked
the OS should know enough to put the process to sleep until the file
becomes un locked, you should not have to manually do the waiting.
>4. prompt user if the waiting is timeout.
>5. write data to a file
>
>Here is a part of my script which I have no idea whether it works.
basic block outline for how this works:
writer:
open exclusive lock on the file
write to the file
remove exclusive lock
reader:
open shared lock on the file
read from file
remove shared lock
I think this is the basic plan I used for locking. I don't feel like
looking up the actual code I used but this should work. If you still
have problems mail me. Reading up on how flock works would most
likely be really helpful.
Point to remember, these are permissive locks, the software has to
check to see if the file is locked, the os does not enforce this at
all.
------------------------------
Date: Mon, 26 Jan 1998 20:41:34 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Howto match similar line item in different files?
Message-Id: <6aishf$cm5$1@cyprus.atlantic.net>
According to r.hazeltine@nepean.uws.edu.au:
>I want to join the contents of the second file to the reciprocal line in
>the first file
If this is a stand-alone utility need, then you should look into one
of the many freely available "join" programs.
Otherwise, it's probably best to read one file into a hash, then read
the next file and add on to each hash value the new fields.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
-> Ask me about Perl training and consulting <-
"We can shower it with neutrons."
"Or we can do the Neutron Dance!" // MST3K
------------------------------
Date: 26 Jan 1998 19:25:35 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: HTML perl scripts for Windows NT
Message-Id: <6ainvf$lhp@news.service.uci.edu>
In article <genepoolEnAr7I.AJD@netcom.com>,
Jim Michael <genepool@netcom.com> wrote:
>Scott Willsey (Scott_A_Willsey@ccm.fm.intel.com) wrote:
>: jlk wrote:
>: > How about Windows NT?
>: > I don't think I can use #!/usr/local/bin/perl as perl path.
>: You're right. But you can use #!c:\perl or wherever you installed perl
>: win32 to.
>
>The shebang line is ignored other than switches such as -w, so you can
>leave the !#/usr/bin/perl there for compatibility on *nix boxes.
The Apache port to Win32 uses the #! line. You use '/' instead of
'\' as the directory separator (eg #!c:/perl/bin/perl).
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 26 Jan 1998 18:41:57 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <6aildl$1j9$1@news.orst.edu>
In article <eyhra5w8rwg.fsf@liddell.cstr.ed.ac.uk>,
Richard Caley <rjc@liddell.cstr.ed.ac.uk> wrote:
>In article <6a5nvc$36p$1@news.orst.edu>, John Stanley (js) writes:
>
>js> That's nice. Now provide proof that those who hoard code are harmful to
>js> society.
>
>Are people who sell some other kind of broken product causing harm?
Nice try. "casuing harm" is not the same as "causing harm to society."
>Depends on your defnitions. People can choose to buy software with
>source as they can choose to buy quality video tapes.
Another nice try. Nobody said they can't choose, or want to choose.
>Some people
>still think that those who sell software sans source or video tapes
>which turn to snow simulators after a few uses are not nice.
Another nice try. "Not nice" is a long way from "causes harm to
society."
>This is no more an argumnet against the usefulness of source
Since I am not making a general argument against the usefullness of
source, I guess then that it's ok that this isn't a general argument
against the usefullness of source. Nice try, though.
------------------------------
Date: Mon, 26 Jan 1998 11:52:52 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: tdahm@montesano.com
Subject: Re: Local module bundles?
Message-Id: <34CCCD74.4251F900@houston.Geco-Prakla.slb.com>
tdahm@montesano.com wrote:
>
> Is there any way to install a local copy of an entire Perl bundle?
>
> I know how to install a local version of just one module, but trying to
> do this for an entire bundle, like libnet, is giving me fits. Any ideas?
>
What kind of fits? I installed libnet successfully into my home lib
area without too much horsing around.
perl Makefile.PL PREFIX=~/lib
(Change PREFIX as appropriate).
HTH.
Dave
> Please reply by email. Thanks.
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: 26 Jan 1998 18:25:15 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Localising $.
Message-Id: <memo.19980126182514.21993A@skep.compulink.co.uk.cix.co.uk>
I wrote a Perl script today whose purpose was to read through a
set of files containing keywords and use an .htm template file.
>From this lot, it had to generate a whole dose of .htm files -
with two keywords a piece, with special processing based on
line numbers.
In my main routine, the variable @files will already contain
the list of text files I have to work with, then it reads :-
foreach $file (@files) {
local($.);
open(KEYFILE, $file);
while(<KEYFILE>) {
if (($. % 2) == 1) {
$key1 = $_;
}
$key2 = $_'
writefile($key1, $key2 ...);
}
close(KEYFILE);
And then, in the writefile subroutine, I'm localising $. again.
What I'd like to know is will $. range from 1 to n for each
$file - and will $. range, separately, from 1 to n in the
subroutine.
I decided to localise $. because the Camel said you could - and
I understand it changes Perl's understanding of last read from
filehandle.
Regards
Neil
------------------------------
Date: 26 Jan 1998 18:53:09 GMT
From: Zenin <zenin@best.com>
Subject: Re: multithread perl
Message-Id: <885841004.341308@thrush.omix.com>
David Efflandt <efflandt@xnet.com> wrote:
: Chuck Chiang <ctc@cisco.com> wrote:
: >I heard that there has been some work done to make Perl multithreaded.
Yes.
: >Could anyone tell me where to find information about this?
The perl5 porters mailing list. Check the Perl home page for
details about the list. If you just enjoy pain and don't want
to know the details, you can download a development version from
your local CPAN.
: >Please send email directly to me at ctc@cisco.com.
No. If you don't have time to do a 2 second scan for "multithread"
in this group, I don't have time to stick a Cc header in the reply.
: >thanks very much
You're welcome.
: I don't know the actual difference between multitasking and
: multithreading, but I have run 5 processes at once with 4 pipes
: between them in Linux.
That's multiprocessing (which requires multitasking), not
multithreading.
: The main perl script forked a separate process to feed fifo1, a child
: process to pipe fifo2 to the parent, a pipe in from external program1
: and another pipe to program2 that output a progress guage to the
: screen, all simultaniously.
This is a good example of IPC, but it's not multithreading.
: That certainly is multi-something.
Yes, it is. As well as being (at present...) far more portable and
reliable then a "multithreaded" program would have been.
--
-Zenin
zenin@best.com
------------------------------
Date: Mon, 26 Jan 1998 14:16:28 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: OS shell in perl to do an FTP
Message-Id: <fl_aggie-2601981416280001@aggie.coaps.fsu.edu>
In article <885821308.131989506@dejanews.com>, Dave Barstow
<deja-jan98-perl@trouser.demon.co.uk> wrote:
+ I need to a UNIX perl code fragment that will ftp a file from another
+ machine. In a shell script I would do something like:
[deletia]
+ where the variables would be defined ealier in the script.
+ Any ideas? I don't want to use a .netrc file and I don't want to
+ use any extra libaries (such as libnet)
Well, since you don't want to use extra libraries:
$ftp_command=qq(echo "open $SERVERHOST\
user $ACCT $PASS\
bin \
prompt \
mget *.gif \
quit" | ftp -n -v);
open(FTP,$ftp_command) or die $!;
Completely untested, and most likely won't work as-is, and totally smart-assed.
But you get the principle, yes?
James - this is the reason we use things like libnet...
--
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: Mon, 26 Jan 1998 19:49:07 GMT
From: David Corcoran <david.x.corcoran@boeing.com>
Subject: Re: OS shell in perl to do an FTP
Message-Id: <34CCE8B3.379@boeing.com>
Dave Barstow wrote:
>
> Hi
>
> I need to a UNIX perl code fragment that will ftp a file from another
> machine. In a shell script I would do something like:
> echo "open $SERVERHOST\
> user $ACCT $PASS\
> bin \
> prompt \
> mget *.gif \
> quit" | ftp -n -v
> where the variables would be defined ealier in the script.
> Any ideas? I don't want to use a .netrc file and I don't want to
> use any extra libaries (such as libnet)
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
How 'bout:
open(FTP,"|ftp -n -v") || die "can't $!";
print FTP <<EOT;
open $SERVERHOST
user $ACCT $PASS
bin
prompt
mget *.gif
quit
EOT
close(FTP);
------------------------------
Date: 26 Jan 1998 20:43:56 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Perl Source Obfuscator
Message-Id: <qz$9801261513@qz.little-neck.ny.us>
Cameron Dorey <camerond@mail.uca.edu> wrote:
> Nick wrote:
> > There are utilities available which make C source code unreadable, yet
> > compilable. The purpose is to distribute source code for
> > recompilation, but without revealing trade secrets etc.
> >
> > These type of source code filters are called sometimes called Shrouds
> > or Obfuscators.
> >
> > Does anything like that exist for Perl?
>From RFC 1925:
With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead.
I think it apt here.
> Well, after reading this nwesgroup for a while now, I would say yes, and
> his name is Eli the Bearded (at least for regexps). ;^)
It is amazing what you can coerce into the /e portion of a s///e.
Elijah
------
perl -we '$_="anVzdCBhbm90aGVyIG5ldyB5b3JrIHBlcmwgaGFja2VyCg==";
s/.*/eval"use MIME::Base64",decode_base64($&)/e;print;'
------------------------------
Date: 26 Jan 1998 19:01:09 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Problem in deleteing temp files in Windows NT
Message-Id: <6aimhl$kn6@news.service.uci.edu>
In article <Pine.GSO.3.96.980124215836.27755S-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>I use something like this under Unix; no doubt you'll need to adapt it for
>your machine.
>
> my $temp_prefix = "/tmp/$0.temp.$$.$^T"; # Probably unique :-)
> my $first_temp_file = "$temp_prefix.A";
> my $second_temp_file = "$temp_prefix.B";
Or try IO::File::new_tmpfile(), if supported under Win32.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: Mon, 26 Jan 1998 13:45:17 -0500
From: Ed Paquette <ed@ncia.net>
Subject: Simple perl check.
Message-Id: <34CCD9BD.8FDC010C@ncia.net>
I want to check a text file for a given string, if it's found I want it
to tell me and STOP checking immediately... What is the **FASTEST** way
to accomplish this?
Basically the equivalent of this /bin/sh snipet:
grep -i "foobar" $filename > /dev/null
if [ $? -eq 1 ] ; then
... Stuff to do when foobar is NOT found in $filename...
fi
Thanks for any help!
Ed Paquette
ed@ncia.net
------------------------------
Date: Mon, 26 Jan 1998 13:47:18 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Simple perl check.
Message-Id: <68pia6.41f.ln@localhost>
Ed Paquette (ed@ncia.net) wrote:
: I want to check a text file for a given string, if it's found I want it
: to tell me and STOP checking immediately... What is the **FASTEST** way
: to accomplish this?
: Basically the equivalent of this /bin/sh snipet:
: grep -i "foobar" $filename > /dev/null
: if [ $? -eq 1 ] ; then
: ... Stuff to do when foobar is NOT found in $filename...
: fi
perl -ne 'exit 1 if /a given string/' <filenames...>
returns 256 if found (1 in the high order 8 bits) if found,
else returns zero.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 26 Jan 1998 15:25:33 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Steel Viper <sviper@inav.net>
Subject: Re: Some help with the 'reverse' command please.....
Message-Id: <Pine.SGI.3.95.980126152142.8087B-100000@vangogh.bergen.org>
The problem was this:
@array = reverse(@array);
print "\n@array\n"; # prints the array
print "\n" . reverse(@array) . "\n"; # prints each line backwards
# in backwards order
print "\n", reverse(@array), "\n"; # prints the array backwards
The problem was using the concatenation operator (.), which indicates a
string, instead of the comma (,) which indicates a list.
Phoenix - have anything to say? Am I totally wrong?!
/----------------------------------------------------------\
| WYSIWYG? More like WUSSIWYG... Text Editors Rule!!! |
| - Jeff Pinyan |
\----------------------------------------------------------/
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
techmaster@mindless.com | jpinyan@sdf.lonestar.org
techie@continuum.eu.org | too many addresses!!!
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: 26 Jan 1998 17:52:07 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Sort help please
Message-Id: <6aiig7$8sc$1@lyra.csx.cam.ac.uk>
In article <6ab86k$cl5$3@usenet76.supernews.com>,
Andy Lester <petdance@maxx.mc.net> wrote:
>: : for $name1 (sort { $temp{$a} cmp $temp{$b} } keys %total) {
>: cmp compares strings.
>: <=> compares numbers.
>
>I believe the -w flag would have caught this.
Nope. Sadly, -w isn't the cure for all the worlds problems.
cmp is quite happy to compare (the stringified forms of) numbers.
But -w would have caught that you are saying $temp{$a} when you
probably mean $total{$a}.
Mike Guy
------------------------------
Date: Mon, 26 Jan 1998 13:39:20 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: substitute...
Message-Id: <8poia6.cue.ln@localhost>
Johan Eriksson (nivek@hem2.passagen.se) wrote:
: I just wonder if there is a way to change some characters in a file like
: "\n"(newline) into "<br>". There are certainly some way to do it, but
: since my experience with perl isn't that good yet I haven't figured it
: out.. I suppose I should use s/// but I dont understand how yet...
: Someone who can help me out? Or point me too some further explanations
: about this topic except the perlop....
Your Frequently Asked Question is in the Perl FAQ, part 5:
"How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Jan 1998 20:33:07 GMT
From: Zenin <zenin@best.com>
Subject: Re: Survival Of perl
Message-Id: <885847002.494870@thrush.omix.com>
Frank <FHeasley@chemistry.com> wrote:
: perl is a very useful language for interfacing users to systems via
: the world wide web.
Just one of *hundreds*, if not *thousands*, of uses...
While I am the primary Perl expert at a mostly Internet/Intranet
development company, only about 1/10 of my work is in CGI or
similar "web interfacing" programming. The other 90% is heavy
Unix systems level and network programming because of Perl's vary
fast development cycle. Since these applications rarely have short
process life cycles, start up costs are not important and so it's
speed rivals comparable C code.
: In fact, that is probably where most of the new
: users are coming from.
Maybe so, maybe not. Either way I'd still say that web application
programming is still a vary small piece of the bulk of Perl code
being developed.
: It's also a very useful language for dealing with text on unix based systems
: - I suspect that that is where much of its past strength is derived from.
That's where it got it's roots, however it has since grown into an
vary flexible and fast general purpose language. Yes, if I must do
text processing my first choice is Perl, however as I stated above
such use is rarely in my work routine and I'm sure there are
thousands of other Perl programmers that use these features just as
little as I do.
: Which brings me to the next point. It's all well and good to advise
: people to "use the perl modules" when the modules are pre-installed in
: the version of perl you're using, or if you are writing programs on a
: unix based system and can easily run makefile.
Hmm...careful, you're about to make a fool of yourself.
: However, most new users are windows based, and are writing programs in
: dos windows under windows 95.
Hmm, and you get your data from where, exactly..? It's not from
this news group I assure you...
: To them, perl modules are often useless.
Woops! Now you've gone and made a fool of yourself. I warned you
about that, didn't I...?
Hundreds of the pure Perl built modules will work out of the
box on Win32 systems, and many of the ones that use linked C code
not only will compile and run fine under Win32 they oftin are also
available in precompiled packages for users without a compiler and
are too lazy to install the Cygnus ported tools.
: Similarly, the vi and emacs editors may indeed be very useful for
: writing perl programs under UNIX, but unless you're willing to go out
: and find (and learn) a windows or dos based version of them, they're
: useless for most new users.
You just like looking like a fool, don't you?
First off, what the hell do vi and emacs have to do with perl???
Perl code is a simple text file. Granted, it's much easier to
code using an editor that's built for code editing, but this is
true with ALL software languages.
Vi and emacs are not the end all be all of code editors, nor are
they even the best (vi vs emacs vs whatever wars not withstanding).
For myself, I do 99% of my work under Unix, yet I find vi clunky
and emacs *far* to bloated, so I use an editor called "joe" (Joe's
Own Editor). When I'm on (blgh) windows machines, the DOS version
of joe works just fine.
For those that like vi and emacs, guess what? THEY ARE BOTH FREELY
AVAILABLE FOR BOTH DOS AND WINDOWS! A 2 min search on Yahoo will
find DOZENS of sights to download them from.
: In order for perl to survive, it must continue to grow.
Have you *ever* been to CPAN??!?!?! Do you follow the p5p mailing
list?!?!?! You must get all your info from the "Web Surfer
Weekly" mags...
: And in order
: to grow, it must continue to meet the needs of established and new
: users.
See my last comments.
: For the time being, perl is successful in that regard.
For the last 10 YEARS Perl has been FANTASTIC in that regard.
: However, there are powerful corporations who have vested interests in
: competitive languages for web interfacing, and they will continue to
: enhance those languages.
Yes, and so far not one has turned out as anything but a piece of
trash (IMHO, YMMV). Name ONE that even comes close to Perl in the
real world, I dare you.
: If perl remains competitive with them, then
: it will survive. If not, it will be replaced.
The same argument can be said for EVERYTHING in the world, not even
just the computer world.
--
-Zenin
zenin@best.com
------------------------------
Date: 26 Jan 1998 18:57:57 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: White Hats and Black
Message-Id: <6aimbl$ajb$1@news.orst.edu>
In article <lcn2gj9lu6.fsf@duncan.cs.utk.edu>,
Myles Barrett Williams <a@b.c.d> wrote:
>Tom Christiansen <tchrist@mox.perl.com> writes:
>> But I cannot see how anyone could say the freeing of
>> course as a bad thing. You're not saying it is, are you?
I haven't seen anyone say that yet. The "freeing" isn't, "of course",
a bad thing. What happens to the value of the browser as a result
may be a bad thing.
>If you're talking about morals, that's purely a matter of opinion. If
>you're asking whether this is a wise strategic move, on Netscape's
>part, I'd say no, it's downright stupid. I predict Netscape will find
>that they can't even give their browser away. It will end up being
>the favorite of hackers, but it's pretty much finished as an end-user
>browser.
Yes, it will be interesting to see how much support Netscape continues
to provide to their child. I have already seen comment here about
putting hooks for a perl equivalent to javascript/java into the free
browser, and I am sure that TCL/Python/whatever enthusiasts are licking
their lips over the possibility of putting their favorite language into
the browser. Will there be someone who incorporates all these changes,
and the others that are sure to be made, into one "standard" browser
source, or will the end users be required to download 8 different
Netscape browsers because one site puts out java and another one perl
and another one tcl... and there is a different browser to support
each?
------------------------------
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 1732
**************************************