[13715] in Perl-Users-Digest
Perl-Users Digest, Issue: 1125 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 04:05:39 1999
Date: Wed, 20 Oct 1999 01:05:11 -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: <940406711-v9-i1125@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Oct 1999 Volume: 9 Number: 1125
Today's topics:
Re: $ is sneaky, point me to a faq or help please <lr@hpl.hp.com>
(PERL/XML):Subroutine access by Reference. <sganapat@cisco.com>
Re: .htaccess <jjyooi@dcs.qmw.ac.uk>
Re: array <lr@hpl.hp.com>
Re: Baffled! <lr@hpl.hp.com>
Re: Beginner question - chomp <r42317@email.sps.mot.com>
Comments in Perl <singh_mandeep@jpmorgan.com>
Re: Comments in Perl (Abigail)
Re: Comments in Perl (Sam Holden)
Re: Comments in Perl (Alan Curry)
Re: creating a list of unique records <lr@hpl.hp.com>
Re: Do you now an affordable Perl editor for Windows NT <jjyooi@dcs.qmw.ac.uk>
Re: formatting text with filling '.'s <lr@hpl.hp.com>
Re: FTP to Server <eedjoes@eed.ericsson.se>
Re: How to write isdigit() in Perl <lr@hpl.hp.com>
Re: Importing symbols and memory usage - Apahce::Regist (Bill Moseley)
Re: Matching an asterisk (Tad McClellan)
Newbie - Help on installing perl <r42317@email.sps.mot.com>
Re: Perl certification? <mamster@mamster.net>
Re: Perl certification? (Tad McClellan)
Re: Perl certification? (Tad McClellan)
Question on comments in Perl? <singh_mandeep@jpmorgan.com>
Re: Question on comments in Perl? (Abigail)
Re: Trim text <monty@primenet.com>
Re: Trim text <umungo01@shafika.vetri.com>
Re: Uses of # (Peter J. Kernan)
Re: Writing an IMAP Client jangott5462@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Oct 1999 23:44:10 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: $ is sneaky, point me to a faq or help please
Message-Id: <MPG.12770494f697fab98a0cc@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <380CB7C2.9AB89521@americasm01.nt.com> on Tue, 19 Oct 1999
13:26:10 -0500, Marshall Culpepper <marshalc@americasm01.nt.com> says...
> Thomas B. Holdren wrote:
> > [....]
> > #pseudocode, ok? I know it's not correct!
> > $message =~ m/boundary="(.*)"/i
> > $boundary = $1;
>
> you might try and just search out the $1 (boundary) variable instead of the
> whole message...
> so something like..
>
> $boundary = ($1 =~ s/\$//g);
>
> My guess is this would just remove the MS '$' from the boundary only and not
> the entire message..
My guess is that this would just produce a run-time error message
(Modification of read-only variable attempted at ...). And even if that
part were fixed, it would then store the number of matches made during
the substitution.
But I am not really guessing, because I tried it before posting. Don't
you think that we are all entitled to the courtesy of your testing your
guesses before posting them?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 20 Oct 1999 12:29:15 +0800
From: Subalakshmi GanapathiRaman <sganapat@cisco.com>
Subject: (PERL/XML):Subroutine access by Reference.
Message-Id: <380D451B.A2947208@cisco.com>
--------------53C8B6301F431C8D4271AB7C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi everybody,
Kindly treat this as URGENT.
I would like to know the best way in which I can correctly and easily
identify a subroutine called by reference (during run time).
Do we have a perl debugger for Unix systems (Solaris) as we have
(ActivePerl debugger) for NT boxes ?
Related Problem :
Given an Input XML file, that is to be parsed and subsequently, for the
DOM (Document Object Model Tree) to be built, the 'parse'
subroutine in the 'XML::Parser.pm' package is invoked.
This 'XML::Parser' being a non-validating parser, inturn calls the
'setHandler' subroutine, in
the Validating Parser package 'XML::Parser::Expat.pm'.
In this function, another handler subroutine is called by reference. In
this case it gives the following error :
"Modification of a read-only value attempted at Expat.pm line 126"
I understand that this is the outcome of attempting to assign/write
something to a constant. But I'm
not quite sure as to how this problem originates with a valid XML input
file on Solaris, while the same
file is successfully parsed by the equivalent Expat.pm in NT.
NOTE :
I am facing this problem only while trying to parse & build the DOM
using the Expat for Solaris system.
It works fine on NT machines.
I am attaching (below) the subroutine code (for the external XML/PERL
module - Expat.pm) just for a quick look :
--------------------------------------------------------------------------------------------------------------------------
sub setHandlers {
my ($self, @handler_pairs) = @_;
croak("Uneven number of arguments to setHandlers method")
if (int(@handler_pairs) & 1);
my @ret;
while (@handler_pairs) {
my $type = shift @handler_pairs;
my $handler = shift @handler_pairs;
croak "Handler for $type not a Code ref"
unless (! defined($handler) or ! $handler or ref($handler) eq
'CODE');
my $hndl = $self->{_Setters}->{$type};
unless (defined($hndl)) {
my @types = sort keys %{$self->{_Setters}};
croak("Unknown Expat handler type: $type\n Valid types: @types");
}
my $old = &$hndl($self->{Parser}, $handler); -------------> LINE
RAISING ERROR
push (@ret, $type, $old);
}
return @ret;
}
---------------------------------------------------------------------------------------------------------------------
Thanks.
--------------53C8B6301F431C8D4271AB7C
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi everybody,
<p>Kindly treat this as URGENT.
<p>I would like to know the best way in which I can correctly and easily
identify a subroutine called by reference (during run time).
<br>Do we have a perl debugger for Unix systems (Solaris) as we have (ActivePerl
debugger) for NT boxes ?
<p><b>Related Problem :</b><b></b>
<p>Given an Input XML file, that is to be parsed and subsequently, for
the
<br><b>DOM</b> (Document Object Model Tree) to be built, the 'parse'
<br>subroutine in the '<b>XML::Parser.pm</b>' package is invoked.
<p>This 'XML::Parser' being a non-validating parser, inturn calls the 'setHandler'
subroutine, in
<br>the Validating Parser package '<b>XML::Parser::Expat.pm</b>'.
<br>In this function, another handler subroutine <i>is <u>called by reference</u></i>.
In this case it gives the following error :<b><i></i></b>
<p><b><i>"Modification of a read-only value attempted at Expat.pm line
126"</i></b>
<p>I understand that this is the outcome of attempting to assign/write
something to a constant. But I'm
<br>not quite sure as to how this problem originates with a valid XML input
file on <b>Solaris</b>, while the same
<br>file is successfully parsed by the equivalent Expat.pm in <b>NT</b>.
<br>
<br>
<p><b>NOTE :</b><b></b>
<p><b>I am facing this problem only while trying to parse & build the
DOM using the Expat for Solaris system.</b>
<br><b>It works fine on NT machines.</b>
<p><b>I am attaching (below) the subroutine code (for the external XML/PERL
module - Expat.pm) just for a quick look :</b>
<br>--------------------------------------------------------------------------------------------------------------------------
<p><i>sub setHandlers {</i>
<br><i> my ($self, @handler_pairs) = @_;</i>
<br><i> </i>
<br><i> </i>
<br><i> croak("Uneven number of arguments to setHandlers method")</i>
<br><i> if (int(@handler_pairs) & 1);</i>
<br><i> </i>
<br><i> my @ret;</i>
<br><i> </i>
<br><i> while (@handler_pairs) {</i>
<br><i> my $type = shift @handler_pairs;</i>
<br><i> my $handler = shift @handler_pairs;</i>
<br><i> croak "Handler for $type not a Code ref"</i>
<br><i> unless (! defined($handler) or !
$handler or ref($handler) eq 'CODE');</i>
<br><i> </i>
<br><i> my $hndl = $self->{_Setters}->{$type};</i>
<br><i> </i>
<br><i> unless (defined($hndl)) {</i>
<br><i> my @types = sort keys %{$self->{_Setters}};</i>
<br> <i>croak("Unknown Expat handler type: $type\n
Valid types: @types");</i>
<br><i> }</i>
<br><i> <b><u>my $old = &$hndl($self->{Parser}, $handler); </u></b>
-------------> <b>LINE RAISING ERROR</b></i>
<br><i> push (@ret, $type, $old);</i>
<br><i> }</i>
<br><i> </i>
<br><i> return @ret;</i>
<br><i>}</i>
<p>---------------------------------------------------------------------------------------------------------------------
<br>
<p>Thanks.</html>
--------------53C8B6301F431C8D4271AB7C--
------------------------------
Date: Wed, 20 Oct 1999 08:15:13 +0100
From: Johnny 'Loopy' Ooi <jjyooi@dcs.qmw.ac.uk>
Subject: Re: .htaccess
Message-Id: <380D6C01.B10B6380@dcs.qmw.ac.uk>
Eric The Read wrote:
>
> kragen@dnaco.net (Kragen Sitaker) writes:
> This is why proper indexing is important, and why people get paid
> inordinate amounts of money to create indexes for manuals-- it's a lot
> more complicated than just grepping the text for words and corresponding
> page numbers. At least, if it's done right.
>
Uhhh... Aren't we diverging off the subject a little? This thread was
about .htaccess files not about indexing manuals. ;-)
--
Johnny Ooi. Aliases: Loopy, Tuxedo Mask, Quote Master.....
E-Mail : jjyooi@dcs.qmw.ac.uk or jjyooi@yahoo.com
WWW : http://www.dcs.qmw.ac.uk/~jjyooi/
ICQ No : 6155774
"Stay sane guys!"
===============================================================
------------------------------
Date: Tue, 19 Oct 1999 23:10:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: array
Message-Id: <MPG.1276fc8642c23f2598a0ca@nntp.hpl.hp.com>
In article <QNMMOEqN11IXCNNJfXqhPaKuglul@4ax.com> on Tue, 19 Oct 1999
21:24:37 +0100, Dave Cross <dave@dave.org.uk> says...
> On Tue, 19 Oct 1999 20:07:05 GMT, Marcel Grunauer
> <marcel.grunauer@lovely.net> wrote:
> >On Tue, 19 Oct 1999 20:04:32 +0100, Dave Cross <dave@dave.org.uk>
> >wrote:
> >> On 19 Oct 1999 18:28:06 GMT, GiN@hookers.org (GiN) wrote:
> >> >I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
> >> >
> >> >what is the simpliest way to remove "wuuh" from @arr?
> >>
> >> @arr = @arr[0, 1, 3, 4];
> >
> >Tsk, tsk.
> >
> >splice @arr,2,1;
>
> tmtowtdi :-)
Yes. And in this case one of the ways is the 'best' way, and the other
ways are 'worse' and oughtn't be defended.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 19 Oct 1999 22:41:29 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Baffled!
Message-Id: <MPG.1276f55447f09fd98a0c9@nntp.hpl.hp.com>
In article <x3yn1tfbigy.fsf@tigre.matrox.com> on Tue, 19 Oct 1999
09:14:37 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
> petolino@joe.Eng.Sun.COM (Joe Petolino) writes:
>
> [please keep proper attributes of your quotes. I have no idea who you
> are quoting right now]
>
> > >A few weeks ago, I suggested that the use of a literal string as the
> > >first argument to split() should draw a warning. If that were the case
> > >(and assuming the programmer used '-w'), this incessant problem *might*
> > >go away!
It was me (er, I :-).
> Might have been a good idea in the past, by I strongly disagree right
> now. Adding this feature to '-w' will cause many already existing
> good scripts to spit a lot of unnecessary warnings.
>
> Backward compatibility has always been one of lwall's primary
> concerns.
If that were true, no new warnings could ever be added concerning
ostensibly valid code.
This issue has been responsible for many people saying that '-w'
shouldn't be used on 'already existing good scripts'. I disagree with
that. But I have no objection to testing 'already existing good
scripts' with new versions of perl to see what messages occur, and to
fix them.
The introduction into version 5.004 of the warning on
while ($line = <FILE>) { ...
is an example (admittedly a bad example, because the warning was
persnickety) of a warning created in a major new release. (And removed
in the next major release.)
Programmers who write a literal string for split() -- other than various
forms of a single space character -- are seriously deluded, and are
misleading others who may have to modify the code in the future.
Calling programs like that 'already existing good scripts' is a
considerable overstatement.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 20 Oct 1999 15:29:58 +0800
From: Noira Hadi <r42317@email.sps.mot.com>
To: Boon Hoo <theebh@magix.com.sg>
Subject: Re: Beginner question - chomp
Message-Id: <380D6F76.8FFFAEE6@email.sps.mot.com>
I had this same problem when transferring text data from DOS system to Unix.
It seems that when you transfer using binary , you'll get this kind of
problem. You can either:
1. transfer it in ascii or
2. use this to trim the ^M:
tr -d "\015" < filename1 > filename2
regards,
hadi
Boon Hoo wrote:
> Hi,
>
> I understand that chomp removes newline from the end of a string. I was
> trying it one day to format some HTML files(grab each line, remove
> newline, and write it to a text-file), when I found out that if I had
> earlier "ftp" the files using binary mode, chomp doesn't seem to work -
> i saw many ^M control characters instead in my output file. What is the
> correct way to remove newlines from textfiles transferred through binary
> mode?
>
> TIA,
> Jonathan
------------------------------
Date: Mon, 18 Oct 1999 11:36:36 -0400
From: Mandeep Singh <singh_mandeep@jpmorgan.com>
Subject: Comments in Perl
Message-Id: <380B3E83.93FFDD75@jpmorgan.com>
Is there a way to do C/C++/Java like comments?
/*
* sgsfgfdgfd
* ghjjghjghj
*/
TIA,
Mandeep
------------------------------
Date: 20 Oct 1999 01:36:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Comments in Perl
Message-Id: <slrn80qon9.fji.abigail@alexandra.delanet.com>
Mandeep Singh (singh_mandeep@jpmorgan.com) wrote on MMCCXXXIX September
MCMXCIII in <URL:news:380B3E83.93FFDD75@jpmorgan.com>:
==
== Is there a way to do C/C++/Java like comments?
==
== /*
== * sgsfgfdgfd
== * ghjjghjghj
== */
#
# sgsfgfdgfd
# ghjjghjghj
#
HTH. HAND.
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)))))))))))))))))))))))))
-----------== 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: 20 Oct 1999 07:33:58 GMT
From: sholden@staff.cs.usyd.edu.au (Sam Holden)
Subject: Re: Comments in Perl
Message-Id: <slrn80qs36.22d.sholden@staff.cs.usyd.edu.au>
On Mon, 18 Oct 1999 11:36:36 -0400,
Mandeep Singh <singh_mandeep@jpmorgan.com> wrote:
>
>Is there a way to do C/C++/Java like comments?
>
>/*
>* sgsfgfdgfd
>* ghjjghjghj
>*/
Posting twice won't make it more likely for someone to tell you the answer.
All you have to do is read the FAQ that comes with perl.
Since the Q part of the FAQ in question has the obvioud work to search for
in it, you can find it yourself.
--
Sam
I would like to tell you that Perl is simple in its complexity. But some
people won't understand that. So pretend I didn't say that, unless you
do. --Larry Wall
Sam
------------------------------
Date: Wed, 20 Oct 1999 07:48:32 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Comments in Perl
Message-Id: <kteP3.20940$E_1.1162389@typ11.nn.bcandid.com>
In article <slrn80qon9.fji.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Mandeep Singh (singh_mandeep@jpmorgan.com) wrote on MMCCXXXIX September
>MCMXCIII in <URL:news:380B3E83.93FFDD75@jpmorgan.com>:
>==
>== Is there a way to do C/C++/Java like comments?
>==
>== /*
>== * sgsfgfdgfd
>== * ghjjghjghj
>== */
>
> #
> # sgsfgfdgfd
> # ghjjghjghj
> #
my ($width, /*$depth,*/ $height);
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Tue, 19 Oct 1999 22:05:07 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: creating a list of unique records
Message-Id: <MPG.1276ed5fe8a067f698a0c8@nntp.hpl.hp.com>
In article <slrn80o6jt.e3k.abigail@alexandra.delanet.com> on 19 Oct 1999
02:15:34 -0500, Abigail <abigail@delanet.com> says...
> Michael Budash (mbudash@sonic.net) wrote on MMCCXL September MCMXCIII in
> <URL:news:mbudash-1810992224180001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>:
> "" open (LIST, "list") or die ($!);
> "" while (<LIST>) { $hash{$_} = 1; }
> "" close LIST;
> ""
> "" foreach (sort keys %hash) { print; }
>
> print grep {! $_ {$_} ++} do {local @ARGV = "list"; <>};
perlfaq4: "How can I extract just the unique elements of an array?"
...
b) If you don't know whether @in is sorted:
undef %saw;
@out = grep(!$saw{$_}++, @in);
In article <slrn80o63d.e3k.abigail@alexandra.delanet.com> on 19 Oct 1999
02:06:43 -0500, Abigail <abigail@delanet.com> says...
> Steve Kirby (poser@syspac.com) wrote on MMCCXL September MCMXCIII in
> <URL:news:380BDDB6.F7C59A69@syspac.com>:
> `` I'm looking for the most efficient way to go through a sorted list and
> `` print only one case of each unique record to a file.
>
> foreach my $froebel (@sortedlist) {
> $froebel =~ s/([^Would you think this a faq?])
Nothing if not consistent! :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 20 Oct 1999 08:13:51 +0100
From: Johnny 'Loopy' Ooi <jjyooi@dcs.qmw.ac.uk>
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <380D6BAF.B5AB81AA@dcs.qmw.ac.uk>
What's wrong with Notepad? ;-)
--
Johnny Ooi. Aliases: Loopy, Tuxedo Mask, Quote Master.....
E-Mail : jjyooi@dcs.qmw.ac.uk or jjyooi@yahoo.com
WWW : http://www.dcs.qmw.ac.uk/~jjyooi/
ICQ No : 6155774
"Stay sane guys!"
===============================================================
------------------------------
Date: Tue, 19 Oct 1999 23:31:31 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: formatting text with filling '.'s
Message-Id: <MPG.1277019bafb8a2d998a0cb@nntp.hpl.hp.com>
In article <ar1iu7.loc.ln@magna.metronet.com> on Tue, 19 Oct 1999
11:13:46 -0400, Tad McClellan <tadmc@metronet.com> says...
...
> sprintf() and tr/// can do it without explicitly counting characters:
>
> ------------------------
> #!/usr/bin/perl -w
> use strict;
>
> my %h = qw( Eggs $2.00
> Bacon $3.00
> Milk $4.00 );
>
> foreach my $key (sort keys %h) {
> my $str = sprintf "%-8s %s\n", $key, $h{$key};
> $str =~ tr/ /./;
> print $str;
> }
That format seems needlessly restrictive. The following works with
longer keys also:
my $str = sprintf "%-18s%s\n", $key, $h{$key};
...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 20 Oct 1999 09:01:51 +0200
From: Joern Stein <eedjoes@eed.ericsson.se>
Subject: Re: FTP to Server
Message-Id: <380D68DF.42210881@eed.ericsson.se>
Samay wrote:
> I just want to publish the Updated files at scheduled interval from my
> directory. It requires username and password. Which module should I use
> or any simple coding in few lines.
Have you tried using Net::FTP ?
--
Cheers
Joern Stein
-----------------------------t--h--e--r--e--i--s--n--o--s--p--o--o--n-
(who still wants to do the same, but via a proxy)
------------------------------
Date: Tue, 19 Oct 1999 23:54:01 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to write isdigit() in Perl
Message-Id: <MPG.127706dc253dc38198a0cd@nntp.hpl.hp.com>
In article <7uir02$17m$1@nnrp1.deja.com> on Tue, 19 Oct 1999 22:23:11
GMT, Johannes <jspangen@my-deja.com> says...
...
> $line =~ s/Page:\s(.*)\s*$/$1/;
> if ($line =~ /^\d+$/) { ... # only digits
> } else { ... # something else (american, Roman, whatever)
> }
That regex will not strip trailing spaces. Make it non-greedy (.*?) or
explicitly not spaces (\S*).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 19 Oct 1999 23:21:08 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Importing symbols and memory usage - Apahce::Registry
Message-Id: <MPG.1276ff2d880086b7989817@nntp1.ba.best.com>
lt lindley (ltl@rgsun40.viasystems.com) seems to say...
> Bill Moseley <moseley@best.com> wrote:
> :>of memory usage. Should I a) not import any symbols and just use the
> :>package name in all the calls, or b) switch over to using the Object
> :>interface (and why, if you don't mind), or c) not worry about it?
>
> I suppose you really want someone to explain why you should
> choose one of the above. You imply reducing the memory footprint
> is a consideration. You already know how to use 'top'. Try
> it each way and see. Then come back and tell us.
I was reading (sorry about the wrap)
http://perl.apache.org/guide/performance.html#CGI_pm_s_object_methods_ca
lls_vs
And they seemed concerned. I'll try to see if it makes a difference,
but as top reports 11M, it's hard to measure much difference. Not to
mention just how hard it is these days to find time to try different
options instead of just finishing one project before starting another.
> :>Another question about running under Apache::Registry. In a few
> :>programs I open STDERR to a log file. Under mod_perl do I end up
> :>capturing all the STDERR from all the scripts running under that server
> :>process?
>
> No. Your script inherits the STDERR from whichever server process
> launches that particular incarnation of your script. When you open a
> new STDERR it is only for that particular process and any children
> that your process forks (after doing the open).
Right, but does that mean other Apahce::Registry programs running in
that same child process would have their STDERR sent to my log file? Or
am I confused about this point. I thought that a server process could
be running a number of Apache::Registry programs -- each just a
different subroutine. If that's the case it would seem as if changing
STDERR could change it for all the 'programs' running in that server
child process. Just like changing $/ without local() would change $/
for the entire server process during its life.
> Beware that
> multiple simultaneous incarnations of your script can interleave
> their STDERR output into the file unless you use file locking.
I used to grab LOCK_EX on each execution of my scripts, but decided it
wasn't necessary in most cases and it just made other copies of the
script wait for no reason. I'm typically writing a single line of a
hundred or so chars to the log file. I'm guessing the OS will buffer
that much and the chance of interleaving is rare. No huge deal if it
does happen as it's only a log file. But I'd like to hear if that's
flawed thinking.
Now I open my log file with a LOCK_SH, and only LOCK_EX when I really
need exclusive acces (e.g. like updating config files). I'm unclear how
to implement the same thing under Apache::Registry. I would think it
would make sense to keep the log file open for the life of the child,
and perhaps just lock and unlock for each execution.
> :>Clueless about mod_perl:
>
> The above are not what is going to get you. The documentation that
> comes with mod_perl describes the things to watch out for. Beware
> file scoped lexicals which lead to accidental closures from
> mod_perl wrapping your entire script in a block.
Not to mention all those places I don't close files, use /o on regular
expressions, and modify @INC.
Sorry to be so vague (and verbose) in my questions -- I'm just trying to
grok some basic concepts.
Thanks again,
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Tue, 19 Oct 1999 22:12:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Matching an asterisk
Message-Id: <6f8ju7.kdd.ln@magna.metronet.com>
Adam Mendlik (mendlik@pop.dnvr.uswest.net) wrote:
: I can't seem to write the code that will match if and only
: if an asterisk appears
: as the last character in a string.
$text =~ /\*$/
or even
substr($text, -1) eq '*'
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Oct 1999 14:25:06 +0800
From: Noira Hadi <r42317@email.sps.mot.com>
Subject: Newbie - Help on installing perl
Message-Id: <380D6041.2A03FD47@email.sps.mot.com>
I am installing perl on a Sun machine running Solaris 2.6. I encountered
error message below. Need to know where I can get the C compiler? And do
I have to re-install the perl again?
Use which C compiler? [cc]
Checking for GNU cc in disguise and/or its version number...
*** WHOA THERE!!! ***
Your C compiler "cc" doesn't seem to be working!
You'd better start hunting for one and let me know about it.
regards,
hadi
------------------------------
Date: Tue, 19 Oct 1999 23:48:07 -0700
From: Matthew Amster-Burton <mamster@mamster.net>
Subject: Re: Perl certification?
Message-Id: <380D65A7.AFA16D8E@mamster.net>
Larry Rosler wrote:
> The certificate I really value cost me $3.00 at the Perl Conference 2.0:
>
> Certifiable Perl Pornographer
Hey, I'm a Certified Perl Monkey! Wait, maybe I said that a little too
enthusiastically....
Matthew
------------------------------
Date: Tue, 19 Oct 1999 21:28:37 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl certification?
Message-Id: <5s5ju7.kdd.ln@magna.metronet.com>
Matthew Bafford (*@dragons.duesouth.net) wrote:
: 'Perl certification' posted by Martien Verbruggen on Wednesday, October
: 20th, @00:19:57 from the 'but-ma-it-looks-nice' dept:
: : b) When was the last time you used a Schwartzian transform (modified or
: : not)?
: This message is posted with A ST.
Oh Yeah?
Well my heartbeat is driven by a ST!
So there.
...
...
Uhhh, no.
My CPU is clocked with a ST.
Really there.
:-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Oct 1999 22:05:22 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl certification?
Message-Id: <218ju7.kdd.ln@magna.metronet.com>
Martien Verbruggen (mgjv@comdyn.com.au) wrote:
: On Tue, 19 Oct 1999 19:13:46 GMT,
: bing-du@tamu.edu <bing-du@tamu.edu> wrote:
: > Hello all...
: >
: > Is there any certification exam for Perl?
: Answer the following questions:
: 1 -
: a) Where is the perl documentation?
You don't need to know.
You can just post to Usenet and get one of those dweebs to
read it to you.
: b) Does it include frequently asked questions?
That is irrelevant, because I'm not concerned with those
questions.
I am concerned with _my_ question!
And it can't be asked frequently, 'cause my question just
now occured to me.
(my problem has never been hit by the 10s of thousands of
people who have already gone through this learning Perl
thing...
)
: 2 -
: a) Does pack/unpack scare you?
Naw.
I just copy&paste it from some code I found at a
script archive on the Web.
: b) When was the last time you used a Schwartzian transform (modified or
: not)?
My Schwartz' are fine the way they are. Why would I want
them transformed?
Anyway, may the Schwartz be with you.
: 3 -
: a) When you sleep, do you dream of regular expressions?
No, but I often dream with an irregular expression.
Does that count?
: b) When you're awake, do you dream of regular expressions?
No.
When I'm awake, I _write_ regular expressions.
: c) When you sleep, do you dream of a desirable person of the sex that
: you're most interested in?
<gulp>
Sure hope I don't talk in my sleep...
: 4 -
: a) Do you tell your collegues and boss that that Java crap is
: unstable, unreliable, hardly useful, and not nearly as crossplatform
: as the hype tells you?
Java is all web-centric, and therefore way kewl.
But it is also way hard to write a hit counter in.
So I gave up on that.
: b) Do you tell your boss and your collegues that Perl could do the
: same job 100 times faster and more reliable?
Yeah, but then somebody around here would have to learn Perl.
: i) Do you re-use your old C code by writing XS interfaces to it?
I don't have any old C code.
Do you have a URL for a script archive where I can get some?
Sounds pretty good...
: If you answered 'Duh' or 'Blue' to any of the above questions, you can
: have a perl certificate.
Aww, c'mon.
Can't you modify the requirements some?
s/'Duh' or 'Blue' to //;
Please?
: But first you must answer this:
: 5 -
: What do you think is the use of a Perl certification?
: a) It'll fit neatly with my Microsoft Access and Excel certificates
I doubt that.
Those MS certificates are pretty darn impressive looking.
Does yours have fancy script (not that kind of script) and
embossed seals and stuff?
: b) It'll impress my Boss
I fired my boss :-)
: c) It'll look nice on my resume
Of course it will. Why else would I be taking all of this time
to answer your questions?
: d) It'll impress other Perl programmers
It'll depress other Perl programmers
: If you believe that c) or d) are true, then I would think again.
Hah!
You're not going to trick me into thinking.
I just want my web page spiffied up a bit.
: I
: normally see it as a negative thing
You mean you see white text on a black background?
I think you have some kind of condition or something.
: when I read a resume
I use a bookmark when I read.
It helps when I resume reading.
: that includes
: 'certification' thingies.
Ya dope!
That's "certificates", not "thingies".
: The applicants will have to work harder to
: get the job than someone who does not have that sort of crud in
: her/his resume.
Work harder?
Me?
Yeah, sure.
: Oh, what the hell.. I'm feeling generous today. You can have one.
( pssst. Uhhh. You're supposed to collect the fee
*before* you hand them out...
)
: -----------------------------------------------------------------------
: --- Perl Certificate ---
: The unofficial Perl Certification Institute hereby declares that
: bing-du@tamu.edu <bing-du@tamu.edu>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Answered 'Duh' at least once, and 'Blue' no less than three times
: to the highly selective questions posed in the Perl Certification
: Programme.
: We hereby declare
: bing-du@tamu.edu
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: certified.
: Signed:
: ScribbleScribble
: -----------------------------------------------------------------------
Hey!
I just printed that whole thing out on my laser printer.
Just plain old black on white. No embossing. No gold foil.
No fancy writing.
I'm gonna report you to the Quality in Certifications Review Board.
Sheesh!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 18 Oct 1999 11:16:10 -0400
From: Mandeep Singh <singh_mandeep@jpmorgan.com>
Subject: Question on comments in Perl?
Message-Id: <380B39BA.1EE580A8@jpmorgan.com>
Hi All,
Is there a way to put C/C++/Java like comment to a block of code.?
/*
* abc....
* def....
*/
TIA,
Mandeep
------------------------------
Date: 20 Oct 1999 01:42:18 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Question on comments in Perl?
Message-Id: <slrn80qp1q.fji.abigail@alexandra.delanet.com>
Mandeep Singh (singh_mandeep@jpmorgan.com) wrote on MMCCXXXIX September
MCMXCIII in <URL:news:380B39BA.1EE580A8@jpmorgan.com>:
``
`` Is there a way to put C/C++/Java like comment to a block of code.?
Asking the same question twice doesn't change the answer.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== 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: 20 Oct 1999 06:48:15 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Trim text
Message-Id: <7ujojf$ser$2@nnrp02.primenet.com>
Craig Berry <cberry@cinenet.net> wrote:
> sushi38@my-deja.com wrote:
> : I do not have much experience with perl, but from what I have seem this
> : must be pretty easy to accomplish. In a text file, I would like to trim
> : n characters that come before a certain string. For example:
> :
> : 99/10/19 19:38:06 33.11N 116.51W 13.3 2.2MGN C* 6 mi. ENE of
> : 99/10/19 19:50:44 34.62N 116.25W 6.0 2.8MGN C* 34 mi. N of Joshua
> : 99/10/19 20:11:43 34.88N 116.15W 0.5 3.6ML C* 27 mi. S of Baker
> : ----------------------------------------------
> : <> Last update was on 19-OCT-1999 20:15 gmt
> :
> : I would like to extract last line before the "--------------------------
> : --------------------". Since all lines come in a fixed width, it does
> : not sound like a complicated task.
>
> Even without the fixed line width, it's pretty trivial:
>
> #!/usr/bin/perl -w
> # lastdash - get the last line in a file before the first row of dashes.
> # Reads stdin or @ARGV, writes stdout.
> # Craig Berry (19991019)
>
> use strict;
>
> my $file = do { local $/; <>; };
> my $dash = '-' x 40;
> my ($last) = $file =~ m/^(.*)\n$dash/m;
>
> print "$last\n";
>
> __END__
This reduces nicely to a one-liner:
$ perl -w0777e 'print <> =~ m/^(.*\n)-+\s*$/m' data.txt
99/10/19 20:11:43 34.88N 116.15W 0.5 3.6ML C* 27 mi. S of Baker
$
(Obviously, I've altered the regular expression that means "a row
of dashes.")
If, in fact, the requirement is to print the last line before *each*
occurrence of a row of dashes, then simply add /g to the m//.
Of course, this solution sucks for any large input. The simpler,
more straightforward solutions might look like these:
my $line = '';
while (<>) {
print $line and exit if m/^-+\s*$/;
$line = $_;
}
my $line = '';
while (<>) {
print $line if m/^-+\s*$/;
$line = $_;
}
--
Jim Monty
monty@primenet.com
Tempe, Arizona USA
------------------------------
Date: Wed, 20 Oct 1999 07:45:05 GMT
From: Govindaraj <umungo01@shafika.vetri.com>
Subject: Re: Trim text
Message-Id: <s0qso1o1r0138@corp.supernews.com>
Hi,
Here is my small piece of code:
#!/usr/local/bin/perl
my $input = './input.txt';
open(INPUT,"<$input") || die "Can't open '$input'! $!\n";
while ( <INPUT> )
{
if ( $_ =~ m/^--/ )
{
$LastLine = $PrevLine;
}
$PrevLine = $_;
}
close(INPUT);
print $LastLine;
Try this piece.
Govindaraj M.
sushi38 wrote:
>
>
> I do not have much experience with perl, but from what I have seem this
> must be pretty easy to accomplish. In a text file, I would like to trim
> n characters that come before a certain string. For example:
>
> 99/10/19 19:38:06 33.11N 116.51W 13.3 2.2MGN C* 6 mi. ENE of
> 99/10/19 19:50:44 34.62N 116.25W 6.0 2.8MGN C* 34 mi. N of Joshua
> 99/10/19 20:11:43 34.88N 116.15W 0.5 3.6ML C* 27 mi. S of Baker
> ----------------------------------------------
> <> Last update was on 19-OCT-1999 20:15 gmt
>
> I would like to extract last line before the "--------------------------
> --------------------". Since all lines come in a fixed width, it does
> not sound like a complicated task.
>
> Thanks in advance,
> Eddie.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: 20 Oct 1999 03:37:16 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Uses of #
Message-Id: <slrn80qe7c.h9e.pete@theory2.phys.cwru.edu>
On Tue, 19 Oct 1999 04:46:40 GMT,
Craig Berry <cberry@cinenet.net> wrote:
.= Five brief syllables
.= Or seven; Perl wizards
.= Miscount either way.
print " This
is Perlku.
";
--
Pete
------------------------------
Date: Wed, 20 Oct 1999 06:17:10 GMT
From: jangott5462@my-deja.com
Subject: Re: Writing an IMAP Client
Message-Id: <7ujmov$jg6$1@nnrp1.deja.com>
Hi 'gain,
I didn't find much for IMAP perl, but I did find out that Sun has a
javaMail API that might be useful. Assuming that you have access to
server side java. If I can get jserv running on Apache, I might go in
that direction.
You may be able to run it on your server as well.
Anyway, I'm not much of a coder, but I do know a bit. Perhaps we could
get something going. I can't believe that there was so little on the
net about this. Ther must be other people out there that want/need
this. I just find POP3 a bit old school. I'm a bit spoiled by
Outlook.
In article <7u7mba$qdt$1@nnrp1.deja.com>,
howitgolook <howitgolook@my-deja.com> wrote:
> Hi all,
>
> I wish to write an IMAP (Webmail) client a-la-Hotmail, using Perl.
> I will be communicating with a Cyrus IMAP server.
> Is there anywhere I can get perl code to get me started?
> What modules will I need?
> Any advice for this sort of project?
>
> TIA,
> how.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 1125
**************************************