[12810] in Perl-Users-Digest
Perl-Users Digest, Issue: 220 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 21 22:07:19 1999
Date: Wed, 21 Jul 1999 19:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 21 Jul 1999 Volume: 9 Number: 220
Today's topics:
Re: ****Perl tutorials!!!!**** (Ronald J Kimball)
Re: Ab: Locking files in win95 arpith@hotmail.com
Re: Ab: Locking files in win95 (Anno Siegel)
Re: cant install Thread module <dan@tuatha.sidhe.org>
Re: fetch url with standard modules? (Anno Siegel)
Re: finding last created files in a directory (Abigail)
Re: gethostbyname on NT (elephant)
Re: gethostbyname on NT <psutton@microsoft.com>
Re: getting the decimal portion of a floating point num (Anno Siegel)
Re: Help requested with my "paging" script. <portboy@home.com>
Re: HELP: Faster alternative of substr()? (Anno Siegel)
Re: HELP: Faster alternative of substr()? (Ronald J Kimball)
LWP and frame blacksburg98@my-deja.com
Re: macros in perl? mda@discerning.com
Re: Perl can't do ">>filename" -- geesh! (Abigail)
perl cgi msdb159@my-deja.com
Perl Examples on Parsing HTML drakek51@my-deja.com
Re: Perl usuage and Graphical Representation (Eric Bohlman)
Re: Perl(CGI) or JavaScript? <hiller@email.com>
Re: PGP and Mail (Anno Siegel)
Re: Problem compiling 'write' (elephant)
Re: Programming problem (Eric Bohlman)
Re: regular Expression (Abigail)
Re: regular Expression (Ilya Zakharevich)
Re: regular Expression <tchrist@mox.perl.com>
Re: regular Expression (Ilya Zakharevich)
Scrollback perldoc in DOS-window? starthoughts@my-deja.com
Re: Scrollback perldoc in DOS-window? <revjack@radix.net>
Re: setuid and opening a file for writing (Ronald J Kimball)
Re: Shortening the length of a string (Abigail)
STDIN redirection <m.zeiger@worldnet.att.net>
straight perl cgi scaleability msdb159@my-deja.com
Re: Testing for the existing of a key in a hash (Abigail)
Re: Testing for the existing of a key in a hash (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Jul 1999 21:34:40 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: ****Perl tutorials!!!!****
Message-Id: <1dvb92n.4s4d519ccu2oN@p37.tc17.metro.ma.tiac.com>
David Cassell <cassell@mail.cor.epa.gov> wrote:
> If you foolishly click there, you get a blank page. [Okay,
> I have Java and JavaScript disabled like any sane person
> visiting a never-before-seen site.]
I'm using Netscape Navigator 4.04. I turned on Images, Java, and
JavaScript. It's *still* a blank page.
But hey, at least I got a pop-up window with a banner ad, so it's not
totally broken.
*snicker*
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 22 Jul 1999 01:18:40 GMT
From: arpith@hotmail.com
Subject: Re: Ab: Locking files in win95
Message-Id: <7n5rh6$dnq$1@nnrp1.deja.com>
In article <MPG.1200dc653b1ab4a3989b62@news-server>,
e-lephant@b-igpond.com (elephant) wrote:
> >Isn't there some external program like share.exe or something to take
> >care of this work ?
>
> who knows .. we're not Windows95 OS experts
>
I'm desperate here... and i need some solution please..
Okay, how about this... how about creating one small program (in
any language)that runs simultaneously with Win95 (maybe when it is
started or something). When the perl program wants to access a file, it
calls the external program and maybe sets a variable to 1.
Would that work better than lock files ? Would it reduce the risk of
simultaneous access of the same file ?
Also is there any way of finding out how many processes of the same perl
file is running (from the perl program itself)? i.e. How many
simultaneous users are running the same perl file ?
Any thoughts ?
Arpith.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 22 Jul 1999 01:49:39 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Ab: Locking files in win95
Message-Id: <7n5tbj$tf2$1@lublin.zrz.tu-berlin.de>
<arpith@hotmail.com> wrote in comp.lang.perl.misc:
>In article <MPG.1200dc653b1ab4a3989b62@news-server>,
> e-lephant@b-igpond.com (elephant) wrote:
>
>> >Isn't there some external program like share.exe or something to take
>> >care of this work ?
>>
>> who knows .. we're not Windows95 OS experts
>>
>
>I'm desperate here... and i need some solution please..
Well okay, but please be desperate where the expertise is.
>Okay, how about this... how about creating one small program (in
>any language)that runs simultaneously with Win95 (maybe when it is
>started or something). When the perl program wants to access a file, it
>calls the external program and maybe sets a variable to 1.
>
>Would that work better than lock files ? Would it reduce the risk of
>simultaneous access of the same file ?
>
>Also is there any way of finding out how many processes of the same perl
>file is running (from the perl program itself)? i.e. How many
>simultaneous users are running the same perl file ?
>
>Any thoughts ?
Yes. Mutual exclusion of processes is something the operating
system must provide. If it doesn't, there is nothing a user can
do. To learn if Windows95 provides it, ask an appropriate group.
Anno
------------------------------
Date: Thu, 22 Jul 1999 00:13:15 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: cant install Thread module
Message-Id: <vmtl3.17365$y92.9882@news.rdc1.ct.home.com>
smnayeem7346@my-deja.com wrote:
> In article <O6al3.16963$y92.9367@news.rdc1.ct.home.com>,
> <dan@tuatha.sidhe.org> wrote:
>> smnayeem7346@my-deja.com wrote:
>> > Does anyone know why I cannot install the Thread module. I went to
> the
>> > threads directory and installed it using perl Makefile.pl, make,
>> > make test, make install.
>> > however when i try to use it in the program it says cant find in
> @INC.
>>
>> You have enable thread support and build the Thread module when you
> first
>> build perl. It can't be done after the fact.
> But I have already had perl installed. And there doesnt seem to be any
> way of uninstalling except for maybe resetting up the whole computer
> from scratch again (or is there?)
> Or do I just install Perl again? but last time I did it I ended up
> having many perls installed and had hard time keeping track of where is
> which perl (and I only needed one).
That's Ok. Just build another version with threads enabled. The key word
here is 'build'--you need to take the sources and a C compiler. You can't
just add in the threading modules after the fact, alas.
Perl is, in general, perfectly hapy coexisting with multiple versions of
itself, even on WinNT.
>>
>> > and one more question is how do i install this module under winNT?
> it
>> > gives error when i try perl makefile.pl
>>
>> I don't know that anyone's actually built it under WinNT.
>>
>> Dan
>>
> So is it that the Win32::Process is a good alternative to threads in
> Windows? Actually apart from forking I dont know all the details (such
> as memory complexities, process killing etc) of neither Threads nor
> Win32::Process. So does anyone know where I can find good examples of
> the use of any /all of these modules?
> And what IS the difference between Forks, Threads and Win32::Process??
Got me there. Perhaps someone else can comment.
Dan
------------------------------
Date: 22 Jul 1999 00:23:22 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: fetch url with standard modules?
Message-Id: <7n5o9q$t88$1@lublin.zrz.tu-berlin.de>
John Borwick <jobosw@unx.sas.com> wrote in comp.lang.perl.misc:
>On Tue, 20 Jul 1999 15:48:10 GMT, snowhare@long-lake.nihongo.org
>(Benjamin Franz) wrote:
>
>> # # # # # # ##### ###### # ######
>> # # # # # # # # # # # # # # # # #
>> # # # # # # # # # # # # # # # #
>> # # # # # # # # # # #### ###### # # ######
>> # # # # # # # # # # # # # ####### # #
>> # # # # # # # # # # # # # # # # #
>> ## ## ## ## ## ## ##### # # # # ######
>
> GOOD LORD IN HEAVEN!
Well, to be fair, Jeff "Warlord" Ballard wrote that.
Anno
------------------------------
Date: 21 Jul 1999 20:26:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: finding last created files in a directory
Message-Id: <slrn7pcspt.oqh.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCL September MCMXCIII in
<URL:news:MPG.11ffb1f63386bf23989d10@nntp.hpl.hp.com>:
**
** Assuming the 'changed' date is what you want, you must stat all the
** files (or use the '-C' operator, which does the same thing). Then sort
** by it and slice the extreme five that you want from the sorted list. Be
** sure to use a sorting method that stats each file once only, not in the
** sortsub.
How inefficient!
Assuming the list of files is in @files:
my @changed = map {[-C, $_]} @files;
my @top5 = sort {$b -> [0] <=> $a -> [0]} splice @changed, 0, 5;
foreach my $file (@changed) {
$top [my $i = 5] = $file;
{if ($top [$i - 1] -> [0] > $top [$i] -> [0]) {
@top [$i - 1, $i] = @top [$i, $i - 1];
redo if -- $i;
}}
}
my @last_changed = map {$_ -> [0]} splice @top5, 0, 5;
This is O (n), while sorting takes Omega (n log n).
Abigail
--
I might have screwed up some '<' or '>' somewhere. I'm sure some nitpicker
here will correct me. I might even have done it on purpose to see whether
people pay attention. (And this will be on the exam!)
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 22 Jul 1999 10:32:53 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: gethostbyname on NT
Message-Id: <MPG.120111bdfc4156f4989b65@news-server>
Uwe W. Gehring writes ..
>is there a known bug in gethostbyname with ActiveState Perl (newest
>relaease) on a NT box?
this comment (probably misleading) implies that you have used
gethostbyname successfully on a non-NT platform .. if so - I'd be
interested to know which platform because what you seem to expect as a
return from gethostbyname is magical indeed
>When I use gethostbyname with an ip-name I get not only one number,
>but a couple of numbers and names.
in the perlfunc documentation for gethostbyname you will find a sentence
that looks something like this .. suggest you read from there on ..
explains it quite well
"In list context, the return values from the various get routines are as
follows:"
man perlfunc
or
perldoc -f gethostbyname
--
jason - remove all hyphens for email reply -
------------------------------
Date: Wed, 21 Jul 1999 17:38:06 -0700
From: "Paul Sutton" <psutton@microsoft.com>
Subject: Re: gethostbyname on NT
Message-Id: <7n5p5g$vla@news.dns.microsoft.com>
Uwe W. Gehring <gehring@politik.uni-mainz.de> wrote in message
news:37965E46.74EF6D1A@politik.uni-mainz.de...
> is there a known bug in gethostbyname with ActiveState Perl (newest
> relaease) on a NT box? When I use gethostbyname with an ip-name I get
> not only one number, but a couple of numbers and names. Unfortunately,
> no one of them is the right ip-number. The DNS server is well
> configured, I believe and I don't use WINS or LMHOST-file.
Are you looking in the fifth element of the returned array? You
do know that that is itself an array of addresses, and you need to unpack
the internal representation according to the type of address? Here is
the prototype from perlfunc:
($name,$aliases,$addrtype,$length,@addrs) = gethostbyname();
Paul
------------------------------
Date: 22 Jul 1999 01:33:26 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: getting the decimal portion of a floating point number
Message-Id: <7n5sd6$tdo$1@lublin.zrz.tu-berlin.de>
William <bivey@teamdev.com> wrote in comp.lang.perl.misc:
>
>
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in article
><7n34f9$r5t$1@lublin.zrz.tu-berlin.de>...
>> William <bivey@teamdev.com> wrote in comp.lang.perl.misc:
>> >anna@water.ca.gov wrote in article <7n2n1s$7t0$1@nnrp1.deja.com>...
>> >> Hi,
>> >>
>> >> Is there a way in Perl or in a module of getting the decimal portion
>of
>> >> a floating point number? I have already tried using the
>format_picture
>> >> method of Number::Format, but that doesn't work.
>> >>
>> >> For example, if I have a number, 12345.6789 and I want to be able to
>> >> return the portion .6789, how do I go about that?
>> >>
>> >> Thanks in advance for your reply,
>> >> Anna
>> >
>> >Try
>> > $YerNumber =~ m/(\.\d+)/;
>> > return $1;
>>
>> What's wrong with $YerNumber - int $YerNumber? It doesn't depend on
>> the locale.
>>
>> Anno
>
>Because on my system that operation on that number yields
> 0.678900000000795
>which isn't exactly what the original poster had in mind,
>I'm sure.
Probably not, but it is what they *should* have had in mind. If
the extra places are unwanted, use sprintf and friends.
> (I tend to avoid math function solutions to
>floating point problems if there's a string solution because
>of the possibility of results like the one above.)
...thereby introducing the possibility that the computer and
you disagree about what a particular number means. I think
manipulating numbers as strings is in general not a good idea,
unless they *are* stings that happen to look like a number,
such as version numbers. If you are going to use any arithmetic
on numbers, you should stick with that and not mix concepts just
because the result looks nicer.
As far as
>locale goes, you could place the decimal point in a variable.
Sure.
Anno
------------------------------
Date: Thu, 22 Jul 1999 01:46:24 GMT
From: Mitch <portboy@home.com>
Subject: Re: Help requested with my "paging" script.
Message-Id: <379607F5.7BE4A433@home.com>
I've gotten help from JS, however, I've been unable to get the script to
work that he submitted to me. Well, let me put it this way, maybe the
script works and I'm just doing something wrong. Below is a copy of the
script that JS submitted to me. When I run the script with a 'cat foofile |
perl5 page.pl' everything just seem to scroll away. I can't seem to figure
out why this is happening. I've asked JS, but haven't gotten any response.
Can someone show me or tell me how to make this run the way i want?
Thanks,
mitch
#!/usr/bin/perl5
require Term::Screen;
my $terminal = new Term::Screen;
$lines = $terminal->{ROWS};
$terminal->clrscr();
while(<>)
{
chomp;
$terminal->at($done,0)->puts($_);
if(++$done == ($lines-1))
{
$terminal->at($lines,0)->reverse()->puts("--More--")->normal();
my $blah = $terminal->getch();
$done = 0;
$terminal->clrscr();
}
}
$terminal->at($lines,0)->reverse()->puts("--Done--")->normal();
my $blah = $terminal->getch();
$terminal->clrscr();
------------------------------
Date: 22 Jul 1999 00:05:40 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP: Faster alternative of substr()?
Message-Id: <7n5n8k$t6g$1@lublin.zrz.tu-berlin.de>
Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:
>[Posted and a courtesy copy sent.]
>In article <7n4ife$s5g$1@nnrp1.deja.com> on Wed, 21 Jul 1999 13:37:51
>GMT, hassanov@my-deja.com <hassanov@my-deja.com> says...
>> Regarding huge arrays, is there any better (faster) way to do the
>> following:
>> for($i=0;$i<length($SrcArray);$i++)
>> {
>> $ord1=ord(substr($SrcArray, $i, 1));
>> $ord2=ord(substr($EncryptionArray, $i, 1));
>> substr($DstArray, $i, 1)=chr( $ord1 + ord2 );
>> }
>
>There is a bareword 'ord2' in there.
>
>The following benchmark shows how one can improve it a lot by packing
>the final step, but worsen it by unpacking the first two steps.
If we can assume no overflow occurs in the 1-byte operations, vec
can be quite a timesaver.
(Code below is from Larry's post with sub Vec added)
#!/usr/bin/perl -w
use strict;
use Benchmark;
my $x = ord( chr( 2049));
print "$x\n";
exit;
my $SrcArray = 'abc' x 101;
my $EncArray = "\1\2\3" x 101;
sub Substr {
my $DstArray = "";
for (my $i = 0; $i < length $SrcArray; $i++)
{
my $ord1 = ord(substr($SrcArray, $i, 1));
my $ord2 = ord(substr($EncArray, $i, 1));
substr($DstArray, $i, 1) = chr( $ord1 + $ord2 );
}
$DstArray
}
sub Pack {
pack 'C' x length $SrcArray, map {
ord(substr($SrcArray, $_, 1)) + ord(substr($EncArray, $_, 1))
} 0 .. length($SrcArray) - 1
}
sub Unpack {
my @Src = unpack 'C' x length $SrcArray, $SrcArray;
my @Enc = unpack 'C' x length $EncArray, $EncArray;
pack 'C' x @Src, map { $Src[$_] + $Enc[$_] } 0 .. $#Src
}
sub Vec {
my $DstArray = $SrcArray;
for ( my $i = 0; $i < length( $SrcArray)/4; $i++ ) {
vec( $DstArray, $i, 32) += vec( $EncArray, $i, 32);
}
substr( $DstArray, 0, length $SrcArray);
}
timethese(1 << (shift || 0), {
Pack => \&Pack,
Unpack => \&Unpack,
Substr => \&Substr,
Vec => \&Vec,
});
__END__
Benchmark: timing 1024 iterations of Pack, Substr, Unpack, Vec...
Pack: 10 wallclock secs ( 9.48 usr + 0.01 sys = 9.49 CPU)
Substr: 26 wallclock secs (23.99 usr + 0.00 sys = 23.99 CPU)
Unpack: 26 wallclock secs (25.15 usr + 0.00 sys = 25.15 CPU)
Vec: 3 wallclock secs ( 2.85 usr + 0.00 sys = 2.85 CPU)
Anno
------------------------------
Date: Wed, 21 Jul 1999 21:34:41 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: HELP: Faster alternative of substr()?
Message-Id: <1dvb9h5.roq9ui19hzskxN@p37.tc17.metro.ma.tiac.com>
Marco Cecconi <sklivvz@tiscalinet.it> wrote:
> $SrcArray=~tr/$EncryptionArray2/$EncryptionArray/;
Yes, that would be very useful, if all one wanted to do were to
translate '2' to 'y'.
tr/// does not interpolate.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"Remember, Perl doesn't write bad programs; programmers do."
------------------------------
Date: Thu, 22 Jul 1999 01:02:18 GMT
From: blacksburg98@my-deja.com
Subject: LWP and frame
Message-Id: <7n5qik$dd8$1@nnrp1.deja.com>
Hi,
I tried to use LWP to fetch some web pages, but if the web pages
contain frame, I get "Your browser does not support frame.". Can I get
around this so that I can grab the informations inside each frame? Your
help is really apprecialted.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 22 Jul 1999 01:41:39 GMT
From: mda@discerning.com
Subject: Re: macros in perl?
Message-Id: <7n5ssh$e67$1@nnrp1.deja.com>
> man perlrun or perldoc perlrun
I assume you mean -P.
I'm already pretty conversant with the perl docs.
Running cpp doesn't cut it; I want something
transparent to myself and to others using the
debug module.
Can anyone answer the question I asked?
I'm guessing it can only be done with XS.
-mda
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 21 Jul 1999 20:31:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl can't do ">>filename" -- geesh!
Message-Id: <slrn7pct2e.oqh.abigail@alexandra.delanet.com>
wallewek@kmsi.net (wallewek@kmsi.net) wrote on MMCL September MCMXCIII in
<URL:news:3798f904.248459149@news.cadvision.com>:
..
.. As I'm planning to have a lot of users running the same script at the
.. same time, appending to the same log file, there is also the concern
.. about simultaneous write access. Using ">>filename" is about as close
.. to an atomic operations as I'm likely to get.
..
.. Am I missing something, or is this something perl just doesn't do
.. well?
You are missing something. Go to the documentation about open, and
look for ">> filename".
17 guesses what that might do.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 22 Jul 1999 01:30:46 GMT
From: msdb159@my-deja.com
Subject: perl cgi
Message-Id: <7n5s86$dvh$1@nnrp1.deja.com>
Why doesn't straight Perl CGI scale?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 22 Jul 1999 01:37:37 GMT
From: drakek51@my-deja.com
Subject: Perl Examples on Parsing HTML
Message-Id: <7n5sl0$e3f$1@nnrp1.deja.com>
Does anyone know of a resource that has examples of Perl script that
parses tags from a web page? More specifically, I need examples that
are able to search for tags nested within other tags and append or
prepend more text, according to some criteria. For example:
<p align="center"><!--webbot bot="HTMLMarkup" startspan --><H1
style="font-size: 48pt; font-family: Arial; color:green">CSS1
Test</H1><!--webbot bot="HTMLMarkup" endspan -->
</p>
In this example I want to get rid of the close paragraph tag </p>
whenever the paragraph contains the "HTMLMarkup" string.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 22 Jul 1999 01:00:17 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl usuage and Graphical Representation
Message-Id: <7n5qf1$14d@dfw-ixnews6.ix.netcom.com>
whos_john_galt@my-deja.com wrote:
: used it for CGI. If I had Perl operating locally on an NT and wanted to
: display information graphically, what would I use?
Tk would be a good choice; ActiveState has a binary ready for installation.
------------------------------
Date: Thu, 22 Jul 1999 00:33:36 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: Perl(CGI) or JavaScript?
Message-Id: <379666E5.25CCA930@email.com>
Patrick wrote:
> Then it will automatically store in a page which show a
> list of player who answered the most number of questions correctly.
I don't think you can do this part with JavaScript. I would say go with
Perl.
--
Jordan Hiller (hiller@email.com)
JavaScript and Perl programs for
making online tests and quizzes:
http://web-shack.hypermart.net/quiz.html
------------------------------
Date: 22 Jul 1999 00:45:35 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: PGP and Mail
Message-Id: <7n5pjf$t9p$1@lublin.zrz.tu-berlin.de>
Scratchie <upsetter@ziplink.net> wrote in comp.lang.perl.misc:
>brian d foy <brian@pm.org> wrote:
>:> : i recommend using IPC::Open3. i recently posted an example in either
>:> : this forum or comp.infosystems.www.authoring.cgi.
>:>
>:> Could someone explain in a nutshell what the advantages are to using
>:> IPC::Open3 rather than open?
>
>: open can't do the same things IPC::Open3 can. that's it in a nutshell.
>
>Such as... ?
>
>I'm trying to understand what the difference is (you know, to avoid "cargo
>cult programming") but I'm afraid that I found "perldoc IPC::Open3" to be
>less than enlightening.
>
>For example, let's say I want a CGI script to send me a pgp-encrypted
>message. I might write something like this:
>
>open (PGP, '| pgpe -fatr upsetter@ziplink.net| mail upsetter@ziplink.net')
> or die "Could not open PGP: $!";
>
>print PGP $message;
>close PGP;
>
>This seems to work fine for my purposes. Am I missing something obvious by
>not using Open3?
Probably not. perdoc IPC::Open3 tells you
IPC::Open3, open3 - open a process for reading, writing,
and error handling
Now explain why you prefer reading this on a newsgroup to reading
it locally.
Anno
------------------------------
Date: Thu, 22 Jul 1999 10:08:02 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Problem compiling 'write'
Message-Id: <MPG.12010beaa520d94a989b64@news-server>
Robert Rawlinson writes ..
>When I compile I get the message:
>syntax error at tsmdrrport.pl line 26, near "write"
>Execution of tsmdrrport.pl aborted due to compilation errors.
I can't be bothered reading the rest of your code .. because if this line
is accurately transposed then this will probably be your problem
>While (<STDIN>) {
perl is case sensitive .. and 'While' should be 'while'
--
jason - remove all hyphens for email reply -
------------------------------
Date: 22 Jul 1999 00:31:30 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Programming problem
Message-Id: <7n5op2$14d@dfw-ixnews6.ix.netcom.com>
David Cassell (cassell@mail.cor.epa.gov) wrote:
: Boy, we already had Baby Perl this morning, and now Scary Perl.
: What's next? Posh Perl?
Were you following the thread about singing the Perl documentation to
recalcitrant script kiddies?
I can see the Spice Perls as a drag act performing at TPC (come to think
of it, The Script Kiddies is a plausible name for a boy band as well).
Perl goes bubblegum...
------------------------------
Date: 21 Jul 1999 19:52:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: regular Expression
Message-Id: <slrn7pcqph.oqh.abigail@alexandra.delanet.com>
William (bivey@teamdev.com) wrote on MMCL September MCMXCIII in
<URL:news:01bed38a$8a825f20$583c08cf@bill.jump.net>:
?? Abigail <abigail@delanet.com> wrote in article
?? >
?? > Extracting the balanced pieces is left as an exercise to the reader.
??
?? I like one-liners myself
?? (($str =~ tr/\(//) == ($str =~ tr/\)//) )) or die "Not balanced";
I prefer correct algorithms.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 22 Jul 1999 01:31:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regular Expression
Message-Id: <7n5s95$fer$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <3795c1a1@cs.colorado.edu>:
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> :Try to guess using 3 tries: who wrote this "very experimental" catchphrase?
>
> First guess: you, which certainly undermines any point you were
> pretending to make.
>
> The 54 to 57 perlre unidiff patch is below for all to read. You'll see
> where I have unified the treatment of experimental features.
As anyone with web access can find, it was *you* who monikered
features which become less-and-less experimental as "highly
experimental and subject to change". Currently there is nothing in
(?p{}) which is more experimental than (?{}). In turn, there is *one*
known bug in (?{}), and no misfeatures left.
I'm thinking about new names for these guys, which may also allow
place for flags. Without flags the current version may be too
pessimized: if one knows that no $^R, or $1-inside-(?{}) etc are
needed, one can avoid a lot of runtime overhead. Something like
\R{CODE}
\R{flags:CODE}
may be more appropriate. I'm waiting for people's comments.
Ilya
P.S. Tom's "improvements" can be inspected at
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-05/msg00176.html
------------------------------
Date: 21 Jul 1999 19:35:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: regular Expression
Message-Id: <3796755e@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:As anyone with web access can find, it was *you* who monikered
:features which become less-and-less experimental as "highly
:experimental and subject to change". Currently there is nothing in
:(?p{}) which is more experimental than (?{}). In turn, there is *one*
:known bug in (?{}), and no misfeatures left.
And then without pausing for breath, continues to state:
:I'm thinking about new names for these guys, which may also allow
^^^^^^^^^
:place for flags.
Please choose one side of your mouth to speak out of. You merely
prove my point.
--tom
--
I eschew embedded capital letters in names; to my prose-oriented eyes,
they are too awkward to read comfortably. They jangle like bad typography.
--Rob Pike
------------------------------
Date: 22 Jul 1999 01:42:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regular Expression
Message-Id: <7n5stp$fkf$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <3796755e@cs.colorado.edu>:
> And then without pausing for breath, continues to state:
>
> :I'm thinking about new names for these guys, which may also allow
> ^^^^^^^^^
> :place for flags.
>
> Please choose one side of your mouth to speak out of. You merely
> prove my point.
Note that for somebody who cannot read, everything looks like proving
his point. Did I say anywhere that the old names are going to be
disabled? (This is assuming for a moment that your message has some
reasonable explanation - linke misreading - and I could invent only
one misreading which might lied a reasonable person to such a message.)
Ilya
------------------------------
Date: Thu, 22 Jul 1999 00:48:03 GMT
From: starthoughts@my-deja.com
Subject: Scrollback perldoc in DOS-window?
Message-Id: <7n5po0$d32$1@nnrp1.deja.com>
Or: How am I supposed to read pods when the pipe
"|more" does NOT work with perldoc.bat -f ?
I used to use a very nice SCROLL BACK buffer
program in plain old DOS and Windows 3.x, but it
does NOT work at all with Windows 95! So, I have
usually used " |more" or even " > filename.txt"
to read whatever flys by on the screen so fast
that I sometimes can't even see it let alone
read it there.
Having started using Perl, I notice that some of
the pods have some kind of screen paging built
into them, BUT WHENEVER I use the "-f" parameter
of perldoc.bat to find out about a function, the
information just flys off the screen (no paging)
and I can NOT use " |more" either!
Once again, I'm using Windows 95 and have tried
this with BOTH the "standard" and ActiveState
versions of perl. Does anyone have a method that
actually works?
The Starman
http://www.geocities.com/Athens/6939/perl.html
Email: thestarman3 (at) netzero NOSPAM (dot) com
(or just go to Feedback.html at my website).
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 22 Jul 1999 01:17:11 GMT
From: revjack <revjack@radix.net>
Subject: Re: Scrollback perldoc in DOS-window?
Message-Id: <7n5ren$1pc$2@news1.Radix.Net>
Keywords: Hexapodia as the key insight
starthoughts@my-deja.com explains it all:
:Or: How am I supposed to read pods when the pipe
:"|more" does NOT work with perldoc.bat -f ?
Why not write something in perl to handle it?
------------------------------
Date: Wed, 21 Jul 1999 21:34:41 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: setuid and opening a file for writing
Message-Id: <1dvbad6.1nzf71e16nieqqN@p37.tc17.metro.ma.tiac.com>
Mark Francis <mark@NO-SPAM.lavalink.com.au> wrote:
> open (FILE, "> $new_file")
> || die "can't open $new_file: $!";
> This is almost character for character from perlipc on how to safely write
> a file when running setuid. But, it still craps out with "Insecure
> dependency in open while running with -T ....".
If $new_file came from outside the script (user input, environment
variable, etc.), did you remember to untaint it?
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 21 Jul 1999 20:35:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Shortening the length of a string
Message-Id: <slrn7pct9k.oqh.abigail@alexandra.delanet.com>
Travis Surgnier (surgie@bellsouth.net) wrote on MMCL September MCMXCIII
in <URL:news:grrl3.632$Hf6.661@news2.mco>:
;; I'm working on a project which outputs several variables from a database.
;; One of these is a description which can get rather long. I'd like to know
;; how to shorten it to $X characters. I've looked through the perlfaq and
;; found nothing, and substr dosn't look to be what I need. If anyone can help,
;; it would be greatly appreciated.
I suggest looking again at substr.
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 21 Jul 1999 20:50:35 -0400
From: "Mark Zeiger" <m.zeiger@worldnet.att.net>
Subject: STDIN redirection
Message-Id: <7n5pt4$ool$1@bgtnsc01.worldnet.att.net>
I have written a program that will either read a (quoted) string from the
command line or, if the string is missing, then the string is read from
STDIN. Is there a way that I can tell if STDIN is redirected or piped from
another program. I want to do this because I handle input from STDIN in a
slightly different manner and I do input from the command line.
Thanks,
Mark Zeiger
------------------------------
Date: Thu, 22 Jul 1999 01:22:49 GMT
From: msdb159@my-deja.com
Subject: straight perl cgi scaleability
Message-Id: <7n5rot$dqa$1@nnrp1.deja.com>
Why doesn't straight perl scale?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 21 Jul 1999 20:58:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <slrn7pculu.oqh.abigail@alexandra.delanet.com>
Bruno Pagis (pagib@aur.alcatel.com) wrote on MMCL September MCMXCIII in
<URL:news:3795E6ED.6B86F137@aur.alcatel.com>:
-- Is there a better way than
-- if ($hash{$key} eq ".")
-- to know that a key has no entry in a hash ?
Yes. You could do it the correct way.
perldoc -f exists
-- I figured out that when a key does not exist, I get a dot returned for
-- the value, but I'm not even sure that it is "standard".
Really? Then you have a seriously broken installation of Perl. I suggest
reinstalling it. And pay attention to 'make test', make sure you get
a 100%.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 21 Jul 1999 21:03:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <slrn7pcutg.oqh.abigail@alexandra.delanet.com>
Marshall Culpepper (marshalc@americasm01.nt.com) wrote on MMCL September
MCMXCIII in <URL:news:3795DFEA.D21702A@americasm01.nt.com>:
!! Bruno Pagis wrote:
!!
!! > Is there a better way than
!! > if ($hash{$key} eq ".")
!! > to know that a key has no entry in a hash ?
!! > I figured out that when a key does not exist, I get a dot returned for
!! > the value, but I'm not even sure that it is "standard".
!! >
!! > BRUNO.
!!
!! this may be what you're looking for:
!! if !defined($hash{$key})
!! and yes i did test it :)
Well, testing it, and still being wrong is about as bad as not testing it.
I'm not sure if isn't worse or not as bad though.
my %hash = (key => undef);
print "I am true!\n" if $hash {key};
print "I am defined!\n" if defined $hash {key};
print "I exist!\n" if exists $hash {key};
The sad thing is, the code above is in the manual.....
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 220
*************************************