[27438] in Perl-Users-Digest
Perl-Users Digest, Issue: 9075 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 22 03:05:43 2006
Date: Wed, 22 Mar 2006 00:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 22 Mar 2006 Volume: 10 Number: 9075
Today's topics:
[ANNOUNCE] Emacs modules for Perl programming (Jari Aalto+mail.perl)
Re: A Problem With GD <markem@airmail.net>
Re: A Problem With GD <uri@stemsystems.com>
CPAN thinks I am using an older Perl version <fredrik.jorgensen@sensewave.com>
Re: FAQ 1.12 What's the difference between "perl" and " <uri@stemsystems.com>
Getting a CPAN module to install in the location of my <Patrick_member@newsguy.com>
Re: How to release memory ? <tadmc@augustmail.com>
Re: How to release memory ? (Randal L. Schwartz)
Re: Safe Pipe Open question <1usa@llenroc.ude.invalid>
Re: Safe Pipe Open question <1usa@llenroc.ude.invalid>
Term::ReadKey not working on one linux box <martin_mohr@gmx.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Mar 2006 05:35:46 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: [ANNOUNCE] Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1143005717@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
Maintainer: Jari Aalto A T cante net
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs/XEmacs
o Unix:
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
o Unix Windows port (for Unix die-hards):
install http://www.cygwin.com/ which includes native Emacs 21.x.
and XEmacs port
o Pure Native Windows port
http://www.gnu.org/software/emacs/windows/ntemacs.html
ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe
o More Emacs resources at
http://tiny-tools.sourceforge.net/ => Emacs resource page
Emacs Perl Modules
Cperl -- Perl programming mode
http://math.berkeley.edu/~ilya/software/emacs/
by Ilya Zakharevich
CPerl is major mode for editing perl files. Also included in
latest Emacs, but newest version is at Ilya's site. Note that
the directrory at CPAN is out of date:
http://www.cpan.org/modules/by-authors/id/ILYAZ/cperl-mode/
Compared to default `perl-mode' that comes with Emacs, this
one has more features.
TinyPerl -- Perl related utilities
http://tiny-tools.sourceforge.net/
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Grep through all Perl manpages (.pod)
o Follow POD references e.g. [perlre] to next pod with RETURN
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o Update `$VERSION' variable with YYYY.MMDD on save.
o Load source code into Emacs, like Devel::DProf.pm
o Prepare script (version numbering) and Upload it to PAUSE
o Generate autoload STUBS (Devel::SelfStubber) for you
Perl Module (.pm)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in Tiny Tools Kit]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
how to set up dattabases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to to do the search, You can adjust
recursive grep options, set search case sensitivity, add user grep
options etc.
You can find latest `igrep.el' module at
<http://groups.google.com/groups?group=gnu.emacs.sources> The
maintainer is Jefin Rodgers <kevinr@ihs.com>.
TinyCompile -- To Browse grep results in Emacs *compile* buffer
TinyCompile is a minor mode for *compile* buffer from where
you can collapse unwanted lines or shorten file URLs:
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: Tue, 21 Mar 2006 22:44:30 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <1221lf2igma5qcb@corp.supernews.com>
Abigail wrote:
>
> Website? Why would you need the web to read the Perl documentation?
>
> Perl comes with its own documentation.
Ah! Found it! :-) You are absolutely correct. :-)
I look on the web because usually the documentation is kept up better on-line
than what you get with the Perl distribution. Not that the documentation is bad
that comes with Perl - just that updates are usually being done on-line faster.
So I look there first.
> Do you have a reference for this statement? Anyway, Perl is a language, and
> perl is a compiler/run-time environment.
>
> No piece of Perl is executed before it is compiled.
*nod* Basic is a language also - but it is interpreted in some instances. Last
I looked though, Perl compiled to a type of p-code which made us of the run-time
library. In order to make an actual executable (like a compiled C program) you
had to combine the run-time library, interpreter, and script. You couldn't just
compile to something like an object file, use a linker, and create a stand-alone
program. Has this changed?
>
> "" Still, would you consider: $a = &funca($a) + &funcb($a)
> "" bad if both funca and funcb modified $a?
>
> Yes, because I don't want to remember whether Perl defines an order of
> evaluation of '+', and if it does, what it is.
>
> However, AFAIK, Perl does define the order (left to right) so the value
> of $a isn't undefined. But I consider it bad style anyway.
>
>
> Abigail
I found a reference to this also in the perldocs, although in a different section.
------------------------------
Date: Tue, 21 Mar 2006 23:52:23 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: A Problem With GD
Message-Id: <x7hd5rt720.fsf@mail.sysarch.com>
>>>>> "MM" == Mark Manning <markem@airmail.net> writes:
MM> Abigail wrote:
>> Website? Why would you need the web to read the Perl documentation?
>> Perl comes with its own documentation.
MM> Ah! Found it! :-) You are absolutely correct. :-)
abigail usually is.
MM> I look on the web because usually the documentation is kept up better
MM> on-line than what you get with the Perl distribution. Not that the
MM> documentation is bad that comes with Perl - just that updates are
MM> usually being done on-line faster. So I look there first.
huh? where did you learn that misinformation? how do you compare the
online docs to the ones that come with perl and know which is more
updated? do you check the versions of the docs? do you track changes
with diff? in fact you should know that the docs that come with EACH
installation of perl are always the most up to date docs for THAT
version. the web stuff is put up later and it 100% the same content as
the docs that install with perl. this is why we always recommend using
the docs that come with perl, they are correct for that version of perl
and you always have them. hope this clears things up.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 22 Mar 2006 08:40:37 +0100
From: =?ISO-8859-1?Q?Fredrik_J=F8rgensen?= <fredrik.jorgensen@sensewave.com>
Subject: CPAN thinks I am using an older Perl version
Message-Id: <dvqv1l$pmr$2@readme.uio.no>
i use Perl version 5.8.7, but CPAN seems to think i am using 5.8.5, and
stores all new modules under 5.8.5 directories. and then my perl can't
find the modules I install.
how do I solve this problem?
best,
Fredrik (newbie)
------------------------------
Date: Tue, 21 Mar 2006 23:40:51 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <x7mzfjt7l8.fsf@mail.sysarch.com>
>>>>> "r" == robic0 <robic0> writes:
r> I just have 1 question: Will my reply be re-posted the same as your
r> periodic "automated" every 3 months or so?
of course not. you are not worthy to be in the cabal. i doubt you ever
will be worthy of even knowing about the cabal.
r> I hate you guys!
that is your problem. deal with it. see a therapist.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 21 Mar 2006 22:06:36 -0800
From: Patrick Flaherty <Patrick_member@newsguy.com>
Subject: Getting a CPAN module to install in the location of my choice.
Message-Id: <dvqphc02c1r@drn.newsguy.com>
Been using ActiveState perl for a while. And even VMS perl (the latter has been
quite handy in handling our legacy system).
With new modules always used PPM. Was aware of CPAN and had looked around
there. But, in retrospect, I guess ever module I'd actually done a ppm 'search'
and then 'install' on had been in the ActiveState repository.
Today I find a module on CPAN that I need: MQSeries-1.23. And then I find that
it's not in PPM!
Duh. Then learn a good bit about repositories in general.
Can't use PPM. Instead use:
1. perl -MCPAN -e shell then
2. cpan> make install H/HB/HBIERSMA/MQSeries-1.23.tar.gz
Didn't build at first - finally realized I needed to have the actual MQSeries
client from IBM installed. We do own this; found the kit; and installed it.
And then it built with the above cpan command (make install).
Except for one problem. It didn't put the install module into my standard perl
tree (installation). Which is c:\perl.
Instead it put it under
z:\.cpan\build
Which is where I find myself located when I open a CMD window. Looking among my
environment vars, I find both HOME and HOMEDRIVE mapped to Z:\ (and maybe
there's something more mapping to Z: that I've missed [and that the cpan install
used]).
So how do I repoint the CPAN install to C:\? Which is apparently not my default
drive, as seen from something.
pat
--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
------------------------------
Date: Tue, 21 Mar 2006 23:12:45 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to release memory ?
Message-Id: <slrne21n6d.21q.tadmc@magna.augustmail.com>
robic0 <> wrote:
> Perl is a garbage collector
No it isn't.
Perl is a reference counter.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Mar 2006 22:01:54 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to release memory ?
Message-Id: <86zmjjkofh.fsf@blue.stonehenge.com>
>>>>> "Tad" == Tad McClellan <tadmc@augustmail.com> writes:
Tad> robic0 <> wrote:
>> Perl is a garbage collector
Tad> No it isn't.
Tad> Perl is a reference counter.
*Usenet* is the garbage collector. :)
print "Just another Perl hacker,"; # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
------------------------------
Date: Wed, 22 Mar 2006 02:42:41 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Safe Pipe Open question
Message-Id: <Xns978DDCFA561ACasu1cornelledu@127.0.0.1>
Mike Paolucci <paolucci@dunsel.cuug.ab.ca> wrote in
news:Nk1Uf.11$B_1.10@edtnps89:
> I'm getting unexplained errors when I read from a log file. I'm using
> a "Safe Pipe Open", and my reference for this is:
>
> http://www.litespeed.net/perldocs/lib/Pod/perlipc.html#Using_open_for_IPC
The same documentation is also available on your hard drive:
perldoc perlipc
> my $logFile = 'full_path_to_logfile';
> my $ipAddress = '12.34.56.78';
>
> my $fh;
> open( $fh, "grep $ipAddress $logFile | tail 2>&1 |" ) or
> die "Cannot open logfile!!\n";
open my $fh, '-|', "grep $ipAddress $logFile | tail 2>&1"
or die "Cannot pipe: $!";
Always declare variables in the *smallest* applicable scope.
> # get the last lines
> my $logData = '';
> while ( <$fh> )
> {
> $logData .= $_;
> }
my $logData = do { local $/; <$fh> };
> The code works perfectly and displays no errors. The probem is that
> when I look in the system error file I see lines and lines of:
>
> grep: writing output: Broken pipe
Exactly which log file are you referring to?
I cannot replicate this on FreeBSD 5.4 and Fedora Core.
Sorry can't be of any more help.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 22 Mar 2006 02:55:39 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Safe Pipe Open question
Message-Id: <Xns978DDF2D46FC0asu1cornelledu@127.0.0.1>
On 21 Mar 2006, you wrote in comp.lang.perl.misc:
> In article <Nk1Uf.11$B_1.10@edtnps89>, Mike Paolucci
> <paolucci@dunsel.cuug.ab.ca> wrote:
...
>> my $fh;
>> open( $fh, "grep $ipAddress $logFile | tail 2>&1 |" ) or
>> die "Cannot open logfile!!\n";
...
> my $fh;
> open( $fh, '<', $logFile ) or
> die "Cannot open logfile!!\n";
>
> my $logData = '';
> my $matches = 0;
> while ( <$fh> )
> {
> if( index($_,$ipAddress) >= 0 ) {
> $logData .= $_ ;
> last if ++$matches >= 10;
> }
That does not do the same thing as the OP's code though.
The OP's code finds the last ten occurences of the IP address
in the log file whereas your code finds the first ten.
For a pure Perl solution, you can use File::ReadBackwards:
#!/usr/bin/perl
use strict;
use warnings;
use File::ReadBackwards;
my $log = q{C:/opt/Apache2/logs/recex-error.log};
my $ip = '127.0.0.1';
tie *BW, 'File::ReadBackwards', $log
or die "Cannot read '$log': $!";
my ($n, @logData);
while ( <BW> ) {
next unless /$ip/o;
unshift @logData, substr $_, 0, 80;
++$n;
last if $n == 10;
}
print join q{}, @logData;
__END__
D:\Home\asu1\UseNet\clpmisc> log
[Tue Mar 21 09:45:32 2006] [error] [client 127.0.0.1] Global symbol "$child1_inc
[Tue Mar 21 09:46:27 2006] [error] [client 127.0.0.1] Global symbol "$child1_inc
[Tue Mar 21 09:47:07 2006] [error] [client 127.0.0.1] Global symbol "%data" requ
[Tue Mar 21 09:50:24 2006] [error] [client 127.0.0.1] Global symbol "$draw1" req
[Tue Mar 21 09:59:08 2006] [error] [client 127.0.0.1] syntax error at D:/Recex/l
[Tue Mar 21 10:27:31 2006] [error] [client 127.0.0.1] File does not exist: D:/Re
[Tue Mar 21 11:15:57 2006] [error] [client 127.0.0.1] Global symbol "$treatment"
[Tue Mar 21 13:59:12 2006] [error] [client 127.0.0.1] Bareword "LOCK_EX" not all
[Tue Mar 21 14:18:48 2006] [error] [client 127.0.0.1] syntax error at D:/Recex/l
[Tue Mar 21 14:40:34 2006] [error] [client 127.0.0.1] Bareword "Tie::IxHash" not
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Tue, 21 Mar 2006 19:29:13 +0100
From: Martin Mohr <martin_mohr@gmx.de>
Subject: Term::ReadKey not working on one linux box
Message-Id: <dvpgqf$flv$1@wsc10.lrz-muenchen.de>
Hello,
I'm having a problem with Term::ReadKey, which works fine everywhere
except on one of my Linux boxes (Suse 8.2). I am aware that this is
probably a wrong setting somewhere in the OS and not a real perl
problem, but I have no idea, so I'm asking here.
###############
#!/usr/bin/perl
use strict;
use Term::ReadKey;
ReadMode('cbreak');
while (not ReadKey(-1)) {}
ReadMode('normal');
###############
For some reason, this doesn't receive any keystrokes on one of my
computers (equipped with "ReadKey.pm,v 2.23 2005/01/11 21:16:31
jonathan" as everywhere else).
Making a ssh connection from this computer to another one, and executing
the script there works. Connecting from the working machine to the
broken machine and executing the script doesn't work. On the broken
machine it works neither in kde nor the plain terminal.
Does anyone have an idea please?
Thanks a lot,
Martin
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 9075
***************************************