[13592] in Perl-Users-Digest
Perl-Users Digest, Issue: 1002 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 6 16:05:55 1999
Date: Wed, 6 Oct 1999 13:05:31 -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: <939240330-v9-i1002@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 6 Oct 1999 Volume: 9 Number: 1002
Today's topics:
(?p{}) was [Re: Backreference in Regex Code Block?] <ltl@rgsun5.viasystems.com>
<<EOL and Sub <samay1NOsaSPAM@hotmail.com.invalid>
Re: <<EOL and Sub (Scott McMahan)
Re: <<EOL and Sub (Charles DeRykus)
Re: bug or feature? (Abigail)
Re: bug or feature? <gellyfish@gellyfish.com>
Re: Bug with localtime() in Perl 5.004 and 5.005 (Abigail)
Re: C style was Re: Random Numbers (Abigail)
Re: C style was Re: Random Numbers <ltl@rgsun5.viasystems.com>
Calculate tan(); <debot@xs4all.nl>
Re: Caliing method by reference with arrow operator (Abigail)
Re: Calling functions between PerlScript and J*Script djearthling@my-deja.com
Re: Checking for processes (M.J.T. Guy)
Re: checking for string in multiple line scalar (part I (Christopher R. Maden)
Re: Converting 1.1.1.1 to blah.foo.com (Abigail)
Re: converting to Linux from NT but need a hand. <woodwort@utmc.utc.com>
Damn Comma Delmitation <mcti@my-deja.com>
Re: Damn Comma Delmitation <emschwar@rmi.net>
Re: Damn Comma Delmitation <jeff@vpservices.com>
Re: Damn Comma Delmitation <mcti@my-deja.com>
Re: Damn Comma Delmitation <flavell@mail.cern.ch>
Re: Download Perl 5 <gellyfish@gellyfish.com>
Effective Posting (was:Regular Expressions...) (Bill Moseley)
extracting perldoc documentation jdkronicz@my-deja.com
Re: extracting perldoc documentation <dan@tuatha.sidhe.org>
FileSelect <jivens@lpl.arizona.edu>
Re: fork & NT Perl (Scott McMahan)
Re: GDBM access behave differently when called from CG <l.laperrousaz@net-clic.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Oct 1999 17:25:55 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: (?p{}) was [Re: Backreference in Regex Code Block?]
Message-Id: <7tg0n3$778$1@rguxd.viasystems.com>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
:>[A complimentary Cc of this posting was sent to Kenneth Bandes
:><kbandes@home.com>],
:>who wrote in article <37F1F172.F0162186@home.com>:
:>> What I'm trying to do is create a regex that applies itself
:>> recursively:
:>>
:>> $exp = qr/^(x|\((.*)\)(?{ $2 =~ m{$exp} }))$/;
:>>
:>> which would behave like a recursive-descent parser. But
:>> I have to solve this reference problem.
:>Just use (?p{}) instead.
All of the other fish ignored the lure, but I'm a sucker for
shiny new regexp toys, so I'll bite. What does (?p{}) do (or what
will it do when I eventually get a perl that has it)?
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Wed, 06 Oct 1999 11:09:46 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: <<EOL and Sub
Message-Id: <004aa0e3.e569f612@usw-ex0102-016.remarq.com>
Hi, Is there anyway, I can do something like
$a = <<EOL
the result of sub is
&mysub
EOL
sub mysub{
return 5;
}
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 06 Oct 1999 19:33:41 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: <<EOL and Sub
Message-Id: <puNK3.221$QI5.8726@monger.newsread.com>
Samay (samay1NOsaSPAM@hotmail.com.invalid) wrote:
> Hi, Is there anyway, I can do something like
> $a = <<EOL
> the result of sub is
> &mysub
> EOL
> sub mysub{
> return 5;
> }
I do this frequently.
$str = mysub();
$a = <<EOL;
the result of sub is $str
EOL
Scott
------------------------------
Date: Wed, 6 Oct 1999 19:29:38 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: <<EOL and Sub
Message-Id: <FJ74tE.DpJ@news.boeing.com>
In article <004aa0e3.e569f612@usw-ex0102-016.remarq.com>,
Samay <samay1NOsaSPAM@hotmail.com.invalid> wrote:
>Hi, Is there anyway, I can do something like
>$a = <<EOL
>the result of sub is
>&mysub
>EOL
>
>sub mysub{
> return 5;
>}
>
>
perldoc perlfaq4 | grep "expand function calls"
--
Charles DeRykus
------------------------------
Date: 6 Oct 1999 13:20:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: bug or feature?
Message-Id: <slrn7vn57n.23p.abigail@alexandra.delanet.com>
Alexander Knack (ak@dasburo.de) wrote on MMCCXXVI September MCMXCIII in
<URL:news:37FA2E26.7C5D8DFB@dasburo.de>:
\\ why does the following not work?
\\
\\ $x = '23.24.25';
\\ @y = split '.', $x;
\\ print (join " ", @y), "\n";
It works fine for me.
What do you expect to happen?
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
-----------== 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: 5 Oct 1999 21:48:16 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: bug or feature?
Message-Id: <7tdrn0$m0$1@gellyfish.btinternet.com>
On Tue, 05 Oct 1999 18:58:14 +0200 Alexander Knack wrote:
> why does the following not work?
>
> $x = '23.24.25';
> @y = split '.', $x;
> print (join " ", @y), "\n";
>
> *shrug*
Of course you did run this with perl -w didnt you ? and you did read
the manpage about split to find out what kind of thing the first
argument to split is ? Oh and the manpage about print and the perlop
manpage about the comma operator ...
I think you'll kick yourself ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 6 Oct 1999 13:35:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <slrn7vn63h.23p.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCXXVI September MCMXCIII in
<URL:news:MPG.1263dd929c0da2be98a03a@nntp.hpl.hp.com>:
~~ In article <TDqK3.17199$t%3.1261029@typ11.nn.bcandid.com> on Tue, 05 Oct
~~ 1999 17:33:39 GMT, Alan Curry <pacman@defiant.cqc.com> says...
~~
~~ > Currently it says they come from struct tm. And localtime(3) says the tm_se
~~ > field of a struct tm goes from 0 to 61. So with the present state of the
~~ > docs, I'd say that there _are_ leap seconds in perl.
~~
~~ No, there aren't. Or even in Perl. With the present state of the docs,
~~ I'd say that there _are_ incorrect docs in C (in fact, in the C
~~ Standard). Which should probably be reported elsewhere.
Well, yes and no. The '61' part doesn't make sense, that should be '60'.
And yes, time() and localtime() don't deal with leap seconds. But that
doesn't mean other programs don't! Anything that's serious about time
will allow for leap seconds. And if the standard said the tm struct takes
0-59 in the seconds field, you would need a different struct if you want
to use leap seconds.
time(), localtime() and friends don't have exclusive usage of the tm struct.
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: 6 Oct 1999 14:20:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: C style was Re: Random Numbers
Message-Id: <slrn7vn8nh.23p.abigail@alexandra.delanet.com>
lt lindley (ltl@rgsun5.viasystems.com) wrote on MMCCXXVI September
MCMXCIII in <URL:news:7tdtpu$i0q$1@rguxd.viasystems.com>:
{} Uri Guttman <uri@sysarch.com> wrote:
{} :>c style for loops are not cool in perl. rarely needed in fact. and i
{} :>don't mean foreach loops which are a different animal.
{}
{} Dear Perl Style Doctor,
{}
{} When I write C code for most of the day, then switch to writing Perl,
{} my Perl looks like C. Oh the shame, the shame. ;-)
Well, I think that's officially "ok" by Larry.
{} It may just be a vestigal habit, but I still find myself using
{} C-style for loops at times. Although Perl allows for nice data
{} structures to represent relationships in the data, sometimes for
{} simple data it seems easier to use multiple arrays that share the
{} same index instead.
{}
{} I've written plenty of Perl code that uses something like:
{}
{} while (some loop conditional) {
{} push @coords, [$x, $y];
{} }
{} ...
{} for my $coord (@coords) {
{} do something with $coord->[0] and with $coord->[1]
{} }
{}
{} ### but is that really any better than
{}
{} while (some loop conditional) {
{} push @xvals, $x; push @yvals, $y;
{} }
{} ...
{} for (my $i = $#xvals; $i >= 0; $i--) {
{} do something with $xvals[$i] and $yvals[$i]
{} }
{}
{} The first way has a certain elegance in the way it models coordinate
{} pairs as "things", but all of that creation of anonymous arrays and
{} extra dereferencing seems so wasteful to my spendthrift side.
And using 2 arrays isn't wasteful because of... ? If you are not willing
to throw memory around as if it didn't cost anything, you should be using
Perl anyway! ;-)
{} What's the matter with the simplicty of just using 2 arrays and
{} sharing the index? Or is that a false simplicity?
I think so. Not only do you have an implied relationship between your
arrays, which is more prone to certain errors than having a single array
(what happens if @xvals != @yvals?), but IMO,
for my $coord (@coords)
is simpler than
for (my $i = $#xvals; $i >= 0; $i--)
which actually walks through the array in reverse order. I would
write that as:
for (my $i = @xvals; $i --;)
which looks simpler to me.
But Perl isn't forcing you to do things in a certain way. Doing it
different is ok. That's what Perl is about. If you mainly program for
yourself, and you are doing the maintenance, by all means, use whatever
your find the most comfortable.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\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: 6 Oct 1999 19:04:26 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: C style was Re: Random Numbers
Message-Id: <7tg6fq$95e$1@rguxd.viasystems.com>
Larry Rosler <lr@hpl.hp.com> wrote:
:>In article <7tdtpu$i0q$1@rguxd.viasystems.com> on 5 Oct 1999 22:23:58
:>GMT, lt lindley <ltl@rgsun5.viasystems.com> says...
:>...
:>> What's the matter with the simplicty of just using 2 arrays and
:>> sharing the index? Or is that a false simplicity?
:>If two independent arrays exist, walking the indexes is probably simpler
:>and more efficient than copying the arrays into a two-dimensional data
:>structure.
:>But if the arrays are being created, then putting them into the data
:>structure and using the array of references saves a lot of addressing
:>computation caused by the indexes, so is probably faster.
Reading the values turns out to be a wash for reasonably small
arrays. As you surmised, creating the array refs is the
differentiator, but even there the affect is not overwhelming and so
the issue goes back to one of style. Using anonymous arrays to hold
the coordinate pairs is more elegant and is easier to extend if the
program grows beyond the original problem domain.
I don't know if that necessarily means that I will abandon the
C-style for loop and parallel arrays for simple data, but it does
tend to look out of place in Perl code.
#!/usr/lib/lprgs/perl -w
use Benchmark;
sub use_2arrays {
my (@xvals, @yvals, $x, $y);
for my $i (1 .. 100) {
push @xvals, $i; push @yvals, $i;
}
for (my $i = 0; $i < @xvals; $i++) {
$x = $xvals[$i]; $y = $yvals[$i];
}
}
sub use_refs {
my (@coords, $x, $y);
for my $i (1.. 100) {
push @coords, [$i, $i];
}
foreach my $coord (@coords) {
$x = $coord->[0]; $y = $coord->[1];
}
}
my (@xvals, @yvals, $x, $y);
for my $i (1 .. 100) {
push @xvals, $i; push @yvals, $i;
}
sub read_only_arrays {
for (my $i = $#xvals; $i >=0; $i--) {
$x = $xvals[$i]; $y = $yvals[$i];
}
}
my (@coords);
for my $i (1.. 100) {
push @coords, [$i, $i];
}
sub read_only_refs {
foreach my $coord (@coords) {
$x = $coord->[0]; $y = $coord->[1];
}
}
my $count = 10240;
timethese $count => {
use_2arrays => \&use_2arrays,
use_refs => \&use_refs,
read_only_arrays => \&read_only_arrays,
read_only_refs => \&read_only_refs,
};
__END__
read_only_arrays: 20 wallclock secs (20.08 usr + 0.02 sys = 20.10 CPU)
read_only_refs: 21 wallclock secs (18.84 usr + 0.02 sys = 18.86 CPU)
use_2arrays: 48 wallclock secs (44.10 usr + 0.05 sys = 44.15 CPU)
use_refs: 73 wallclock secs (65.52 usr + 0.08 sys = 65.60 CPU)
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Wed, 06 Oct 1999 21:22:59 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Calculate tan();
Message-Id: <37FBA193.DDAB3A17@xs4all.nl>
How can I calculate tan(n) ?
I've already tried Math:Complex , but every time there were silly
numbers rolling out. Not what I've expected. I've used this code
$n = 20; # an angle
$helling = tan(20);
Results:
2.237.......
But it should results this: 0.363.....
--
Penpal International
http://ppi.searchy.net
ppi@searchy.net or debot@xs4all.nl
------------------------------
Date: 6 Oct 1999 13:39:19 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Caliing method by reference with arrow operator
Message-Id: <slrn7vn6af.23p.abigail@alexandra.delanet.com>
Igor V. Solodovnikov (siv@helpco.kiev.ua) wrote on MMCCXXVII September
MCMXCIII in <URL:news:939208052.322601@Stalker.Alfacom.net>:
``
`` Is it possible to call method if i have only a reference to it?
If you read the documentation carefully, you know you cannot have
a reference to a method. What you have is a reference to the
subroutine in appropriate class. Slight, but essential difference.
`` Do you know any workaround?
RTFM. Use a closure.
Abigail
--
perl -we 'print split /(?=(.*))/s => "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: Wed, 06 Oct 1999 16:04:33 GMT
From: djearthling@my-deja.com
Subject: Re: Calling functions between PerlScript and J*Script
Message-Id: <7tfru4$vs2$1@nnrp1.deja.com>
Hello Richard -
>
> I've had no problem of a JavaScript function calling a PerlScript
function.
> Just make the call and it works. Example:
>
> <script language=PerlScript>
> sub PerlFunc() ...
> </script>
>
> <script language=JavaScript>
> alert("PerlFunc() returns " + PerlFunc());
> </script>
>
> However calling the other direction
> is problematic. ActivePerl appears to be buggy in this area. The
> only thing I found that works, is to use the JavaScript eval function
> from PerlScript:
>
> $result = $window->eval("JSFunc()");
>
Hmmm, I didn't try that. Thanks for the hint.
> Passing data between JavaScript and PerlScript gets pretty hairy
> however. Numbers and strings work fine.
For what I'm doing , that's good enough.
> ... But JavaScript
> arrays and objects are complicated. ActivePerl appears
> to get confused when JavaScript arrays and objects are passed as
> arguments into a Perl function. However, JavaScript arrays
> and objects seem to work okay when they are placed in global
> JavaScript variables.
>
> Bottom line: JavaScript and PerlScript can be used together
> on the same page, but the interface isn't as clean as it really
> should be.
Thanks for the warning.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 6 Oct 1999 16:27:52 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Checking for processes
Message-Id: <7tfta8$qhq$1@pegasus.csx.cam.ac.uk>
In article <7tfngt$s3j$1@nnrp1.deja.com>, <mazachan@yahoo.com> wrote:
>Hi, I am fairly new to perl and I was wondering, is there a way to
>continuously check for processes that are running without making a
>system call to "ps" and just putting it into a loop? I am looking for a
>more efficient way of doing this. Thanks.
Well, this can be found by RTFM, but I'm not sure how you could have
tracked it down. Perhaps by the association process -> perlipc.
Here's a useful snippet from 'perldoc perlipc':
---------------------
Another interesting signal to send is signal number zero. This doesn't
actually affect another process, but instead checks whether it's alive
or has changed its UID.
unless (kill 0 => $kid_pid) {
warn "something wicked happened to $kid_pid";
}
---------------------
And you have to be clear what you mean by "running". That code (and
also ps) will say the process exists until not only has it terminated
but also its parent has collected its exit status, using wait() or
otherwise.
Mike Guy
------------------------------
Date: Wed, 06 Oct 1999 12:47:52 -0700
From: crism@exemplary.net (Christopher R. Maden)
Subject: Re: checking for string in multiple line scalar (part II)
Message-Id: <crism-0610991247520001@pm3b-17.meer.net>
In article <7tfjs8$5us$1@tasmania.dev.ict.nl>, "Fokko Wesselius"
<fokko.wesselius@ict.nl> wrote:
> if ($version_label =~ /(^"ICT.*)/) { print "$1\n"; }
You're only checking for '"ICT' at the beginning of the scalar, not at the
beginning of each line (this isn't sed). What you probably want to do is
split $version_label into an array, and then test each member.
-Chris
--
Christopher R. Maden, Solutions Architect
Exemplary Technologies
One Embarcardero Center, Ste. 2405
San Francisco, CA 94111
------------------------------
Date: 6 Oct 1999 13:49:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Converting 1.1.1.1 to blah.foo.com
Message-Id: <slrn7vn6sn.23p.abigail@alexandra.delanet.com>
Brian Preston (brianpp@us.ibm.com) wrote on MMCCXXVI September MCMXCIII
in <URL:news:37FA3E13.DE14458E@us.ibm.com>:
() For a web cgi logger that I'm doing for out Help Desk, I have a CGI
() script that logs some informatin. Is there a perl function that will
() convert a dotted IP address to readable one?
Uhm, looked in the manual lately?
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== 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, 06 Oct 1999 10:36:21 -0600
From: Robert Woodworth <woodwort@utmc.utc.com>
Subject: Re: converting to Linux from NT but need a hand.
Message-Id: <37FB7A85.8D454EDC@utmc.utc.com>
Kangas wrote:
>
> I have MySQL running, KMySQL running, perl running. But I want to
> install the DBD::MySQL so that I can use perl to connect to my database
> When I run through the `perl Makefile.PL` for the msq module it asks me
> for the mysql.h file location in the 'include' subdirectory of my MySQL
> installation.
>
> I have used the search too for mysql.h and *sql*h to find it but it is
> NOT on my machine. How can i get around this? Thanks.
>
> --
> Michael Kangas
> kangas@anlon.com
You cannot get around this. If it is a RedHat Linux, you need to
install the MySQL-devel-xxxx.rpm package. That is where you should find
the mysql.h file.
Woody.
------------------------------
Date: Wed, 06 Oct 1999 16:13:36 GMT
From: Lacrosse_20 <mcti@my-deja.com>
Subject: Damn Comma Delmitation
Message-Id: <7tfsf1$bb$1@nnrp1.deja.com>
I need to split a line that is comma delimited. The problem lies
in the fact that sometimes commas may be in text surrounded by quotes,
and that text should not be split up. Does anyone have any good ideas
on how to handle this? See example below:
# our input line, which is actually gotten from a comma delimited text
# file, that includes the quotes
$fooLine = "\"blah, blah\", 6, 7, 7, 7, ,5 , 3, 3";
# split $fooLine
@elements = split/,(but not between quotes!)/,$fooLine;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 06 Oct 1999 10:46:02 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Damn Comma Delmitation
Message-Id: <xkfemf8cu9h.fsf@valdemar.col.hp.com>
Lacrosse_20 <mcti@my-deja.com> writes:
> I need to split a line that is comma delimited. The problem lies
> in the fact that sometimes commas may be in text surrounded by quotes,
> and that text should not be split up. Does anyone have any good ideas
> on how to handle this?
What about the FAQ's answer was unclear? I assume you *did* consult
perlfaq4, "How can I split a [character] delimited string except when
inside [character]? (Comma-separated files)". Anything we can do to
make the standard documentation that comes with Perl more useful to
answer such Frequently Asked Questions would be appreciated, I'm sure.
-=Eric
--
"Cutting the space budget really restores my faith in humanity. It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
-- Johnny Hart
------------------------------
Date: 6 Oct 1999 17:41:43 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Damn Comma Delmitation
Message-Id: <37FB87FF.D21C3B4C@vpservices.com>
Lacrosse_20 wrote:
>
> I need to split a line that is comma delimited. The problem lies
> in the fact that sometimes commas may be in text surrounded by quotes,
> and that text should not be split up.
Any simple search of the newsgroup archives or the documentationt that
comes with Perl would turn up the section of perlfaq4 called "How can I
split a [character] delimited string except when inside [character]?
(Comma-separated files)"
And since Tom C. isn't here anymore, I will quote him on your use of the
word delimitation:
"quote-delimited"!
"hyphen-separated"!
"bang-terminated"!
--
Jeff
------------------------------
Date: Wed, 06 Oct 1999 18:33:40 GMT
From: Lacrosse_20 <mcti@my-deja.com>
Subject: Re: Damn Comma Delmitation
Message-Id: <7tg4m3$6rd$1@nnrp1.deja.com>
I found it on the perl website, you were right. That doesn't excuse
your rudeness, however.
In article <xkfemf8cu9h.fsf@valdemar.col.hp.com>,
Eric The Read <emschwar@rmi.net> wrote:
> Lacrosse_20 <mcti@my-deja.com> writes:
>
> > I need to split a line that is comma delimited. The problem lies
> > in the fact that sometimes commas may be in text surrounded by
quotes,
> > and that text should not be split up. Does anyone have any good
ideas
> > on how to handle this?
>
> What about the FAQ's answer was unclear? I assume you *did* consult
> perlfaq4, "How can I split a [character] delimited string except when
> inside [character]? (Comma-separated files)". Anything we can do to
> make the standard documentation that comes with Perl more useful to
> answer such Frequently Asked Questions would be appreciated, I'm sure.
>
> -=Eric
> --
> "Cutting the space budget really restores my faith in humanity. It
> eliminates dreams, goals, and ideals and lets us get straight to the
> business of hate, debauchery, and self-annihilation."
> -- Johnny Hart
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 6 Oct 1999 21:16:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Damn Comma Delmitation
Message-Id: <Pine.HPP.3.95a.991006211406.13052A-100000@hpplus01.cern.ch>
On Wed, 6 Oct 1999, Lacrosse_20 blurted out to someone it had not yet
named:
> I found it on the perl website, you were right. That doesn't excuse
> your rudeness, however.
The rudeness was yours. And upside-down quoting, and quoted sigs.
It all hangs together. If only.
[jeopardendectomy brings relief]
------------------------------
Date: 5 Oct 1999 21:39:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Download Perl 5
Message-Id: <7tdr7d$k5$1@gellyfish.btinternet.com>
On Tue, 5 Oct 1999 19:47:47 +0100 Paul Smith wrote:
> Hi,
> Where can I download Perl 5.001?
>
I cant imagine why but <http://oasis.leo.org>.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 6 Oct 1999 09:50:00 -0700
From: moseley@best.com (Bill Moseley)
Subject: Effective Posting (was:Regular Expressions...)
Message-Id: <MPG.12651d91e8ebf6279897de@206.184.139.132>
[ I didn't receive an answer to this question yesterday, so I'm trying
again. Any suggestions on how to be more 'effective' when posting
questions? Perhaps don't post during flame wars?? Ask questions that
are already answered in the FAQ??]
Not that this isn't in the docs...
I've got a routine that is passed a list of 'words' and then bolds the
words in a HTML document by substituting the 'word' with'<B>word</B>'.
Up until now I've used \b to find a word boundary -- I don't want to
bold words within a longer word (if my word is 'dry' I don't want to
bold the 'dry' in 'laundry').
s[\bdry\b][<b>dry</b>]g;
My question is in dealing with 8 bit characters such as:
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØŒŠÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïðñòóôõöøœšßùúûüýþÿ
How should I match a word boundary? I'm unclear if use locale will
help. Or do I need to create my own word boundary as described in
"Creating custom RE engines" in perlre?
(Truth be told, here's what defines words, if it matters)
return grep { $_ ne '' } map {
# strip chars that are ok in words, but not
# in beginning or ending
s/^[$IgnoreFirstChar]+//o;
s/[$IgnoreLastChar]+(?=\*?$)//o;
# words that end in '*' must be
# stemmed first
( m/(.+)\*$/ && $Stemming )
? (stem_words($1))[0] . '*'
: $_;
} grep {
/^[$BeginCharacters]/o && # must begin or end
/[$EndCharacters*]$/o # with these chars
}
# split on allowable chars that define a word
split /[^$WordCharacters*]/o, lc $words;
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Wed, 06 Oct 1999 17:34:14 GMT
From: jdkronicz@my-deja.com
Subject: extracting perldoc documentation
Message-Id: <7tg16l$45p$1@nnrp1.deja.com>
Hi- Is there a way to view perldoc documentation in a wordprocessor? I've
been viewing it in dos by typing perldoc ??? . This is an unconfortable way
of reading for me. I'd also like to be able to print the documentation.
Any help would be appreciated.
JDK
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 06 Oct 1999 17:51:36 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: extracting perldoc documentation
Message-Id: <I_LK3.6171$S32.15492@news.rdc1.ct.home.com>
jdkronicz@my-deja.com wrote:
> Hi- Is there a way to view perldoc documentation in a wordprocessor? I've
> been viewing it in dos by typing perldoc ??? . This is an unconfortable way
> of reading for me. I'd also like to be able to print the documentation.
If you're going to print it out then you might as well snag the .PDF off of CPAN.
$CPAN/authors/id/BMIDD/somethingorother (No, I don't recall the filename offhand)
It's also searchable from within Acrobat and, while not as nice as grepping the
pods, isn't too shabby. (I keep a copy on my laptop for reference)
Dan
------------------------------
Date: Wed, 06 Oct 1999 11:52:40 -0700
From: John Ivens <jivens@lpl.arizona.edu>
Subject: FileSelect
Message-Id: <37FB9A78.703F73A1@lpl.arizona.edu>
I would like to use FileSelect to open up a file selection window. This
is the code I am using:
my $FileWindow = new MainWindow;
my $start_dir = "/home/ops/jivens";
my $FSref = $FileWindow->Tk::FileSelect::FileSelect(-directory =>
$start_dir);
$FSref = $FileWindow->Tk::FileSelect::Show();
$FileWindow->waitWindow();
$FileWindow->bell();
Whenever I use this code I get no errors or warnings, but I get a blank
screen with no entries from the
directory. Yes, the directory does exist and it does have files in
it... Any help would be much appreciated.
The two lines
$FileWindow->waitWindow();
$FileWindow->bell();
were added later, and are not important, at least I don't think so. I
thought I might have to wait for the
directory to display before allowing access back to the main window.
That does not work either.
------------------------------
Date: Wed, 06 Oct 1999 19:36:00 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: fork & NT Perl
Message-Id: <AwNK3.223$QI5.8726@monger.newsread.com>
The Glauber (theglauber@my-deja.com) wrote:
> I'm guessing that they will create a new thread,
> duplicate the current interpreter and all its state (variables, etc,
> and start a new interpreter on a separate thread. (just a guess)
Wow.
Can't wait to see that. I bet it is going to be slow :)
Since the main application of this will be TCP/IP servers, will
sockets get spread among threads?
Scott
------------------------------
Date: Wed, 6 Oct 1999 19:54:11 +0200
From: "Laurent.Laperrousaz" <l.laperrousaz@net-clic.net>
Subject: Re: GDBM access behave differently when called from CGI
Message-Id: <7tg2ls$c9j$1@jaydee.iway.fr>
>
>Hmmm. Did you check that it wasn't something obvious?
>Like a relative-path problem?
>
>David
>--
>David Cassell, OAO cassell@mail.cor.epa.gov
>Senior computing specialist
>mathematical statistician
It seems more complicated than this:
in fact when I start with no database, I can create the first record (in the
rigth path) but all the following access fails even when reading... (I dump
the %hash value for the TIEHASH and it's empty ! then further accesses don't
work which is logical)
Then I try to access the database outside CGI via a classical perl program
and there it's working ok...
So, to resume:
- through CGI/PERL:
* I can tie to GDM when it does not exist (open for write or create) and
then add a record
* Subsequent attempts to read or write fails because tiehash returns an
empty %hash
-through BASH/PERL
*Every write, every read is ok
If you know a way to set the TIEHASH verbose maybe I can step forward !
thank you again
------------------------------
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 1002
**************************************