[29608] in Perl-Users-Digest
Perl-Users Digest, Issue: 852 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 15 03:09:42 2007
Date: Sat, 15 Sep 2007 00:09:07 -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 Sat, 15 Sep 2007 Volume: 11 Number: 852
Today's topics:
Announcing WWW::Metaweb - Perl interface to the Metaweb <stainsby@gmail.com>
Re: Challenge: CPU-optimized byte-wise or-equals (for a jgraber@ti.com
Re: Challenge: CPU-optimized byte-wise or-equals (for a <zaxfuuq@invalid.net>
Re: csv, perl and German umlaute <stoupa@practisoft.cz>
Re: csv, perl and German umlaute <abadiya@googlemail.com>
Displaying utf8 text in perl -d lbova99@yahoo.com
Re: How to implement IPC with scalars? xhoster@gmail.com
HUMOR: A God's Lament <vilain@spamcop.net>
Re: Image processing in perl? <Narthring@gmail.com>
Re: Image processing in perl? <bill@ts1000.us>
Re: Image processing in perl? <jismagic@gmail.com>
Re: menu replacing <nobull67@gmail.com>
new CPAN modules on Sat Sep 15 2007 (Randal Schwartz)
Re: parallel computing in perl? <glex_no-spam@qwest-spam-no.invalid>
Re: removing rows based on two duplicate fileds <tadmc@seesig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 14 Sep 2007 07:06:05 GMT
From: Hayden Stainsby <stainsby@gmail.com>
Subject: Announcing WWW::Metaweb - Perl interface to the Metaweb API (Freebase)
Message-Id: <JoD7LI.1oqH@zorch.sf-bay.org>
If anyone hasn't seen Freebase (www.freebase.com) - go have a look if
you're interested in data, then read on - or read on if you're
impatient.
WWW::Metaweb provides nicer (and varied) ways of accessing the Metaweb
API. It aims to provide an easy to use middle layer, so you don't have
to deal with nasty things like JSON strings or HTTP requests when all
you really want to do is access all the cool data that Freebase holds
and jam it into a perl script.
Version 0.02 - with a bucket load of fixes and extra additions - is
now on CPAN at:
<http://search.cpan.org/dist/WWW-Metaweb/>
I hope that all you information boffins out there have fun.
--
Hayden
#!/usr/bin/perl
chop($_=<>);@s=split/ /;foreach$m(@s){if($m=='*'){$z=pop@t;$x=
pop@t;$a=eval"$x$m$z";push@t,$a;}else{push@t,$m;}}print"$a\n"
--
I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo
------------------------------
Date: 14 Sep 2007 10:03:04 -0500
From: jgraber@ti.com
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <yvnbqc52st3.fsf@famous02.dal.design.ti.com>
Michele Dondi <bik.mido@tiscalinet.it> writes:
> I have two very long (>64k) strings of equal lengths - $s1 and $s2.
> They are strings of bytes, meaning that any value from chr(0) to
> chr(255) is legal. $s2, however, will not have any chr(0). $s1 may or
> may not have any. What I need to do is look at each byte in $s1 and if
> it is chr(0), replace it with the corresponding byte in $s2.
Benchmark this:
(my $s1m = $s1) =~ tr/\000-\377/\377\000/;
$s1 |= ($s2 & $s1m);
--
Joel
------------------------------
Date: Fri, 14 Sep 2007 21:55:34 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <TNadnSJJsblYynbbnZ2dnUVZ_hOdnZ2d@comcast.com>
"Abigail" <abigail@abigail.be> wrote in message
news:slrnfeiad1.dh.abigail@alexandra.abigail.be...
> Goodbye.
>
> *PLONK*
Tough crowd.
--
Wade Ward
wade@zaxfuuq.net
'If they took all the "And it came to pass's" out
of the Book of Mormon, it would be a pamphlet.'
--Mark Twain
------------------------------
Date: Sat, 15 Sep 2007 01:41:10 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: csv, perl and German umlaute
Message-Id: <fcf6qq$1uer$1@ns.felk.cvut.cz>
abadiya wrote:
> Hi,
>
> I'm using Mason/Perl. At the moment I'm trying to pull data out of a
> csv-file into an html file with the help of Perl. Works fine but I
> have problems with the displayal of German umlaute. Sometimes they are
> displayed, sometimes I get questionmarks where the umlaute should be.
> Changes almost every time I refresh the page.
>
> I've got this line at the beginning of my code to force the page to
> use utf8 but it won't work.
> <%method .utf8></%method>
>
> Can you help me?
>
I don't know what charset you use in html code but for accented characters
you can use HTML entity codes. For example:
lowercase u-umlaute -> ü
uppercase U-umlaute -> Ü
lowercase e-umlaute -> ë
uppercase E-umlaute -> Ë
Take a look here
http://tlt.psu.edu/suggestions/international/web/codehtml.html
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Fri, 14 Sep 2007 22:54:00 -0700
From: abadiya <abadiya@googlemail.com>
Subject: Re: csv, perl and German umlaute
Message-Id: <1189835640.257657.198870@y42g2000hsy.googlegroups.com>
> I don't know what charset you use in html code but for accented
> characters you can use HTML entity codes.
But that would mean I have to use entities within the csv-file? If I
do that Perl stops printing after the first umlaut because of the
semicolon in the entity (e.g. ü). :(
------------------------------
Date: Fri, 14 Sep 2007 14:57:30 -0700
From: lbova99@yahoo.com
Subject: Displaying utf8 text in perl -d
Message-Id: <1189807050.617329.307160@50g2000hsm.googlegroups.com>
Please forgive the cross-post. I asked this question originally
on perl.beginners, because that's what I am. But since I haven't
had any feedback, I thought I'd ask here ...
I work with utf8 non-English text frequently, using perl 5.8.8 on
Solaris-10. I can include the following lines in my code and work
successfully ( I'm writing these from memory, so please forgive my
syntax.):
binmode STDIN, ':utf8';
binmode STDOUT, ':utf8';
binmode STDERR, ':utf8';
use utf8;
This allows my apps to work gracefully with utf8 data. However, when
I use the debugger (perl -d), I have always had some problems.
Basically, I could see the utf8 literals in my code, but anytime I "p"
or "x", the characters above the low ASCII range simply disappeared.
They were still in the variables, which I could tell by counting the
length of strings, but they vanished from the visible output.
Recently, I found a clue to this problem, and now I include the
following in my app:
binmode $DB::OUT, ':utf8';
Eureka! Now the utf8 data is visible when I "p" or "x". This is a
great improvement. However, now the utf8 literals in my code are
mangled. They display with some form of "^_" instead of displaying as
"themselves".
I am a lot better off this way than I used to be, but I'm sure there's
some more magic to be applied to this problem. As a beginner, I spend
a lot of time in the debugger, so a solution would be most helpful.
Thanks,
Lou
------------------------------
Date: 14 Sep 2007 16:52:26 GMT
From: xhoster@gmail.com
Subject: Re: How to implement IPC with scalars?
Message-Id: <20070914125228.415$9i@newsreader.com>
Eric <wolleric@gmx.de> wrote:
> Hey newsgroup,
>
> first of all, sorry for double-posting but I guess the subject of my
> last post was perhaps not hitting the spot or so... It can be found
> here:
> http://groups.google.de/group/comp.lang.perl.misc/browse_thread/thread/
> 4f c35c6fa1a8f488/37ab354f1af7b6e7?hl=de#37ab354f1af7b6e7
You said that pipes didn't work, but you didn't say what the problem
was. You posted code that doesn't run under use strict. And you framed
the whole thing in the context of some other program that I (and
presumably many other people) have never heard of and have little interest
in, rather than in terms of Perl IPC.
>
> The main problem is that while pump()ing a child's output into my $out
> scalar, new output is not fed sequentially, so I always get back the
> entire output the program gave since it started.
Yes, that is what IPC::Run does when it is used in this way. However, it
doesn't seem to care if you screw around with the scalars in the mean time,
so you could try clearing it before calling pump again:
$out='';
(This doesn't seem to be documented in IPC::Run, but I haven't studied that
whole morass carefully.)
But you if you using regex, you probably can't do this exactly, as a
message that spans the buffer would never get found, you have have to clear
only up to the full match, leaving the incomplete nascent message there.
> Any ideas? Please, I really need this stuff. I can't find any examples
> on the net apart from those in perlicp, which aren't explained in
> great detail..
We are not likely to re-write an entire perldoc section based on such
vague complaints. If you have specific questions, please ask. Perhaps
we can explain them to you, as well as improve the docs.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 14 Sep 2007 23:28:06 -0700
From: Michael Vilain <vilain@spamcop.net>
Subject: HUMOR: A God's Lament
Message-Id: <vilain-0D2D21.23280614092007@comcast.dca.giganews.com>
http://www.xkcd.com/312/
--
DeeDee, don't press that button! DeeDee! NO! Dee...
------------------------------
Date: Fri, 14 Sep 2007 09:58:46 -0700
From: Narthring <Narthring@gmail.com>
Subject: Re: Image processing in perl?
Message-Id: <1189789126.538857.19180@k79g2000hse.googlegroups.com>
On Sep 13, 10:03 pm, jis <jisma...@gmail.com> wrote:
> Hi,
>
> I want to detect or identify objects on an image.
> Does perl has any image processing related applications in use.
>
> ChEeRs,
> jis
Take a look at ImageMagick. It is a program that has a Perl
interface. You can use it to read an image into an array in Perl and
then detect or identify the objects based on pixel color.
------------------------------
Date: Fri, 14 Sep 2007 11:24:20 -0700
From: Bill H <bill@ts1000.us>
Subject: Re: Image processing in perl?
Message-Id: <1189794260.318100.314050@w3g2000hsg.googlegroups.com>
On Sep 13, 11:03 pm, jis <jisma...@gmail.com> wrote:
> Hi,
>
> I want to detect or identify objects on an image.
> Does perl has any image processing related applications in use.
>
> ChEeRs,
> jis
Image magick would allow you to convert the image to a standard format
that you could then look at with perl. Curious - what would you be
looking for in the image? shapes? colors?
Bill H
------------------------------
Date: Fri, 14 Sep 2007 23:14:56 -0000
From: jis <jismagic@gmail.com>
Subject: Re: Image processing in perl?
Message-Id: <1189811696.525980.243480@22g2000hsm.googlegroups.com>
On Sep 14, 1:24 pm, Bill H <b...@ts1000.us> wrote:
> On Sep 13, 11:03 pm, jis <jisma...@gmail.com> wrote:
>
> > Hi,
>
> > I want to detect or identify objects on an image.
> > Does perl has any image processing related applications in use.
>
> > ChEeRs,
> > jis
>
> Image magick would allow you to convert the image to a standard format
> that you could then look at with perl. Curious - what would you be
> looking for in the image? shapes? colors?
>
> Bill H
I have a defined format. I want to find out if the given format
matches the defined format. Mostly it is text. sometimes images too
come.
But I always have white background and black text on it.
Challenge is even I have to find out even printing spills.
Do you have more inputs. I am starting from zero. How about Prima? Is
that good enough for a try?
Cheers,
Jis
------------------------------
Date: Fri, 14 Sep 2007 17:08:11 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: menu replacing
Message-Id: <1189789691.604689.235880@o80g2000hse.googlegroups.com>
On Sep 14, 2:35 pm, jimmy <hugsa...@gmail.com> wrote:
> Hi all
> now this may seem trivial to many here and probably the solution is
> embedded in some question asked before but i have zero know how of
> perl (have used grep as a command and little searching and extracting)
> but i have been working on this website and use some gui based tool
> but i guess it will be really faster and efficient doing this using
> perl but have no idea.. perl in scripting
> this is what i intend to do there is a menu on about 25 lines inside
> the tags
> <div id="menu"><!--This is the navigation menu-->
> -
> -
> -
> -
> -
> -
> -
> -
>
> <!-- End Navigation--></div>
>
> only the starting and endline lines (shown here) are constant thru all
> the files in all the directories
> now i believe these can be used as regular expressing and i can do a
> search replace in all the files on all the lines inside these tags
> with new lines i have
If you are happy to simply treat the files as plain (not HTML) this is
easy. But it won't cope unless the file format is strictly controlled.
while (<>) {
if (/<!-- End Navigation-->/) {
$in_menu = 0;
print unless $in_menu;
if ( /<!--This is the navigation menu-->/ ) {
print "First new line\n";
print "Second new line\n";
$in_menu = 1;
}
Note this is deliberately very beginner-ish and/or throw-away code.
And since it's less than 10 lines and intended to be discarded after a
single use I've not even bothered with use strict!
The script as written simply prints the modified file(s) on STDOUT.
With the -i switch on Perl you could make this replace the files. Note
that there's a serious bug in my script in that if there's an unended
menu in any file this script will wipe out the rest of that file and
all remaining files it processes. But again these things don't matter
in a script you will use once and discard.
If you wanted to keep this script and use it again then there are
several things about it you'd probably want to do better.
------------------------------
Date: Sat, 15 Sep 2007 04:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Sep 15 2007
Message-Id: <JoE7qG.M79@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.
Apache2-S3-0.04
http://search.cpan.org/~iwade/Apache2-S3-0.04/
mod_perl library for proxying requests to amazon S3
----
CPAN-1.91_54
http://search.cpan.org/~andk/CPAN-1.91_54/
query, download and build perl modules from CPAN sites
----
Catalyst-Controller-Atompub-0.1.2
http://search.cpan.org/~takeru/Catalyst-Controller-Atompub-0.1.2/
A Catalyst controller for the Atom Publishing Protocol
----
Catalyst-Plugin-Authentication-Store-DBIC-0.09
http://search.cpan.org/~mramberg/Catalyst-Plugin-Authentication-Store-DBIC-0.09/
Authentication and authorization against a DBIx::Class or Class::DBI model.
----
Catalyst-Plugin-Session-State-Cookie-0.08
http://search.cpan.org/~nuffin/Catalyst-Plugin-Session-State-Cookie-0.08/
Maintain session IDs using cookies.
----
Catalyst-View-Template-Declare-0.03
http://search.cpan.org/~jrockway/Catalyst-View-Template-Declare-0.03/
Use Template::Declare with Catalyst
----
Coat-0.1
http://search.cpan.org/~sukria/Coat-0.1/
a meta class for building light objects with accessors
----
DBD-Informix-2007.0914
http://search.cpan.org/~johnl/DBD-Informix-2007.0914/
IBM Informix Database Driver for Perl DBI
----
Devel-Events-0.02
http://search.cpan.org/~nuffin/Devel-Events-0.02/
Extensible instrumentation framework.
----
Devel-Leak-Object-0.91
http://search.cpan.org/~adamk/Devel-Leak-Object-0.91/
Detect leaks of objects
----
Dicop-Workerframe-2.18
http://search.cpan.org/~bsi/Dicop-Workerframe-2.18/
----
Exporter-Tidy-0.07
http://search.cpan.org/~juerd/Exporter-Tidy-0.07/
Another way of exporting symbols
----
GD-Graph-smoothlines-1.3
http://search.cpan.org/~andrei/GD-Graph-smoothlines-1.3/
----
Geo-ShapeFile-2.52
http://search.cpan.org/~jasonk/Geo-ShapeFile-2.52/
Perl extension for handling ESRI GIS Shapefiles.
----
Getopt-Long-2.36_01
http://search.cpan.org/~jv/Getopt-Long-2.36_01/
Extended processing of command line options
----
HTML-Debug-0.10
http://search.cpan.org/~mrandall/HTML-Debug-0.10/
Enables the output of variable and query debugging information for display in HTML.
----
Math-Random-MT-Auto-6.08
http://search.cpan.org/~jdhedden/Math-Random-MT-Auto-6.08/
Auto-seeded Mersenne Twister PRNGs
----
Module-Build-Debian-1.0.0
http://search.cpan.org/~asksh/Module-Build-Debian-1.0.0/
Module::Build extension to build .deb packages using dh-make-perl.
----
Module-ThirdParty-0.24
http://search.cpan.org/~saper/Module-ThirdParty-0.24/
Provide information for 3rd party modules (outside CPAN)
----
Muldis-DB-0.3.2
http://search.cpan.org/~duncand/Muldis-DB-0.3.2/
Full-featured truly relational DBMS in Perl
----
Net-SIP-0.34
http://search.cpan.org/~sullr/Net-SIP-0.34/
Framework SIP (Voice Over IP, RFC3261)
----
Number-Ops-1.00
http://search.cpan.org/~sbeck/Number-Ops-1.00/
Simple operations on numbers.
----
Perl-Critic-Nits-v1.0.0
http://search.cpan.org/~kcowgill/Perl-Critic-Nits-v1.0.0/
policies of nits I like to pick.
----
SQL-DB-0.05
http://search.cpan.org/~mlawren/SQL-DB-0.05/
Perl interface to SQL Databases
----
SVN-Hook-0.27
http://search.cpan.org/~clkao/SVN-Hook-0.27/
Managing subversion hooks
----
Sort-DataTypes-1.00
http://search.cpan.org/~sbeck/Sort-DataTypes-1.00/
Sort a list of data using methods relevant to the type of data
----
Template-Plugin-ListOps-1.00
http://search.cpan.org/~sbeck/Template-Plugin-ListOps-1.00/
Plugin interface to list operations
----
Time-Out-0.10
http://search.cpan.org/~patl/Time-Out-0.10/
Easily timeout long running operations
----
Tripletail-0.34
http://search.cpan.org/~hio/Tripletail-0.34/
Tripletail, Framework for Japanese Web Application
----
Unicode-Japanese-0.44
http://search.cpan.org/~hio/Unicode-Japanese-0.44/
Japanese Character Encoding Handler 1
----
VCI-0.2.0_2
http://search.cpan.org/~mkanat/VCI-0.2.0_2/
A generic interface for interacting with various version-control systems.
----
Web-Scraper-0.14
http://search.cpan.org/~miyagawa/Web-Scraper-0.14/
Web Scraping Toolkit inspired by Scrapi
----
WebService-Pathtraq-API-NormalizeURL-0.01
http://search.cpan.org/~zigorou/WebService-Pathtraq-API-NormalizeURL-0.01/
Normalize URL using Pathtraq API.
----
XML-Atom-Service-0.15.2
http://search.cpan.org/~takeru/XML-Atom-Service-0.15.2/
Atom Service Document object
----
XML-Compile-0.54
http://search.cpan.org/~markov/XML-Compile-0.54/
Compilation based XML processing
----
XML-RPC-0.3
http://search.cpan.org/~daan/XML-RPC-0.3/
Pure Perl implementation for an XML-RPC client and server.
----
libwin32-0.28
http://search.cpan.org/~jdb/libwin32-0.28/
install all modules that make up the libwin32 bundle
----
pler-0.29
http://search.cpan.org/~adamk/pler-0.29/
The DWIM Perl Debugger
----
tcpforward-0.01
http://search.cpan.org/~acg/tcpforward-0.01/
forward or tunnel TCP connections
----
threads-1.66
http://search.cpan.org/~jdhedden/threads-1.66/
Perl interpreter-based threads
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.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
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: Fri, 14 Sep 2007 10:30:18 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: parallel computing in perl?
Message-Id: <46eaa90a$0$495$815e3792@news.qwest.net>
Jie wrote:
> Hi, thank you very much for the replies.
>
> I think below would be the code to do it.
> I don't know if I used the right syntax to open a temporary file...
> Also, I don't know if i need to use "$pm->wait_all_children;" as
> suggested by Peter
>
> ==========================================================
> use File::Temp
> use Parallel::ForkManager;
Really??.. that works??..
If you want to know the right syntax, or what a method does,
you may get the answer by actually reading the documentation.
perldoc File::Temp
perldoc Parallel::ForkManager
------------------------------
Date: Fri, 14 Sep 2007 23:19:55 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: removing rows based on two duplicate fileds
Message-Id: <slrnfekqhd.8ui.tadmc@tadmc30.sbcglobal.net>
Joe Smith <joe@inwap.com> wrote:
> Tad McClellan wrote:
>
>> print for @unique;
>
> Why that, instead of the simple
>
> print @unique;
No good reason in this particular case, since they all have newlines.
I originally had
print "$_\n" for @unique;
then removed print()'s argument when it came out double-spaced. :-)
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
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 V11 Issue 852
**************************************