[27827] in Perl-Users-Digest
Perl-Users Digest, Issue: 9191 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 23 03:05:51 2006
Date: Sun, 23 Apr 2006 00:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 23 Apr 2006 Volume: 10 Number: 9191
Today's topics:
[ANNOUNCE] Emacs modules for Perl programming (Jari Aalto+mail.perl)
delete from array by reference <news3@8439.e4ward.com>
Re: delete from array by reference <1usa@llenroc.ude.invalid>
Re: delete from array by reference <rvtol+news@isolution.nl>
new CPAN modules at Sun Apr 23 2006 (Randal Schwartz)
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <rvtol+news@isolution.nl>
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <nospam-abuse@ilyaz.org>
web links <jonov@iprimus.com.au>
Re: web links <sherm@dot-app.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Apr 2006 04:22:11 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: [ANNOUNCE] Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1145766106@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: Sun, 23 Apr 2006 01:24:05 +0200
From: Michael Goerz <news3@8439.e4ward.com>
Subject: delete from array by reference
Message-Id: <4avs8kFum7haU1@uni-berlin.de>
Hi,
how can I delete from an array by reference (i.e. I already have a
pointer to the array element) instead of by index. Consider the
following code:
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $testarray = [
["bla", "bla"],
["xyz", "xyz"],
"blabla",
123 ];
print("before:\n", Dumper($testarray), "\n");
my $pointer_to_element = $testarray->[1];
undef($pointer_to_element); # no effect ...
undef(@{$pointer_to_element}); # has *some* effect,
# but only works since I know
# the element is an array
print("after undef by reference:\n", Dumper($testarray), "\n");
undef(@{$testarray}[1]); # ... but I want the same as this
print("after undef by index:\n", Dumper($testarray), "\n");
Even better would be to actually delete, not just to undef the element.
Thanks,
Michael Goerz
------------------------------
Date: Sat, 22 Apr 2006 23:45:59 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: delete from array by reference
Message-Id: <Xns97ADC9146D273asu1cornelledu@127.0.0.1>
Michael Goerz <news3@8439.e4ward.com> wrote in news:4avs8kFum7haU1@uni-
berlin.de:
> how can I delete from an array by reference (i.e. I already have a
> pointer to the array element)
There is your first mistake. There are no pointers in Perl. Attempting
to draw analogies is futile. Search Google Groups for recent discussions
on this topic in this newsgroup.
> instead of by index. Consider the following code:
>
>
> #!/usr/bin/perl -w
> use strict;
> use Data::Dumper;
>
> my $testarray = [
> ["bla", "bla"],
> ["xyz", "xyz"],
> "blabla",
> 123 ];
>
> print("before:\n", Dumper($testarray), "\n");
>
> my $pointer_to_element = $testarray->[1];
$testarray->[1] is not a pointer to anything. It is a reference to the
anonymous array containing "xyz", "xyz".
> undef($pointer_to_element); # no effect ...
> undef(@{$pointer_to_element}); # has *some* effect,
> # but only works since I know
> # the element is an array
> print("after undef by reference:\n", Dumper($testarray), "\n");
>
> undef(@{$testarray}[1]); # ... but I want the same as this
> print("after undef by index:\n", Dumper($testarray), "\n");
Honestly, I think you have not chosen the right data structure for the
real problem you are trying to solve.
You can use grep to filter out the elements you don't want.
#!/usr/bin/perl
use strict;
use warnings;
my $x = [
[ qw(abc abc) ],
[ qw(xyz xyz) ],
[ qw(edf edf) ],
];
my $e = $x->[1];
$x = [ grep { $_ != $e } @$x ];
use Data::Dumper;
print Dumper $x;
__END__
But repeatedly doing this is bound to be inefficient.
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://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sun, 23 Apr 2006 01:49:50 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: delete from array by reference
Message-Id: <e2emh4.1lc.1@news.isolution.nl>
Michael Goerz schreef:
> how can I delete from an array by reference (i.e. I already have a
> pointer to the array element) instead of by index.
Maybe this helps:
#!/usr/bin/perl
use strict;
use warnings;
my @ary = ( [ 'a', 'a' ]
, [ 'b', ' b' ]
, 'c'
, 123
);
my $eref = \$ary[1];
for (@ary) {
print $eref, "\t", \$_, "\n";
}
> Even better would be to actually delete, not just to undef the
> element.
perldoc perlop, look for slice.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sun, 23 Apr 2006 04:42:09 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules at Sun Apr 23 2006
Message-Id: <Iy5rq9.19Dx@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Catalyst-Engine-HTTP-POE-0.02
http://search.cpan.org/~agrundma/Catalyst-Engine-HTTP-POE-0.02/
Single-threaded multi-tasking Catalyst engine
----
Tk-Wizard-Bases-1.94
http://search.cpan.org/~lgoddard/Tk-Wizard-Bases-1.94/
----
Catalyst-Plugin-UploadProgress-0.02
http://search.cpan.org/~agrundma/Catalyst-Plugin-UploadProgress-0.02/
Realtime file upload information
----
Tk-Wizard-Bases-1.93
http://search.cpan.org/~lgoddard/Tk-Wizard-Bases-1.93/
----
Sys-Sig-0.02
http://search.cpan.org/~miker/Sys-Sig-0.02/
return signal constants for this host
----
Sys-Sig-0.01
http://search.cpan.org/~miker/Sys-Sig-0.01/
return signal constants for this host
----
Image-Thumbnail-0.61
http://search.cpan.org/~lgoddard/Image-Thumbnail-0.61/
simple thumbnails with GD/ImageMagick/Imager
----
Wx-0.49_04
http://search.cpan.org/~mbarbon/Wx-0.49_04/
interface to the wxWidgets cross-platform GUI toolkit
----
WWW-Patent-Page-0.04
http://search.cpan.org/~anonwb/WWW-Patent-Page-0.04/
get a patent page or document (e.g. htm, pdf, tif) from selected source (e.g. from United States Patent and Trademark Office (USPTO) website or the European Patent Office (ESPACE_EP). and place into a
----
Pod-PerlPoint-0.06
http://search.cpan.org/~jstenzel/Pod-PerlPoint-0.06/
a POD to PerlPoint converter class
----
PerlPoint-Package-0.43
http://search.cpan.org/~jstenzel/PerlPoint-Package-0.43/
----
Class-CGI-0.13
http://search.cpan.org/~ovid/Class-CGI-0.13/
Fetch objects from your CGI object
----
WWW-Search-Ebay-2.223
http://search.cpan.org/~mthurn/WWW-Search-Ebay-2.223/
backend for searching www.ebay.com
----
IO-Socket-TIPC-0.10
http://search.cpan.org/~infinoid/IO-Socket-TIPC-0.10/
TIPC sockets for Perl
----
Test-SubCalls-0.04
http://search.cpan.org/~adamk/Test-SubCalls-0.04/
Track the number of times subs are called
----
Win32-SqlServer-2.002
http://search.cpan.org/~sommar/Win32-SqlServer-2.002/
Access SQL Server from Perl via OLE DB
----
HTML-Template-Compiled-0.61
http://search.cpan.org/~tinita/HTML-Template-Compiled-0.61/
Template System Compiles HTML::Template files to Perl code
----
Config-Tiny-2.06
http://search.cpan.org/~adamk/Config-Tiny-2.06/
Read/Write .ini style files with as little code as possible
----
TVGuide-NL-0.13
http://search.cpan.org/~bas/TVGuide-NL-0.13/
fetch Dutch TV schedule from http://gids.omroep.nl/
----
Data-Visitor-0.05
http://search.cpan.org/~nuffin/Data-Visitor-0.05/
Visitor style traversal of Perl data structures
----
WWW-Search-2.488
http://search.cpan.org/~mthurn/WWW-Search-2.488/
Virtual base class for WWW searches
----
TVGuide-NL-0.12
http://search.cpan.org/~bas/TVGuide-NL-0.12/
fetch Dutch TV schedule from http://gids.omroep.nl/
----
Perl-Signature-0.08
http://search.cpan.org/~adamk/Perl-Signature-0.08/
Generate functional signatures for Perl source code
----
Perl-SAX-0.07
http://search.cpan.org/~adamk/Perl-SAX-0.07/
Generate SAX events for perl source code (incomplete)
----
Perl-MinimumVersion-0.13
http://search.cpan.org/~adamk/Perl-MinimumVersion-0.13/
Find a minimum required version of perl for Perl code
----
PPI-HTML-1.06
http://search.cpan.org/~adamk/PPI-HTML-1.06/
Generate syntax-hightlighted HTML for Perl using PPI
----
PPI-1.111
http://search.cpan.org/~adamk/PPI-1.111/
Parse, Analyze and Manipulate Perl (without perl)
----
Net-DHCP-0.65
http://search.cpan.org/~shadinger/Net-DHCP-0.65/
----
File-Find-Rule-PPI-0.03
http://search.cpan.org/~adamk/File-Find-Rule-PPI-0.03/
Add support for PPI queries to File::Find::Rule
----
WWW-Blog-Metadata-Icon-0.02
http://search.cpan.org/~btrott/WWW-Blog-Metadata-Icon-0.02/
Extract icon (FOAF photo, favicon) from weblog
----
Catalyst-Plugin-AtomServer-0.03
http://search.cpan.org/~btrott/Catalyst-Plugin-AtomServer-0.03/
Atom API server for Catalyst applications
----
String-PerlIdentifier-0.05
http://search.cpan.org/~jkeenan/String-PerlIdentifier-0.05/
Generate a random name for a Perl variable
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
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!
------------------------------
Date: Sun, 23 Apr 2006 01:32:50 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <e2eljh.1ec.1@news.isolution.nl>
Ilya Zakharevich schreef:
> Dr.Ruud:
>> When MODE is 0, ReadKey() uses getc(), and you get getc()-behaviour.
>> When MODE is '0E0', ReadKey() uses Win32PeekChar
> what happens with "special keys"-presses' (I
> mean Left, Shift-F6 etc).
They all give only 0.
Alt doesn't alter anything, both [1] and [Alt]-[1] return 49.
Using binmode seems to only make a difference for ReadMode 0..2: Enter
becomes 13+10 with binmode, 10 without.
Win32PeekChar puts only the single unsigned char keycode 'AsciiChar' in
parameter 'key' (which is a *char).
It collects more information in the private 'INPUT_RECORD record', but
that information is not used. It would be easy to make Win32PeekChar()
return more information.
######
I haven't tried a console in ANSI-mode yet. Let me try now.
Start, Run, command
(screen changes to 80x25)
C:> prompt $e[1m$p$g$e[m
(ANSI gets understood)
*C:>* perl TRK1.pl
But in here also, F1 results in a 0. This ANSI is only involved in the
output.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sun, 23 Apr 2006 02:09:26 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <e2enkm$kaq$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Dr.Ruud
<rvtol+news@isolution.nl>], who wrote in article <e2eljh.1ec.1@news.isolution.nl>:
> > what happens with "special keys"-presses' (I mean Left, Shift-F6 etc).
> They all give only 0.
> Alt doesn't alter anything, both [1] and [Alt]-[1] return 49.
What means that yours ReadKey '0 but true' workaround is not suitable
for T::R::P.
> Using binmode seems to only make a difference for ReadMode 0..2: Enter
> becomes 13+10 with binmode, 10 without.
As expected.
> Win32PeekChar puts only the single unsigned char keycode 'AsciiChar' in
> parameter 'key' (which is a *char).
This might be considered a bug in Win32PeekChar(). But until it is
fixed, one must make getc() work with \r.
Summary:
Thanks for your experiments, it is clear now how Perl 5.8.8 works on
Win with ReadMode. I expect pre-5.6.0 should work differently. I did
not get any feedback on my questions on the report on pre-5.8.8. so
the situation there is not clear yet (some of my patches made it into
5.8.8, so it has a significant chance to work better/differently than
5.8.7).
A lot of thanks,
Ilya
------------------------------
Date: Mon, 24 Apr 2006 02:54:52 +1000
From: Jon <jonov@iprimus.com.au>
Subject: web links
Message-Id: <pan.2006.04.23.16.54.51.712905@iprimus.com.au>
Hi there,
Often I am finding that I wanting to pull down parts of frequently
visited web site in an automatic manner
so that I can peruse them at my leisure and not worry about
lag/etc.. In the past I have used wget to do so but find that, at
times, there are limitations with the program. In particular resuming
wget doesn't remember where it last got up to and so it recycles
through what it has already pulled down. There are some other
annoyances as well. If someone knows of utilities better than wget
please let me know. However since I don't I'm trying to develop a perl
script that wraps around wget. My current issue is that wget only
fixes up web links when it has finished fully downloading the web
pages. Is there any perl library (or utility) that can be used to
go through and extract out all the links, see what has been downloaded
and modify the corresponding links to what they are. Thanks.
Jon.
------------------------------
Date: Sun, 23 Apr 2006 02:29:48 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: web links
Message-Id: <m2wtdgolcz.fsf@Sherm-Pendleys-Computer.local>
Jon <jonov@iprimus.com.au> writes:
> Often I am finding that I wanting to pull down parts of frequently
> visited web site in an automatic manner
Have a look at WWW::Mechanize on CPAN. <http://cpan.org>
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
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 9191
***************************************