[16981] in Perl-Users-Digest
Perl-Users Digest, Issue: 4393 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 21 00:05:38 2000
Date: Wed, 20 Sep 2000 21: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)
Message-Id: <969509109-v9-i4393@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Sep 2000 Volume: 9 Number: 4393
Today's topics:
ANNOUNCE: Tk::TableMatrix Released <j-cerney1@raytheon.com>
Re: Candidate for the top ten perl mistakes list <ren.maddox@tivoli.com>
Re: Candidate for the top ten perl mistakes list (Logan Shaw)
Re: Candidate for the top ten perl mistakes list (Logan Shaw)
Re: Candidate for the top ten perl mistakes list (Damian Conway)
Re: Candidate for the top ten perl mistakes list (Martien Verbruggen)
Re: Candidate for the top ten perl mistakes list (Abigail)
Re: DBI and MS Access (Andrew J. Perrin)
Get a page, Fill a form, Send a form to another site? <d@i.am>
Re: Get a page, Fill a form, Send a form to another sit (Martien Verbruggen)
Re: HELP! Problem returning info from shell call <bwalton@rochester.rr.com>
How to use perl to read content of a gdbm file? <carfield@my-deja.com>
Re: Interpolation on the fly (Abigail)
Re: Interpolation on the fly (Gwyn Judd)
Re: Interpolation on the fly (Abigail)
Re: parsing parentheses nested files <bwalton@rochester.rr.com>
Re: parsing parentheses nested files (Martien Verbruggen)
Re: Perl CGI & Windows 98 <d@i.am>
Re: Perl economy <ren.maddox@tivoli.com>
perl is fun qwex@my-deja.com
Re: perl is fun (Martien Verbruggen)
Re: Perl vs. Java or C++ <meffiem@neo.rr.com>
Re: Portability of Perl/Tk programs? (Clinton A. Pierce)
Re: Redirecting output from executable into a variable <ren.maddox@tivoli.com>
Re: Redirecting the output of an exe into a variable <amonotod@netscape.net>
Re: Redirecting the output of an exe into a variable (Martien Verbruggen)
Re: Regular expression for variable substitution <ren.maddox@tivoli.com>
Re: Regular expression for variable substitution (Abigail)
showing status of running CGI script lionqueen14@my-deja.com
Re: using awk with perl <ren.maddox@tivoli.com>
Re: What's wrong with that regexp? <ren.maddox@tivoli.com>
Re: What's wrong with that regexp? (Garry Williams)
Win32 and Serial Comunications <dani@enpl.es>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 Sep 2000 16:14:14 -0500
From: John Cerney <j-cerney1@raytheon.com>
Subject: ANNOUNCE: Tk::TableMatrix Released
Message-Id: <ssinqjgllespb6@corp.supernews.com>
A new perl/tk widget Tk::TableMatrix has been released to the CPAN.
It is a widget for displaying data in a table or spreadsheet format. It
is implemented all in C-code, so that large datasets can be displayed
with little degradation in performance. (See a portion of the README
file below)
The widget is a port of the tcl/tk tktable widget to perl/tk.
Tk::TableMatrix was chosen as the name for the widget because Tk::Table
already exists.
CPAN location of the new widget:
http://www.cpan.org/modules/by-authors/id/C/CE/CERNEY/
###############################################
### Portion of Tk::TableMatrix README #########
INTRODUCTION
Tk::TableMatrix is a table/matrix widget extension to perl/tk.
The basic features of the widget are:
* multi-line cells
* support for embedded windows (one per cell)
* row & column spanning
* variable width columns / height rows (interactively resizable)
* row and column titles
* multiple data sources ((perl hash|| perl callback) &| internal
caching)
* supports standard Tk reliefs, fonts, colors, etc.
* x/y scrollbar support
* 'tag' styles per row, column or cell to change visual appearance
* in-cell editing - returns value back to data source
* support for disabled (read-only) tables or cells (via tags)
* multiple selection modes, with "active" cell
* multiple drawing modes to get optimal performance for larger tables
* optional 'flashes' when things update
* cell validation support
* Works everywhere Tk does (including Windows and Mac!)
(Note perltk version has only been tested on Solaris, Linux,
win98/mingw32 as of 8/18/00)
------------------------------
Date: 20 Sep 2000 18:02:35 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <m34s3avf90.fsf@dhcp11-177.support.tivoli.com>
SPAM+indigo@dimensional.com (Tim) writes:
> Then please explain the mnemonic for push @array, $value :)
>
> I remember join just fine...push and unshift mess me up.
That certainly is a bit tougher, but the more general pattern is that
if any of the arguments are special, they come first.
push (and unshift) are not "push @array, $value" but rather "push
@array, $value1, $value2, ..."
To wit:
chmod MODE, LIST
chown UID, GID, LIST
exec PROGRAM LIST
formline PICTURE, LIST
grep BLOCK LIST
grep EXPR, LIST
join EXPR, LIST
kill SIGNAL, LIST
map BLOCK LIST
map EXPR, LIST
no Module LIST
open FILEHANDLE, MODE, LIST
pack TEMPLATE, LIST
print FILEHANDLE LIST
printf FILEHANDLE FORMAT, LIST
push ARRAY, LIST
sort SUBNAME LIST
sort BLOCK LIST
splice ARRAY, OFFSET, LENGTH, LIST
sprintf FORMAT, LIST
system PROGRAM LIST
tie VARIABLE, CLASSNAME, LIST
unshift ARRAY, LIST
use Module VERSION LIST
use Module LIST
Actually, what bothers me (well, a little bit at least) is the
inconsistency with whether a comma is required or not. I think all
functions of this type should allow the comma(s) before LIST to be
omitted.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 20 Sep 2000 20:32:21 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <8qbof5$c82$1@provolone.cs.utexas.edu>
In article <8FB5A2FC5indigodimcom@166.93.207.145>,
Tim <SPAM+indigo@dimensional.com> wrote:
>logan@cs.utexas.edu (Logan Shaw) wrote in
><8qbb6t$ibl$1@cheddar.cs.utexas.edu>:
>
>>In article <3U9y5.2124$Rk1.35465@news2-win.server.ntlworld.com>,
>>Glyndwr <glynFOOdwr@FSCKdeleteEmeD.co.uk> wrote:
>>>Drifting slightly off topic, I always - without fail - get the operands
>>>for join(@foo, ",")[*] around the wrong way. Same problem with ln under
>>>*Nix. Total mental block.
>>
>>join() is a bit trickier, but it makes sense if you try to imagine
>>implementing join() yourself. Is this
>>
>> sub join
>> {
>> my (@things, $separator) = @_;
>>
>> # . . .
>> }
>>
>>going to work out very well? Nope -- the arguments will all get sucked
>>into @things and $separator will be undef.
>
>Then please explain the mnemonic for push @array, $value :)
The mnemonic is that push() modifies the array it's given,
so the my() analogy doesn't hold, so it's the other way.
The other mnemonic is that the thing you're pushing goes
after the things that are already there, so if you imagine
the array being left to right, then it only makes sense to
have the new last thing in the array on the right. If you
like, think of the fact that the value of this expression
(@foo, $bar)
is the same as what @foo will have in it after you do a
push (@foo, $bar)
The only problem with this way of thinking is that now
somebody's going to follow up and say, "Then please explain
the mnemonic for 'unshift (@foo, $bar);' :)", and I'm going
to have to answer that the mnemonic is that unshift() works
like push() because (I would guess) push() inspired unshift().
Now, if someone can come up with a plausible mnemonic for the
operands to splice(), I'll be impressed. Also, I might start
using splice(), which I don't right now because I never can
remember how it works.
- Logan
------------------------------
Date: 20 Sep 2000 20:43:02 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <8qbp36$ccc$1@provolone.cs.utexas.edu>
In article <s0dy5.1995$hD4.575937@news1.rdc1.mi.home.com>,
Clinton A. Pierce <clintp@geeksalad.org> wrote:
> Top ten mistakes newbies make
>
> 4. wrong career choice
LOL!
Too, too true. I've worked with a number of people who just don't seem
to get some pretty simple things. One particular guy really perplexed
me. I finally understood when I realized that, despite having majored
in computer science and despite working as a system admin and
developer, his issue was that he simply didn't like computers. (I
guess he must have decided it was a good career path or something.)
- Logan
------------------------------
Date: 21 Sep 2000 02:05:53 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <8qbqe0$pu9$1@towncrier.cc.monash.edu.au>
> Then please explain the mnemonic for push @array, $value :)
C<push @array, $value> puts the $value at the *end* of the @array,
so $value is at the *end* of the call.
C<join $value, @list> puts the $value in the *middle* of the @list,
so $value is in the *middle* of the call.
:-)
Damian
------------------------------
Date: Thu, 21 Sep 2000 02:11:41 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <slrn8sirim.m9.mgjv@verbruggen.comdyn.com.au>
On 21 Sep 2000 02:05:53 GMT,
Damian Conway <damian@cs.monash.edu.au> wrote:
> > Then please explain the mnemonic for push @array, $value :)
>
> C<push @array, $value> puts the $value at the *end* of the @array,
> so $value is at the *end* of the call.
Please explain the mnemonic for
unshift @array, $value;
> C<join $value, @list> puts the $value in the *middle* of the @list,
> so $value is in the *middle* of the call.
Please explain the mnemonic for
splice @array, $offset, $length, $value
for $offset + $length < $#array
:)
I don't think that you can come up with any sensible set of mnemonics
that are going to make life easier than just understanding the
difference between lists and arrays, and how Perl acts 9can act) on
them.
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: 21 Sep 2000 03:04:00 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <slrn8siuio.5fq.abigail@alexandra.foad.org>
Larry Rosler (lr@hpl.hp.com) wrote on MMDLXXVII September MCMXCIII in
<URL:news:MPG.1432e5732eb2f63e98ada4@nntp.hpl.hp.com>:
<> In article <8FB5A2FC5indigodimcom@166.93.207.145> on Wed, 20 Sep 2000
<> 22:30:30 GMT, Tim <SPAM+indigo@dimensional.com> says...
<>
<> You won't go wrong if you use the fat comma to separate
<> operator+specifier from operands, as Abigail and I promote (also for
<> pack/unpack, sprintf, et al):
<>
<> join ',' => @foo;
<>
<> > Then please explain the mnemonic for push @array, $value :)
<> >
<> > I remember join just fine...push and unshift mess me up.
<>
<> That's why I would never write (as I have seen written here):
<>
<> push @array => $value; # UGH!!!
But, but, but, push follows the same structure as join.
Operator, specifier, list of operands.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
------------------------------
Date: 20 Sep 2000 19:51:33 -0400
From: aperrin@demog.berkeley.edu (Andrew J. Perrin)
Subject: Re: DBI and MS Access
Message-Id: <upuly39mi.fsf@demog.berkeley.edu>
Nektarios Rigas <umrigas@cc.umanitoba.ca> writes:
> Hello Everyone,
>
> I'm new to perl and am about to run out an buy the Perl DCI book by
> O'reilly.
> But before I do, I figured I'd throw out this question.
>
> I am planning on writing a perl script that queries an MS Access
> database.
> I know that this is possible on an NT server, but the server that this
> script is going to run and reside on is a Linux server. Is it possible
> to store this Access DB on the linux server and have this script run
> correctly?
The very quick answer is "yes": you can store it on a linux server and
have an NT machine mount the drive, run access, read the database, and
run the script. But I suspect this is not what you want.
The slightly less quick answer is "no": you cannot read .mdb files on
a linux machine, since Access runs only on NT.
The longer answer is "yes": Using DBI's proxy system (which,
disclaimer, I've never used) I believe you can run your script on
linux and have it go query an access database on an NT system, which
approximates what I suspect you're trying to do.
There are some other, equally hairy, options; for example, you could
try something like running vmware on the linux machine and using its
virtual network to query the access database within a windows
subsystem. But I'd be pretty hesitant to try that.
>
> If not, what is required?
Well, the easiest answer is to use something other than
Access. PostgreSQL, for example, or MySQL, each of which will be
perfectly happy to reside on your linux box and do what you need. As
a bonus you can use them via ODBC so if you've got Access reports and
junk you need to run you still can.
--
----------------------------------------------------------------------
Andrew Perrin - Solaris-Linux-NT-Samba-Perl-Access-Postgres Consulting
aperrin@igc.apc.org - http://demog.berkeley.edu/~aperrin
----------------------------------------------------------------------
------------------------------
Date: Thu, 21 Sep 2000 08:45:56 +0700
From: "Dimitri" <d@i.am>
Subject: Get a page, Fill a form, Send a form to another site?
Message-Id: <8qbpjg$tqm$2@news.asiaaccess.net.th>
How to get a page with a form from a site?
Fill the form and post the form to this site?
Receive the next page?
------------------------------
Date: Thu, 21 Sep 2000 02:15:12 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Get a page, Fill a form, Send a form to another site?
Message-Id: <slrn8sirp9.m9.mgjv@verbruggen.comdyn.com.au>
On Thu, 21 Sep 2000 08:45:56 +0700,
Dimitri <d@i.am> wrote:
> How to get a page with a form from a site?
use LWP::Simple;
or maybe
use LWP::UserAgent;
if you need something more complex.
> Fill the form and post the form to this site?
You'll need to know what goes in the form. You stand simply no chance
in general.
# perldoc lwpcook
> Receive the next page?
Just submit the form stuff, and read the response. HTTP doesn't work
in pages, it works with requests and responses.
Install the LWP modules, and use them. Understand HTTP and the web.
Then write code. Until you understand how all this works, you will not
be able to correctly do any of this.
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
NSW, Australia | being a damn fool about it.
------------------------------
Date: Thu, 21 Sep 2000 01:11:34 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: HELP! Problem returning info from shell call
Message-Id: <39C96110.4460C4B9@rochester.rr.com>
lullaby25 wrote:
>
> I should have been a little more specific. The program that i am tryign
> to run from the shell call is running, and I have information that is
> supposed to be returning to the calling program using standard out (ex.
> I call a batch file from my main script and it uses an echo line to
> return some variable). My problem is that that information is not
> getting back to my main program. I don't know how to configure the
> standard out, and I don't believe that it is buffering anywhere. I
> haven't worked too much with environmental variables, so I am not sure
> if this is the problem. Thanks for your input. :)
>
> Melissa
OK, I understand your problem. I have seen it on *one* Windoze 98 SE
system, on which the problem appears to be permanent and unfixable. The
symptoms are that *any command* passed via Perl backticks does not
return any output (it goes to the screen instead). It appears to be
independent of the Perl version. Programs that are absolutely the same
run fine on both my Windoze 98 SE systems, but fail in this fashion on
my friend's Windoze 98 SE system. The cause of the problem as well as
any fix eludes me entirely. I did not try drastic things like
formatting his hard drive and starting over. A previous enquiry to this
newsgroup results in no response, so this problem must not happen a
lot. Any ideas, anyone?
------------------------------
Date: Thu, 21 Sep 2000 03:33:05 GMT
From: Carfield Yim <carfield@my-deja.com>
Subject: How to use perl to read content of a gdbm file?
Message-Id: <8qbvhg$evv$1@nnrp1.deja.com>
As title, I write the following simple code in order to read the
content of my gdbm file, but report cannot open the dbm file:
sub printDBM {
dbmopen(%dbm, $_[0], undef) || die "cannot open $_[0] for
read\n";
foreach $key (keys %dbm) { # step through all values
print "$key\t%dbm{$key}\n";
}
dbmclose(%dbm);
}
I can sure that the path is correct, and everyone have read permission.
Besides, How can I see the error message of why I can't open the file
for read??
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 21 Sep 2000 02:37:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Interpolation on the fly
Message-Id: <slrn8sit0g.5fq.abigail@alexandra.foad.org>
Dave Sherohman (esper@news.visi.com) wrote on MMDLXXVII September
MCMXCIII in <URL:news:slrn8sib1o.npj.esper@pchan.dojo>:
!! How do you perform late (i.e., on use rather than assignment) interpolation
!! of variables into strings?
!!
!! What I want to do is:
!!
!! $fmt = 'User: $user';
!! print $fmt; # prints "User: "
!! $user = 'tom';
!! print $fmt; # "User: tom"
!! $user = 'dick;
!! print $fmt; # "User: dick"
!! $user = 'harry';
!! print $fmt; # "User: harry"
!!
!! What I get, all 4 times, is "User: $user".
That's because you used single quotes the first time.
!! Can this be done using variable interpolation or will I have to resort to
!! copying $fmt and using s/// to explicitly insert the name each time?
Yes you can do it as you want, provided you have a modern Perl.
Don't listen to those people saying you need the (slow) eval.
#!/opt/perl/bin/perl -w
use strict;
use overload '.' => sub {bless [@{$_[0]} => \$_[1]] => "main"};
use overload '""' => sub {join "" => map {$$_} @{$_[0]}};
BEGIN {
overload::constant q => sub {
$_ [2] eq "qq" ? bless [\$_[1]] => "main" : $_ [1];
}
}
my $user;
my $fmt = "User: $user";
$user = "tom";
print "$fmt\n";
$user = "dick";
print "$fmt\n";
$user = "harry";
print "$fmt\n";
__END__
User: tom
User: dick
User: harry
(Hmm, perhaps I should put this on CPAN)
Abigail
--
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'
# The King beside a
# river. A carp in a stream.
# A flying raven.
------------------------------
Date: Thu, 21 Sep 2000 03:20:12 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Interpolation on the fly
Message-Id: <slrn8sivja.5td.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>Yes you can do it as you want, provided you have a modern Perl.
>Don't listen to those people saying you need the (slow) eval.
People? I resent that, I'm the only one on my newsfeed recommeding the
(slow) eval. :)
> #!/opt/perl/bin/perl -w
> use strict;
>
> use overload '.' => sub {bless [@{$_[0]} => \$_[1]] => "main"};
> use overload '""' => sub {join "" => map {$$_} @{$_[0]}};
>
> BEGIN {
> overload::constant q => sub {
> $_ [2] eq "qq" ? bless [\$_[1]] => "main" : $_ [1];
> }
> }
>
> my $user;
> my $fmt = "User: $user";
>
> $user = "tom";
> print "$fmt\n";
>
> $user = "dick";
> print "$fmt\n";
>
> $user = "harry";
> print "$fmt\n";
my @blah = qw(hi there);
print "@blah\n";
Interesting little side effect. Given that eval is slower, I find it a
little easier to understand, but that's probably just me.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
If you can't learn to do it well, learn to enjoy doing it badly.
-- Ashleigh Brilliant
------------------------------
Date: 21 Sep 2000 03:55:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Interpolation on the fly
Message-Id: <slrn8sj1k4.5fq.abigail@alexandra.foad.org>
Gwyn Judd (tjla@guvfybir.qlaqaf.bet) wrote on MMDLXXVIII September
MCMXCIII in <URL:news:slrn8sivja.5td.tjla@thislove.dyndns.org>:
~~ I was shocked! How could Abigail <abigail@foad.org>
~~ say such a terrible thing:
~~
~~ >Yes you can do it as you want, provided you have a modern Perl.
~~ >Don't listen to those people saying you need the (slow) eval.
~~
~~ my @blah = qw(hi there);
~~ print "@blah\n";
~~
~~ Interesting little side effect. Given that eval is slower, I find it a
~~ little easier to understand, but that's probably just me.
I can fix that:
#!/opt/perl/bin/perl -w
use strict;
use overload '.' => sub {$_ [0] = [\$_ [0]] unless ref $_ [0];
$_ [1] = [\$_ [1]] unless ref $_ [1];
bless [$_ [2] ? (@{$_ [1]} => \$_ [0])
: (@{$_ [0]} => \$_ [1])] => "main"};
use overload '""' => sub {join "" => map {$$_} @{$_[0]}};
BEGIN {
overload::constant q => sub {
$_ [2] eq "qq" ? bless [\$_[1]] => "main" : $_ [1];
}
}
my $user;
my $fmt = "User: $user";
$user = "tom";
print "$fmt\n";
$user = "dick";
print "$fmt\n";
$user = "harry";
print "$fmt\n";
my @blah = qw /hi there/;
print "@blah\n";
__END__
User: tom
User: dick
User: harry
hi there
But it doesn't do "late" interpolation of arrays.
Abigail
--
print 74.117.115.116.32;
print 97.110.111.116.104.101.114.32;
print 80.101.114.108.32;
print 72.97.99.107.101.114.10;
------------------------------
Date: Thu, 21 Sep 2000 01:59:31 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: parsing parentheses nested files
Message-Id: <39C96C4A.AB858BB9@rochester.rr.com>
bhaskaracharya@my-deja.com wrote:
>
> hi,
> Are there standard ways to process parentheses nested files?
> I tried various ways like having subs to countparentheses(add 1 for open
> and -- for closing, etc) and pushing each word to an array but it looks
> tedoious...Are there any good parsing modules to do this? Any examples
> are appreciated..
...
> E,g
> (Net data[255]
> (wire (path m2 360 844 220 844 221)
> (connect (terminal smd data[255]) (terminal via))
> )
> (wire (path m3 720 119 147 119 147 119 148 (lead_ext 680) (trail_ext
> 680))
> (connect (terminal via) (terminal via))
> )
> )
...
Here is a nice little routine (thanks to Jeff Friedl for the original)
that will make a regex that will match the longest string containing
balanced parens, up to an argument-specified depth. Its behavior might
get flaky for several hundred deep. Don't know if it might help you,
but if so, here you go:
sub make_parenmatching_regex { #return a regex which will match a string
my($depth) = @_; #with up to $depth levels of nested
parens
my($nonparen) = '[^()]';
"(?:$nonparen|\\(" x $depth . "$nonparen*" . '\))*' x ($depth-1) .
'\))+';
}
There are also modules like Text::Balanced which may help.
--
Bob Walton
------------------------------
Date: Thu, 21 Sep 2000 02:17:51 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: parsing parentheses nested files
Message-Id: <slrn8siru8.m9.mgjv@verbruggen.comdyn.com.au>
On Wed, 20 Sep 2000 18:52:49 GMT,
bhaskaracharya@my-deja.com <bhaskaracharya@my-deja.com> wrote:
> hi,
> Are there standard ways to process parentheses nested files?
> I tried various ways like having subs to countparentheses(add 1 for open
> and -- for closing, etc) and pushing each word to an array but it looks
> tedoious...Are there any good parsing modules to do this? Any examples
> are appreciated..
# perldoc -q balanced
Found in /opt/perl/lib/5.6.0/pod/perlfaq6.pod
Can I use Perl regular expressions to match balanced text?
[SNIP]
IOW: read the Perl FAQ, section 6. It contains references to code that
probably will be of help to you.
Martien
--
Martien Verbruggen |
Interactive Media Division | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd. | Then things get worse.
NSW, Australia |
------------------------------
Date: Thu, 21 Sep 2000 08:41:52 +0700
From: "Dimitri" <d@i.am>
Subject: Re: Perl CGI & Windows 98
Message-Id: <8qbpje$tqm$1@news.asiaaccess.net.th>
You need to install a web server. I use the same configuration as you with
the web server Omni httpD. You can dowload it from
http://www.omnicron.ab.ca/ Very easy to install.
Dimitri.
"Richard Bessler" <rbessler@att.net> wrote in message
news:GO9y5.146$tl2.7819@bgtnsc07-news.ops.worldnet.att.net...
Quick Question
I'm running from my home Windows 98 (with ActiveState's PERL
loaded on it), and is it at all possible for me to set up my system so I can
run CGI scripts (through browser) locally (for free :-))? I'd appreciate any
assistence on this, and if I need something, could you point me to the right
direction?
Thanks,
Richard
------------------------------
Date: 20 Sep 2000 18:32:41 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Perl economy
Message-Id: <m3vgvqtzae.fsf@dhcp11-177.support.tivoli.com>
Larry Rosler <lr@hpl.hp.com> writes:
> In article <CL%x5.7$ii2.829@vic.nntp.telstra.net> on Wed, 20 Sep 2000
> 09:50:26 GMT, scott@mobinfo.com.au <scott@mobinfo.com.au> says...
>
> ...
>
> > Is there a more succinct way to do this:
> >
> > $a = '/home/scott/inc /usr/include /home/scott/program/include'
> > x join(' ', map({ $_ = '-I' . $_ } split(/\s+/, $a)))
> > 0 '-I/home/scott/inc -I/usr/include -I/home/scott/program/include'
>
> join ' -I', "", split " ", $a
Here are some more:
(Larry's squeezed)
join' -I',"",split" ",$a
$a=~s/(\S+)/-I$1/g
$a=~s/^| / -I/g
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 21 Sep 2000 01:55:04 GMT
From: qwex@my-deja.com
Subject: perl is fun
Message-Id: <8qbppg$8cm$1@nnrp1.deja.com>
http://devlib.virtualave.net/ has lots of great perl resources
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 21 Sep 2000 02:06:41 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: perl is fun
Message-Id: <slrn8sir9a.m9.mgjv@verbruggen.comdyn.com.au>
On Thu, 21 Sep 2000 01:55:04 GMT,
qwex@my-deja.com <qwex@my-deja.com> wrote:
> http://devlib.virtualave.net/ has lots of great perl resources
They have an entry for Perl/CGI.
'nuff said.
> Sent via Deja.com http://www.deja.com/
That figures. I guess that'll teach me for allowing posts from deja to
slip through my score file.
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Thu, 21 Sep 2000 02:49:49 GMT
From: "Michael A. Meffie III" <meffiem@neo.rr.com>
Subject: Re: Perl vs. Java or C++
Message-Id: <39C977F8.DD94A8@neo.rr.com>
rathmore@tierceron.com wrote:
(snip)
> My question is, should I continue to learn Perl? Is the demand for Perl
> programmers high? Higher than Java or C++?
(snip)
> If you have an opinion on this and wouldn't mind sharing, I'd love to
> read what everyone thinks.
IMHO, Would you ask a carpenter to choose between learning how to use a
hammer,
a level, and a saw? These are the tools of the trade. As a professional
programmer you should be able to know which tool is useful for the task
at hand.
Mike --
------------------------------
Date: Thu, 21 Sep 2000 01:19:03 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Portability of Perl/Tk programs?
Message-Id: <bmdy5.2029$hD4.584589@news1.rdc1.mi.home.com>
[No mail because of indecipherable anti-spam crap]
In article <m3og1isgif.fsf@solo.david-steuber.com>,
David Steuber <nospam@david-steuber.com> writes:
> I'm considering using Perl/Tk for an application that will use a GUI
> [...]
> I already know that there is no fork in Windows.
Bzzzt. Wrong. Has been since 5.6.
> Oh, how portable are the various crypt modules and the MD5 digest
> module? Can I expect them to be available?
They're there and work just peachy.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: 20 Sep 2000 19:01:31 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Redirecting output from executable into a variable
Message-Id: <m3og1itxyc.fsf@dhcp11-177.support.tivoli.com>
"mike" <mike@esterling.co.uk> writes:
> Hi,
> How can I get the output of an exe file into a variable in perl so I can
> display it in a cgi page.
> I have it working with the open command so it displays the output straight
> away but I can't find out how to put that into a variable instead of
> displaying it.
Something like:
$var = `command`;
?
perldoc perlop
(search for "qx/STRING/")
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 21 Sep 2000 02:11:23 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Redirecting the output of an exe into a variable
Message-Id: <8qbqnu$9e3$1@nnrp1.deja.com>
In article <iH2y5.10283$pi.91036@NewsReader>,
"mike" <mike@esterling.co.uk> wrote:
> Hi,
> I want to redirect the output of a program (analog) into a variable,
> I can display the output on screen using the open command but need it
> in a variable.
backticks --> `
my $param1 = $FORM{dir};
my $result = `ls $param1`;
print $result;
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 21 Sep 2000 02:38:10 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Redirecting the output of an exe into a variable
Message-Id: <slrn8sit4b.m9.mgjv@verbruggen.comdyn.com.au>
On Wed, 20 Sep 2000 14:14:39 +0100,
mike <mike@esterling.co.uk> wrote:
> Hi,
> I want to redirect the output of a program (analog) into a variable, I can
> display the output on screen using the open command but need it in a
> variable.
I'm not sure what you mean by 'using the open command'....
You are probably looking for qx// or backticks.
# perldoc perlop
[snip]
qx/STRING/
`STRING`
A string which is (possibly) interpolated and then
executed as a system command with `/bin/sh' or its
equivalent. Shell wildcards, pipes, and redirec
tions will be honored. The collected standard
output of the command is returned; standard error
is unaffected.
[snip more on qx//]
If you also want to capture stderr, or maybe you want to capture
stdout and stderr separately, read the perlopentut and perlipc
documentation and the perlfunc entry on open.
# perldoc -f open
# perldoc perlipc
# perldoc perlopentut
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed,
Commercial Dynamics Pty. Ltd. | destroy all evidence that you tried.
NSW, Australia |
------------------------------
Date: 20 Sep 2000 18:54:03 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Regular expression for variable substitution
Message-Id: <m3r96etyas.fsf@dhcp11-177.support.tivoli.com>
nobull@mail.com writes:
> chop ( $line = eval "<<EOL\n$line\nEOL\n" );
Maybe I'm missing something, but why the EOL stuff? What's wrong
with:
$line = eval "qq($line)";
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 21 Sep 2000 03:15:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Regular expression for variable substitution
Message-Id: <slrn8siv7g.5fq.abigail@alexandra.foad.org>
Ren Maddox (ren.maddox@tivoli.com) wrote on MMDLXXVII September MCMXCIII
in <URL:news:m3r96etyas.fsf@dhcp11-177.support.tivoli.com>:
$$ nobull@mail.com writes:
$$
$$ > chop ( $line = eval "<<EOL\n$line\nEOL\n" );
$$
$$ Maybe I'm missing something, but why the EOL stuff? What's wrong
$$ with:
$$
$$ $line = eval "qq($line)";
It's more likely that $line contains an unbalanced set of parens than
the character sequence "\nEOL\n".
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
Date: Thu, 21 Sep 2000 01:37:17 GMT
From: lionqueen14@my-deja.com
Subject: showing status of running CGI script
Message-Id: <8qbooc$7b2$1@nnrp1.deja.com>
Hi All,
I have a CGI script which run kinda slow. So
I'd like to show some kinda status on the
browser while it's running so the users know
what's going on.
Do you know any way to achieve this?
Thanks in advance.
Meagan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 20 Sep 2000 18:14:21 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: using awk with perl
Message-Id: <m31yyevepe.fsf@dhcp11-177.support.tivoli.com>
potato_salad@my-deja.com writes:
> I am wanting to use this line in a perl CGI script to grab the IP
> address of the users machine/firewall. when I run the below command
>
> /usr/local/apache/cgi-bin/printenv | grep REMOTE_ADDR|awk '{print $3}'
>
> it returns > REMOTE_ADDR = 200.200.200.2
>
> I want to cut everything but the 200.200.200.2 using awk. But it does
> not work that way.
>
> I am new to perl and any help would be great. Thanks, Yamar.
Not sure why you would want to call awk from a Perl script.
Try using $ENV{REMOTE_ADDR} in the Perl script... it should give you
what you want.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 20 Sep 2000 18:19:18 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: What's wrong with that regexp?
Message-Id: <m3ya0mtzwp.fsf@dhcp11-177.support.tivoli.com>
"FX" <FX@hasnomail.com> writes:
> "FX" <FX@hasnomail.com> writes:
> >I want to check if a filename, contained in a file, is a valid one.
> >I don't want then to have \ / : * ? " < > |
> Ok forget that question
> if ($fileName =~ /[\x03|\x2f|\x3A|\x2A|\x3F|\x22|\x3C|\x3E|\x7C]/){
> Works !
Inside a character class, all those "|"s are useless...
In addition, you could just use:
if ( $filename =~ m{[\\/:*?"<>|]} ) {
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 21 Sep 2000 03:59:47 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: What's wrong with that regexp?
Message-Id: <TIfy5.651$fa2.50718@eagle.america.net>
On 20 Sep 2000 18:19:18 -0500, Ren Maddox <ren.maddox@tivoli.com> wrote:
>"FX" <FX@hasnomail.com> writes:
>> "FX" <FX@hasnomail.com> writes:
...
>> Ok forget that question
>> if ($fileName =~ /[\x03|\x2f|\x3A|\x2A|\x3F|\x22|\x3C|\x3E|\x7C]/){
>> Works !
>
>Inside a character class, all those "|"s are useless...
All but one, that is.
--
Garry Williams
------------------------------
Date: Wed, 20 Sep 2000 17:46:08 +0200
From: Dani Pardo <dani@enpl.es>
Subject: Win32 and Serial Comunications
Message-Id: <04maq8.5ra.ln@calix.enpl.es>
Hi All, I'm using Win32 Perl version 5.004_02, and I need to comunicate with
a barcode reader through the serial port (funny, isn't it?)
Well, the barcode reader sends ASCII text, just one line, and I try
to read this line with:
open(COM,"COM1:") || die "Can't open COM1: " . $!;
while(1)
{
while(<COM>)
{
print $_;
}
}
But I don't read anything :(
I've setup the comm port with MODE COM1: 9600,N,8,1
Any hint?
Please, reply also by mail because I haven't enough time to read this group..
---
Dani Pardo, dani@enpl.es
Enplater S.A
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 4393
**************************************