[9581] in Perl-Users-Digest
Perl-Users Digest, Issue: 3175 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 16 11:11:13 1998
Date: Thu, 16 Jul 98 08:00:57 -0700
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, 16 Jul 1998 Volume: 8 Number: 3175
Today's topics:
Re: "uniq -c"-like script <jhi@alpha.hut.fi>
Re: Annoying warning : Variable %s will not stay shared <jdf@pobox.com>
AWK Interpreter <irisbeau@wolsi.com>
Re: AWK Interpreter <simonf@conduit.co.uk>
Re: Better way of saying this. <domainsource@usa.net>
Re: Closing pipes results in "uninitialized value" <Eric.Zylberstejn@wanadoo.com>
Re: CRYPT on win32 <danboo@negia.net>
Re: databases on a Unix platform <domainsource@usa.net>
Re: efficiency: print<<"xxx" vs. print <dfan@thecia.net>
Re: efficiency: print<<"xxx" vs. print <dfan@harmonixmusic.com>
Re: efficiency: print<<"xxx" vs. print (Larry Rosler)
Re: FORMAT with numbers....? <Eric.Zylberstejn@wanadoo.com>
Free email script setups? Any clues ... <tomh@ncfweb.net>
getting a url that is not there <joe@rhein.to>
HELP : Integrating an Access DB with Perl <a.n.farrow@cranfield.ac.uk>
is IF statement BROKEN in 5.004? <wcatlan@bccom.com>
Re: Is it possible to create a STAND ALONE EXECUTABLE? dturley@pobox.com
Monitoring outgoing mail <sjurseth@x25.net>
Re: More musing on -w (Alan Barclay)
newbie date format <atropos@insomniac.keltti.jyu.fi>
Re: pattern matching with an = <xuchu@iscs.nus.edu.sg>
Re: pattern matching with an = (Tad McClellan)
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: Perl Beautifier Home Page <rra@stanford.edu>
Re: Perl Setup on NT (Steve Linberg)
Re: persistent objects <jhi@alpha.hut.fi>
Re: Putting CPAN on a CD: good or not good? (Thomas Dehn)
Re: PUZZLE: make hat, take ham (John Klassa)
Re: real quick and easy - replace.... merzky@physik.hu-berlin.de
Re: Restricting refering domains access to script? (Josh Kortbein)
Sony Test <steve.robinson@sonybpe.com>
Re: use strict merzky@physik.hu-berlin.de
Re: use strict (Steve Linberg)
Re: using perl to pass flags from checkboxes to databas <simonf@conduit.co.uk>
Re: using perl to pass flags from checkboxes to databas <maierc@chesco.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Jul 1998 16:01:45 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: "uniq -c"-like script
Message-Id: <oeebtqqeypy.fsf@alpha.hut.fi>
sweth-usenet@astaroth.nit.gwu.edu (Sweth Chandramouli) writes:
> i have a shell script to do this, but with an input file of a few megs,
> it takes hours to process. any advice on how to do this in perl?
perl -nle '($a,$b,$c)=split;$f{"$a\t$b"}+=$c;END{for(sort keys %f){print "$_\t$f{$_}}}' < in
At least in my machine this seemed to process a 22 MB test file in 70 s.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 16 Jul 1998 09:40:38 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: Annoying warning : Variable %s will not stay shared ...
Message-Id: <hg0hq2op.fsf@mailhost.panix.com>
Chris Wareham <chris.wareham@blackwell.co.uk> writes:
> my @ISA = qw(LWP::UserAgent);
Oops. Now nobody else can see what your module is, since my()
lexically scopes its operand. You mean
use vars qw( @ISA );
@ISA = qw( LWP::UsrAgent );
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Tue, 14 Jul 1998 05:44:41 -0700
From: "David Reynolds" <irisbeau@wolsi.com>
Subject: AWK Interpreter
Message-Id: <6okoic$et5$1@news.wolsi.com>
I am learning Perl and have have programmed a great deal in AWK. I was
looking for a perl program that converted AWK code to Perl. I would like to
see the differences between the two.
David
------------------------------
Date: Thu, 16 Jul 1998 13:31:32 +0100
From: "Simon Fairey" <simonf@conduit.co.uk>
Subject: Re: AWK Interpreter
Message-Id: <35adf1d0.0@nnrp1.news.uk.psi.net>
There is such a thing and it comes with the standard distribution its called
'a2p' and as the acronym would suggest it does just what you want...
Have fun
Simon
David Reynolds wrote in message <6okoic$et5$1@news.wolsi.com>...
>I am learning Perl and have have programmed a great deal in AWK. I was
>looking for a perl program that converted AWK code to Perl. I would like
to
>see the differences between the two.
>
>
>David
>
>
------------------------------
Date: Thu, 16 Jul 1998 10:00:05 -0400
From: "David Thompson" <domainsource@usa.net>
Subject: Re: Better way of saying this.
Message-Id: <6ol0qc$dkr$1@winter.news.erols.com>
Funny how the FAQ contains frequently asked questions. Never woulda
guessed :)
Thanks a lot for pointing me directly to the page I needed, I appreciate
it.
David
Andrew M. Langmead wrote in message ...
>"David Thompson" <domainsource@usa.net> writes:
>
>>$teststring = "something"
>>$allowed = "";
>>@allowed = qw (mary joe bob);
>>foreach $keystring (@allowed)
>> {
>> if ($teststring =~ /$keystring/i) {$allowed = "yup";}
>> }
>>unless ($allowed eq "yup") {die "Sorry, not found";}
>>----------
>
>>Now, is there an easier way to do that without a foreach? Thanks
much!
>
>Take a look at the FAQ entry "How do I efficiently match many patterns
>at once"
>
><URL:http://www.perl.com//CPAN/doc/manual/html/pod/perlfaq6/How
>_do_I_eficiently_match_many_.html>
>
>--
>Andrew Langmead
------------------------------
Date: Thu, 16 Jul 1998 15:19:31 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
To: Miguel Cruz <mnc@diana.law.yale.edu>
Subject: Re: Closing pipes results in "uninitialized value"
Message-Id: <35ADFDE3.3D755F5A@wanadoo.com>
Miguel Cruz wrote:
>
> Miguel Cruz <mnc@diana.law.yale.edu> wrote:
> > Whenever I close a descriptor that was a pipe opened for reading, I get the
> > following three error messages:
> >
> > Use of uninitialized value at blah blah, <PIPE> chunk blah
> > Use of uninitialized value at blah blah, <PIPE> chunk blah
> > Unable to create sub named "" at blah blah, <PIPE> chunk blah
>
> The plot thickens. I indeed get those error messages when running an older
> version of Perl:
>
> This is perl, version 5.003 with EMBED
>
> But after I decided it just had to be a bug in perl rather than with my
> gorgeous and flawless code, and upgraded to this version:
>
> This is perl, version 5.004_04 built for i386-linux
>
> my program just segfaulted instead. It also dumps core on a Sun with this
> perl:
>
> This is perl, version 5.004_01
>
> The inconsistency between the two versions leads me to believe that there is
> indeed some sort of problem with perl. (I find hubris to be a very useful
> diagnostic tool). If it will be faster, I would be willing to migrate my
> development to another language - I have heard high praise for python and
> tcl, though I don't know the first thing about either. All I want is
> rudimentary OO support, decent text manipulation, and good interaction with
> the OS. Any recommendations?
>
> For the curious, here's the new problem code:
>
> sub processExists {
> local $pr = pop (@_);
> $found = 0;
> open(PIPE, "ps -ax 2>&1 |");
> while (<PIPE>) {
> if ($_ =~ /\s*\S+\s+\S+\s+\S+\s+\S+\s+(\S*$pr\S*)/) {
> $found = 1;
> last;
> }
> }
> close PIPE; ## it dies on this line in perl 5.003
> $found;
> }
Strange. This kind of code works with Perl 5.004_04. If you are looking for a
process killer, here is mine :
#!/usr/local/progs/gnu/bin/perl -w
###############################################################################
# $Workfile: killproc.pl $ $Revision: 0.0 $
#
# Description : Process killer
#
###############################################################################
my ($uid, $pid, $ppid, $c, $stime, $tty, $time, $processName);
my (%parents, %names);
my @toKill;
# First check we have a parameter
defined $ARGV[0] or die "Usage : $0 processName\n";
open(PROCESSES, "ps -fu $> |");
# Skip comments (first line)
$_ = <PROCESSES>;
PROCESSES_LOOP: while (<PROCESSES>) {
# Get rid of the annoying '\n'
chop;
# Extract the PID, the PPID and the CMD
($uid, $pid, $ppid, $c, $stime, $tty, $time, $processName) = split;
# Skip our own process ($$ is the pid of this program)
next PROCESSES_LOOP if $pid == $$;
# Find the processes and store the a keys of a hash table. The papent
# process ID is the value
if ($processName =~ /$ARGV[0]/o) {
$parents{$pid} = $ppid;
$names{$pid} = $processName;
}
}
close PROCESSES;
for $pid (sort keys %parents) {
write;
}
$~ = STDOUT_BOTTOM; write;
# Create the list of processes with ppid not in the list
@toKill = grep ! exists $parents{$parents{$_}}, keys %parents;
# Kill what we found
if ($#toKill >= 0) {
print "Killing @toKill\n";
kill 2, @toKill;
} else {
print STDERR "No process found.\n"
}
format STDOUT_TOP=
+-------+-------+---------------------------------------------+
| PID | PPID | Name |
+-------+-------+---------------------------------------------+
.
format STDOUT=
| @#### | @#### | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
$pid, $parents{$pid}, $names{$pid}
.
format STDOUT_BOTTOM=
+-------+-------+---------------------------------------------+
.
Eric
------------------------------
Date: Thu, 16 Jul 1998 09:05:48 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: CRYPT on win32
Message-Id: <35ADFAAC.7AED333A@negia.net>
Rick K wrote:
>
> Brian Moffatt wrote in message ...
> >Why do I get a "paranoia" message when trying to use the crypt function
> [snip snap snip]
>
[snip]
>
> Don't know if the ActiveState still has it, pretty sure the
> "all-other-things-
> considered Gurusamy Sarathy - nice-being" doesn't have it, and probably
> never will.
not so, according to the latest issue of TPJ (#10). Gurusamy Sarathy
has a preview of 5.005 which mentions win32 support for times(),
wait(), waitpid() and crypt().
cheers,
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: Thu, 16 Jul 1998 10:05:27 -0400
From: "David Thompson" <domainsource@usa.net>
Subject: Re: databases on a Unix platform
Message-Id: <6ol148$f5t$1@winter.news.erols.com>
Check if they support an SQL database (using mySQL or one of the similar
interfaces). That's probably the easiest way to go that I know of...
<FlameSuit reason="making possible wrong generalization">
David Thompson
</FlameSuit>
Jeoff Micalizzi wrote in message <6ok4tl$53a$1@speedx1.speed.net>...
>Does anyone how to access a database on a web server using PERL cgi
scripts.
>I would like to keep a database on my (ISP's) web server wich is
running
>some flavor of Unix. What database formats are available. Can I put a
>Microsoft Access file or an Excel file or a dbase file on the server
and
>access it with PERL? Or is my only option to use text files?
>
>Any help is extremely appreciated,
>Thanks,
>Jeoff Micalizzi
>jeoff@geocities.com
>
>
------------------------------
Date: 16 Jul 1998 08:30:12 -0400
From: Dan Schmidt <dfan@thecia.net>
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <87u34im10r.fsf@razumovsky.thecia.net>
greenej@my-dejanews.com writes:
| In article <6ogisv$je0$1@netnews.upenn.edu>,
| rjking@blue.seas.upenn.edu (Rachel J King) wrote:
| > I'm wondering about the efficiency of using print<<"xxx" versus that of
| > just writing a whole bunch of print statements.
|
| I had a similar question yesterday, but I'm more interested in the
| question of style rather than efficiency.
|
| I have used pring <<TAG; several places in a script, but I had to
| keep inventing new TAGs for each print statement.
Why did you have to keep inventing new TAGs for each print statement?
What happened when you tried just reusing the same one?
--
Dan Schmidt -> dfan@alum.mit.edu, dfan@thecia.net
Honest Bob & the http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/
------------------------------
Date: 16 Jul 1998 09:44:38 -0400
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <wkzpe99agp.fsf@turangalila.harmonixmusic.com>
gorilla@elaine.drink.com (Alan Barclay) writes:
| In article <wku34kp087.fsf@turangalila.harmonixmusic.com>,
| Dan Schmidt <dfan@harmonixmusic.com> wrote:
| >rjking@blue.seas.upenn.edu (Rachel J King) writes:
| >I didn't see any difference when I tried it.
| >
| >====
| >
| >use Benchmark;
|
| There are two sorts of efficiency, 'use Benchmark;' can only measure
| the easy one, how long does the program take to run. The second sort,
| how long does the program take to develop and maintain, is much harder
| to benchmark, but my personal feeling is that a here document is going
| to be much easier to maintain.
Indeed.
I'm working on the Benchmark::Maintainability module right now, but
right now it's pretty slow; each iteration takes a year or so. I'll
have some preliminary results for PrintPrintPrint vs. HereDoc in the
early 21st century.
--
Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/
------------------------------
Date: Thu, 16 Jul 1998 07:45:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <MPG.1017b1d151fa6db298974c@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6okjpu$25b$1@nnrp1.dejanews.com> on Thu, 16 Jul 1998 10:14:22
GMT, greenej@my-dejanews.com <greenej@my-dejanews.com> says...
...
> print qq{
> ...
> A whole bunch of stuff, including $variables,
> carriage returns,
> and indented lines.
> ...
> };
>
> Any comments/flames to this construction???
Provided any '}' in the text is matched by a preceding '{', the only
difference between 'qq{' and a 'HERE' document is the new-line character
that is the first character in your data (right after the 'qq{'), which
would not be there in a 'HERE' document (which starts on the next line).
Conversely, if there are any characters in a 'HERE' document, the last
character will necessarily be a new-line, whereas your terminating '}'
can be on the same line as the last line of the preceding text.
The unbalanced delimiter problem could be solved by using a character
that is not in the included text at all ('|' is my usual choice); the
leading new-line problem could be solved by starting the text immediately
after the delimiter (though that outdents the first line visually
relative to the rest of the text).
Otherwise they are equivalent, so no flames. If anything, the 'qq{' form
is slightly more flexible, because of the trailing new-line issue.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 16 Jul 1998 13:19:51 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
To: GEMINI <dennis@info4.csie.nctu.edu.tw>
Subject: Re: FORMAT with numbers....?
Message-Id: <35ADE1D6.6DEC784B@wanadoo.com>
Hello,
GEMINI wrote:
> I'd like to use FORMAT statement to print something,
> say,
>
> FORMAT aaa =
> here is your number: @###.####
> $mynumber
> .
>
> however, I don't know how many digits the $mynumber has.
> if $mynumber is 1234567.12345, the output will be truncated.
> if I preserved more digits for it like @#########.####
> there will be too many spaces if $mynumber is small.
> how can I express the number as the sprintf("%.4f".... does?
> thanks in advance.
$number = 66666666.899999988;
format STDOUT =
my number is : @<<<<<<<<<<<<<<<<<<<<<<<<<<
sprintf "%.4f", $number
.
write;
Eric
------------------------------
Date: 16 Jul 1998 13:54:35 GMT
From: "Tom Hicks" <tomh@ncfweb.net>
Subject: Free email script setups? Any clues ...
Message-Id: <01bdb0c0$02662560$ca7895cf@sparky2>
Keywords: free email
Hi,
Anyone have experience with any free email packages? Found two at Matt's CGI script library
http://www.cgi-resources.com/Programs_and_Scripts/Perl/Web_Based_E_Mail/
Both NetRoamer and or MailMan do not have any support and or way to purchase the scripts. No way
to contact them.
Anyone know of other scripts that do YAHOO type free email functions for web sites and have "some"
support?
Thanks for your time.
Tom Hicks
tomh@ncfweb.net
InternetTemps People with skills and those that need them.
http://www.internettemps.com
------------------------------
Date: Thu, 16 Jul 1998 16:20:55 +0200
From: "joe" <joe@rhein.to>
Subject: getting a url that is not there
Message-Id: <6ol1u0$9i7$1@usenet43.supernews.com>
yo folks,
what happens to this:
$ok = get($geturl);
if $geturl is not reachable?
will it skip it or what will happen?
Thanks
joe
------------------------------
Date: Thu, 16 Jul 1998 14:11:46 +0100
From: "Anthony farrow" <a.n.farrow@cranfield.ac.uk>
Subject: HELP : Integrating an Access DB with Perl
Message-Id: <35adfc13.0@news.cranfield.ac.uk>
Hi List,
Thanks for the recent advice on sockets! Now I have another problem :-(
I need to store information in a database that will be generated
automatically from a perl script. Now, I could write my own database in Perl
using files and parsing but I think for this I would really like a third
party database. And I would prefer access.
So, has anybody actually done this? I have had a look at the OLE module but
I am unaware of the OLE calls needed to add to a jet database.
Is there a primer anywhere, or does anybody have any example code they can
post/email me?
Thanks in advance,
Anthony Farrow
a.n.farrow@cranfield.ac.uk
------------------------------
Date: 16 Jul 1998 14:31:44 GMT
From: "Bill Catlan" <wcatlan@bccom.com>
Subject: is IF statement BROKEN in 5.004?
Message-Id: <01bdb0c6$78a786a0$7c91ffcc@box-a>
Does anyone know why:
$a = 1;
$b = 0;
if ($a > $b) {...}
evaluates false?
The following also evaluates as false:
$a = "1";
$b = "0";
if ($a gt $b) {...}
However, the following evaluates as true:
$a = "1";
if ($a > 0) {...}
Bill Catlan
------------------------------
Date: Thu, 16 Jul 1998 13:30:54 GMT
From: dturley@pobox.com
Subject: Re: Is it possible to create a STAND ALONE EXECUTABLE?
Message-Id: <6okvae$fs5$1@nnrp1.dejanews.com>
> In article <6ofqi6$d73$1@nnrp1.dejanews.com>, mad_ahmad@my-dejanews.com
posted:
>
> >I've written this perl program and It's all set.
> >i now want to turn it into an executable that's stand alone.
> >is that in any way concievable?
>
Only in the mac and windoze versions of perl.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 16 Jul 1998 13:48:00 GMT
From: "sjurseth" <sjurseth@x25.net>
Subject: Monitoring outgoing mail
Message-Id: <01bdb0c1$1f648520$f4f5a68f@rr1.us.dell.com>
Does anybody out there know of an existing script that would monitor SMTP
and cancel a que if someone were to say try and send out 150 messages all
at once. Does anybody know a good way to do this. I know that I could
limit the max que size, but what I would rather do is have the port
monitored, so that I could also have it immediately email me if someone
tries it, and then cancel the job.
Any help would be greatly appreciated.
Geir
sjurseth@x25.net
geir_sjurseth@dell.com
------------------------------
Date: 16 Jul 1998 13:56:20 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: More musing on -w
Message-Id: <900597378.491745@elaine.drink.com>
In article <MPG.1016f706a27c5fc098971a@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[This followup was posted to comp.lang.perl.misc and a copy was sent to
>the cited author.]
>
>In article <900537583.606828@elaine.drink.com> on 15 Jul 1998 21:19:55
>GMT, Alan Barclay <gorilla@elaine.drink.com> says...
>...
>> Right now, 1 & 2 are enabled by -w, and all can be disabled by defining
>> an appropriate __WARN__ handler, but (and correct me if I'm wrong) there
>> is no way for the handler to know the source of the error.
>...
>> A second variable could be set to indicate the source of the warning,
>> which could be used in a custom __WARN__ function.
>
>The string passed to the __WARN__ handler includes by default the file
>name and line number of the warn() statement. These are also available
>as the __FILE__ and __LINE__ special tokens. This is documented in
>`perldoc -f die`.
Yes, I know this, but that tells you the line the error occured, I
was using 'source' meaning the compiler, the interpeter, a warn
statement or a carp statement. I know of no way of knowing this.
------------------------------
Date: Thu, 16 Jul 1998 17:50:38 +0300
From: Jan Lattunen <atropos@insomniac.keltti.jyu.fi>
Subject: newbie date format
Message-Id: <35AE133E.193FC677@insomniac.keltti.jyu.fi>
Hi there,
My problem is rather simple. I've been trying to get the
date in a format like yyyy-mm-dd like 1998-07-16
closest i've got so far is like 98-7-16.
Is there a simple way to do this straight, or do
i have to use a module or something.
Thanks,
Jan Lattunen, atropos@insomniac.keltti.jyu.fi
------------------------------
Date: 16 Jul 1998 11:19:15 GMT
From: wings <xuchu@iscs.nus.edu.sg>
Subject: Re: pattern matching with an =
Message-Id: <6oknjj$hod5@id4.nus.edu.sg>
Juli@my-dejanews.com wrote:
: Can you do pattern matching with an equal sign? (=)
: Like $found =~ /=/;
why not? it matches!
$a = "a=1";
print $a if ($a =~ /=/);
print "\ndone\n";
--
wings
------
World is a book, those dont travel read only one page.
Email: xwings@usa.net, xuchu@iscs.nus.edu.sg
ICQ UIN: 1440319
http://gump.iscs.nus.edu.sg
------------------------------
Date: Wed, 15 Jul 1998 23:24:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: pattern matching with an =
Message-Id: <n9vjo6.cb1.ln@localhost>
Juli@my-dejanews.com wrote:
: Can you do pattern matching with an equal sign? (=)
What happened when you tried it?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 16 Jul 1998 13:55:36 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35AE07F5.405@min.net>
Zenin wrote:
>
> Just as correct is that any decent editor can easily handle >80
> column text in an 80 column window. Even in the very rare case I
> use 80 column windows (telnet from a Windoze box...) my editor has
> no problem with easy screen shifts to avoid the brain dead line
> wrapping vi et al do by default. In such cases, I still use >80
> columns. Many statements just read easier if they aren't choked
> to a ridiculous and extremely outdated <80 column limit.
It may (arguably) be that 80 columns is too narrow for usefulness.
But you can't just let lines go to unlimited length, especially in a
multi-programmer environment (i.e. the real world). Source code files
need to be width-constrained, and it needs to be some reasonably small
number, even if >80. I don't like horizontal scrolling, and I sure
hate scrolling 10+ times the width of the viewport.
--
John Porter
We have enough youth, how about a fountain of smart?
------------------------------
Date: Thu, 16 Jul 1998 13:59:39 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35AE08E8.63BE@min.net>
Ilya Zakharevich wrote:
>
> <jdporter@min.net>] wrote in article <35ACFDB2.477B@min.net>:
>
> > Sure. And so you have implementations of hundred(s?) of slightly
> > different languages. I submit that any/all of them may legitimately
> > be called by the name of Perl.
>
> If you want to consider this as logical, and suffer the consequences,
> so be it.
Are you threatening me, Ilya? Did I hear a sinister chuckle?
What I want from you is an explanation -- as rigorous as possible --
of why a source code fragment which consists of valid Perl4 and
Perl5 code, and is compiled and executed by the current (or any)
perl interpreter, can not legitimately be called Perl code.
Let me see the Master Logician work.
--
John Porter
We have enough youth, how about a fountain of smart?
------------------------------
Date: 16 Jul 1998 07:32:15 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Beautifier Home Page
Message-Id: <m3af69n9xs.fsf@windlord.Stanford.EDU>
John Porter <jdporter@min.net> writes:
> It may (arguably) be that 80 columns is too narrow for usefulness.
It's *definitely* not. There's no reason whatsoever to use more than 80
columns. I'd recommend anyone who is interested in this issue read some
of the theoretical work on ideal line lengths for people reading. More
than about 60-70 characters makes it difficult to track from line to line
because the distance from the end of the line to the beginning of the next
line is long enough that you brain is having to search for the next line.
Every modern computer language has sane continuation methods or is
whitespace-flexible. Perl certainly is.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Thu, 16 Jul 1998 10:11:46 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl Setup on NT
Message-Id: <linberg-1607981011460001@projdirc.literacy.upenn.edu>
In article <6ojorc$9be$1@news-2.news.gte.net>, "tdean" <tdeanatgtedotnet> wrote:
> steve :
> If I am at the C:\ and type in perl c:\perl\bin\perlscript.pl, yes it works
> what I want is to be at the c:\ and type perl perlscript.pl
> sure I can cd\perl\bin and type perl perlscript.pl and that works, but I
> thought by having c:\Perl;C;\perl\bin on the end of the path it would be
> able to find it.Perhaps the c:\perl;c:\perl\bin should be at the beginning
> of the path?
Yes, you can add c:\perl\bin to your path, or any other directory you want
to be able to globally access.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: 16 Jul 1998 17:34:36 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: persistent objects
Message-Id: <oee7m1dg8zn.fsf@alpha.hut.fi>
looper@sparadigm.com (looper) writes:
>
>
> Is there a simple way I can store a reference to something in a file that
> the other perl processess can open and actually use (just given something
> like ARRAY(0xacc50))?
>
> I have a nested data structure that maintains an array of objects
> (FileHandle's, Socket's etc.) which is created by one perl invocation. I
Umm, how on earth could you store live file/network connections to a file?
Those are tightly tied to a single live process.
Such things _can_ be done but only iff the operating systems gives a
large helping hand, "checkpointing" a process. Neither your garden
variety UNIX nor Win32 can do this. Well, I am guessing on the Win32
but that's an educated guess, because: especially the network
connections are really hard, how can you guarantee anything about the
other end of the connection? Even local files are not trivial: in
effect the files should be locked against any other processes. And
considering that you want to save your state to a file, the logical
thing to do would to make this file locking persisent (reboot-proof) too.
The next best thing you can hope to do is to save the file and network
connection open parameters and then restore your connections using those
parameters.
> need all other perl invocations to be able to get at it.
>
> I tried Eroot.pm with not much success, ObjectStore.pm seems a touch over
> the top for me, and I haven't bothered with Storable.pm because of the Sys
> V dependant stuff which I can't have.
Huh? Storable requires no such thing. The IPC reference means
_any_ IPC, for example sockets.
> So how do you take a string "ARRAY(0xacc50)" and remap it to a real reference?
Take a look also at Data::Dumper. It outputs Perl data structures -- in Perl.
> Any assistance would greatly be appreciated.
>
> Thanks much,
>
> -Josh Blackwell <josh@netoutfit.com>
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 16 Jul 1998 13:35:04 +0200
From: af06@ma70.rz.uni-karlsruhe.de (Thomas Dehn)
Subject: Re: Putting CPAN on a CD: good or not good?
Message-Id: <6okoh8$f37@ma70.rz.uni-karlsruhe.de>
In article <fl_aggie-1207981425490001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>In article <6oa77g$p1a$1@nnrp1.dejanews.com>, birgitt@my-dejanews.com wrote:
>
>+ The attached CD-ROM to the magazin is something done often in Germany,
>+ apparently because online time to download things directly is
>+ expensive. That is my assumption and I like to be corrected if
>+ I am wrong.
>
>My understanding of the telecom system in Germany is this: you pay for
>every call you make. There's no such thing as "free local calling".
Correct. The cheapest available local calls in Germany
are now 0.061 German marks/90 seconds, i.e. $ 1.35/hour.
Furthermore most German internet providers still
charge by the hour (add another $2 or $3 per hour).
Thomas
------------------------------
Date: 16 Jul 1998 13:31:49 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: Re: PUZZLE: make hat, take ham
Message-Id: <6okvc5$nqa$1@aurwww.aur.alcatel.com>
On 11 Jul 1998 13:46:49 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
> Now, find all such matching pairs in the list, and do this in
> better than exponential time. The goal is to run this over a large
> /usr/dict/words.
At the risk of embarrassing myself, my solution is included below... It's
O(N**2), and seems to work (unless I've misunderstood the requirements,
which is a distinct possibility :-)). I'm sure there are faster ways to do
the breaking-down & so forth -- I was more worried about the algorithmic
complexity than the nitty-gritty of the parts, though.
The idea is to use two loops. The outer loops removes an element from
@words on each pass; the inner loop compares that word to all of the other
words that remain (both in that order and then also swapped). Thus, we get
N + (N-1) + (N-2) + ... steps, which is O(N**2) behavior.
Oh -- I purposely had it leave out pairs like "make ham / make ham" (where
the first letter of the first word and the last letter of the second word
are the same), since those cases aren't interesting.
John
-- snip --
#!/usr/local/bin/perl -w
use strict;
chomp(my @words = <>);
my %dict = map { $_ => 1 } @words;
while (defined(my $curr = shift @words))
{
my $cp = &parts($curr);
for my $try (@words)
{
my $tp = &parts($try);
my $res;
print "$res\n" if $res = &works($cp, $tp);
print "$res\n" if $res = &works($tp, $cp);
}
}
sub parts
{
my $curr_first = substr($_[0], 0, 1);
my $curr_last = substr($_[0], -1, 1);
my $curr_mid = '';
chop($curr_mid = substr($_[0], 1)) if length $_[0] > 1;
[ $curr_first, $curr_mid, $curr_last ];
}
sub works
{
my($p1, $p2) = @_;
if ($p1->[0] eq $p2->[2])
{
return '';
}
elsif (exists $dict{"$p2->[2]$p1->[1]$p1->[2]"} &&
exists $dict{"$p2->[0]$p2->[1]$p1->[0]"})
{
return "$p1->[0]$p1->[1]$p1->[2] $p2->[0]$p2->[1]$p2->[2] / " .
"$p2->[2]$p1->[1]$p1->[2] $p2->[0]$p2->[1]$p1->[0]";
}
else
{
return '';
}
}
--
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><
------------------------------
Date: Thu, 16 Jul 1998 13:08:23 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: real quick and easy - replace....
Message-Id: <6oku07$ebp$1@nnrp1.dejanews.com>
In article <6okct4$7fb$1@usenet36.supernews.com>,
"joe" <joe@rhein.to> wrote:
> Hello what is the function for replacing characters in a string... I cant
> find anything on this in my "learning perl book"
Really? Leaarning perl? page 88? 'Substitutions'? Hmm, I would bring it
back then, it's not complete obviously...:)
$string =~ tr/[a-z]/[A-Z]/g; # replace set of chars by diff. set (man tr)
$string =~ s/house/building/g; # replase matching part by strng (man perlre)
Andre.
> thanks
>
> joe
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 16 Jul 1998 14:07:20 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Restricting refering domains access to script?
Message-Id: <6ol1eo$8bc$1@news.iastate.edu>
Abigail (abigail@fnx.com) wrote:
: brian d foy (comdog@computerdog.com) wrote on MDCCLXXX September MCMXCIII
: in <URL: news:comdog-ya02408000R1607980002520001@news.panix.com>:
: ++ In article <6ojf30$s6$1@camel15.mindspring.com>, "Doug Younger" <cgi-bin@mindspring.com> posted:
: ++
: ++ >Hello,
: ++ >$ENV{REMOTE_HOST} is the machine where the end user is sitting at... (or
: ++ >$ENV{REMOTE_ADDR} for IP address.
: ++ > If you want where the script was called from (from a web page not on the
: ++ >same server), which I doubt is the case, but just in case, use:
: ++ >$ENV{HTTP_REFERER} will need to split out the server portion as it contains
: ++ >the entire URL.
: ++
: ++ of course, none of those are reliable due to proxies and broken
: ++ browsers.
: Broken? Broken? First of all, a browser isn't sending the IP number
: (or name) - that can be interfered from the TCP/IP connection.
: As for REFERER, the RFC does not make it a requirement, and
: in certain cases, browser should not even send a REFERER header.
: Ob Puzzle: Name 3 cases where there is no sensible REFERER to send
: for a browser.
Offhand, two of them seem to be
1) when the default home page is loaded
2) when a URL is typed into the "Location" widget
Josh
--
__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
- Thomas Pynchon
------------------------------
Date: Thu, 16 Jul 1998 15:08:31 +0100
From: "Steve Robinson" <steve.robinson@sonybpe.com>
Subject: Sony Test
Message-Id: <782FB2F082EAD1119C8C00805FBE0C980135C4D5@SEUBPEBAS04>
Test
------------------------------
Date: Thu, 16 Jul 1998 11:09:49 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: use strict
Message-Id: <6okn1u$696$1@nnrp1.dejanews.com>
In article <6oio53$gbn$1@ocean.cup.hp.com>,
"Gil Brown" <gil_brown@hp.com> wrote:
> I trying to learn perl5 (I've only written stuff in 4 so far) and I am
> having a problem with use strict. All I want to do is read from a file
> (simple enough) and when I uncomment use strict nothing works and it does
> when I comment it. This is the example I am referring to:
>
> #! /usr/bin/perl -w
> ######################
> #
> #
> #use strict;
> use FileHandle;
>
> my $fh = new FileHandle; # Create local filehandle
> open ($fh, "/home/gbrown/test/lolo") || die $!;
> $line = <$fh>;
> print "$line\n";
> while ($line ne "")
> {
> print "$line\n";
> $line = <$fh>;
> }
>
> Thank you for your help!
>
> P.S. This is the error message I get when I use use strict
>
> # ./test
> Global symbol "line" requires explicit package name at ./test line 10.
> Execution of ./test aborted due to compilation errors.
Jep, and thats all waht you need. strict forces you to declare all
variables using my or local. Thats it :)
so 'my $line = "";' somewhere at the top should do it...
read man pages?
Andre.
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 16 Jul 1998 10:12:35 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: use strict
Message-Id: <linberg-1607981012350001@projdirc.literacy.upenn.edu>
In article <6ojcnr$hak$1@marina.cinenet.net>, cberry@cinenet.net (Craig
Berry) wrote:
> Steve Linberg (linberg@literacy.upenn.edu) wrote:
> : In article <6oj4eu$5gg$3@marina.cinenet.net>, cberry@cinenet.net (Craig
> : Berry) wrote:
> :
> : > Use of braces as qw delimeters seems a bit potentially misleading
> : > (though perfectly OK, of course).
> :
> : Yeah, but Tom uses them! :)
>
> And if Tom jumped off a cliff...? :)
I'd be a pancake too! Wahoooo!! :)
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 16 Jul 1998 11:43:01 +0100
From: "Simon Fairey" <simonf@conduit.co.uk>
Subject: Re: using perl to pass flags from checkboxes to database file
Message-Id: <35add860.0@nnrp1.news.uk.psi.net>
One initial thought of the top of my head (apologies if you knew this
already) but checkboxs values are either 'on' or whatever you set the
checked value to be in the HTML or nothing at all. They don't explicitly
return 'off' so if you are checking for it you won't be finding it.
Essentially you want to say:
$cb_value eq 'on' ? print '1' : print '0';
As an aside the code below is what is printing the checkboxes but if my
understanding is correct your p[roblem is that the right info is not being
stored in the first place so the portuion of code which writes the 1s and 0s
to the file would be more useful to see.
Hope this helps.
Simon
melspace@my-dejanews.com wrote in message
<6oiu8s$g6n$1@nnrp1.dejanews.com>...
>I am creating a web-based application that is gathering information from a
>specific set of users using checkboxes, and writing that information to a
>flat ASCII database file. I am trying to write a 0 to the file if it is
not
>checked, and a 1 if it is checked. I am using post, and actually loading
the
>user's information from the database on the fly. The user changes and
>updates information as needed, and resubmits the information.
Unfortunately,
>I can't seem to get it working. It will pass the "on" value for those
boxes
>that are checked, but it is not passing an "off" value for those that
aren't
>checked. When written to the file, it is stored in the wrong place because
>there are no 0's written at all. Then the next time the page is generated,
>the first couple of boxes come up checked, instead of the correct boxes.
>Here is an example:
>
> snip <
>
>Any ideas???
>
>Thanks,
>
>Melanie
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 16 Jul 1998 13:40:31 GMT
From: Charles Maier <maierc@chesco.com>
Subject: Re: using perl to pass flags from checkboxes to database file
Message-Id: <35AE03C6.3C4A@chesco.com>
melspace@my-dejanews.com wrote:
>
> I am creating a web-based application that is gathering information from a
> specific set of users using checkboxes, and writing that information to a
> flat ASCII database file. I am trying to write a 0 to the file if it is not
> checked, and a 1 if it is checked. I am using post, and actually loading the
> user's information from the database on the fly. The user changes and
> updates information as needed, and resubmits the information. Unfortunately,
> I can't seem to get it working. It will pass the "on" value for those boxes
> that are checked, but it is not passing an "off" value for those that aren't
> checked. When written to the file, it is stored in the wrong place because
> there are no 0's written at all.
Then the next time the page is generated,
> the first couple of boxes come up checked, instead of the correct boxes.
> Here is an example:
>
> if ($info eq "info")
> {
> $count++;
> if ($usr_info[$count] == 1)
> {
> print "<tr><td valign=top width=30%>";
> print "<input type=checkbox name='$usr_info[$count]' checked>";
> print "$user_type</td>";
> print "<td valign=top width=70%>$description</td></tr>";
> }
> else
> {
> print "<tr><td valign=top width=30%>";
> print "<input type=checkbox name='$usr_info[$count]'> $user_type</td>";
> print "<td valign=top width=70%>$description</td></tr>";
> }
> }
>
> Any ideas???
>
The best way to deal with the form input data is:
if($field eq "") # the "off" or "not-checked" one
- and -
if($field ne "") # The "on" or "checked" one.
They are not 1's and Zeros.
I only guess at this.. since you did not tell us where your data is!!
This snippet seems to be the generation of the RESPONCE.. and should
work if your data ($user_info[]) HAS 1s and 0s. Does it?? Are you sure??
The "==" is to test against NUMBERS... "eq" and "ne" are for string
data. It is generally safer to test file data as strings.
--
Chuck Maier
CDM Consulting Services
http://www.cdmcon.com
(610) 943-2726
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3175
**************************************