[30767] in Perl-Users-Digest
Perl-Users Digest, Issue: 2012 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 28 11:09:46 2008
Date: Fri, 28 Nov 2008 08:09:08 -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 Fri, 28 Nov 2008 Volume: 11 Number: 2012
Today's topics:
Re: Help: Count special words <jurgenex@hotmail.com>
Re: Help: Count special words <xueweizhong@gmail.com>
How to unpack 2-bytes float zhou@nrcan.gc.ca
Re: How to use special variable in regex? <rvtol+news@isolution.nl>
Re: How to use special variable in regex? <hjp-usenet2@hjp.at>
Locales on Win32, with numbers damjensen@gmail.com
Re: my variable is recognized in following sub <klaus03@gmail.com>
Re: my variable is recognized in following sub <uri@stemsystems.com>
Re: negate a match in regex <shay.rozen@gmail.com>
new CPAN modules on Fri Nov 28 2008 (Randal Schwartz)
Re: what's so difficult about namespace? jon.harrop.ms.sharp@gmail.com
Re: what's so difficult about namespace? <noone@lewscanon.com>
Re: what's so difficult about namespace? <noone@lewscanon.com>
Re: what's so difficult about namespace? (Robert Maas, http://tinyurl.com/uh3t)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Nov 2008 08:04:46 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Help: Count special words
Message-Id: <82hti4plk5a305di3k1l6pls47peimj4r7@4ax.com>
Todd <xueweizhong@gmail.com> wrote:
>To make question less boring and pure and to be interested, I'll
>present a new question as:
>
> give 2 strings, how to judge whether they have common
> character?
>
> or the next question, give 3/4/... strings, what to do?
Yawwwwnnnnn
split() the strings into individual characters, then see "perldoc -q
intersection".
jue
------------------------------
Date: Thu, 27 Nov 2008 18:00:17 -0800 (PST)
From: Todd <xueweizhong@gmail.com>
Subject: Re: Help: Count special words
Message-Id: <b492c301-2157-4b77-962c-3d405a621cae@k1g2000prb.googlegroups.com>
> split() the strings into individual characters, then see "perldoc -q
> intersection".
>
I know it will work, but it'll be very very slow, it seems that we
need to wrap a c code using XSUB.
-Todd
------------------------------
Date: Thu, 27 Nov 2008 07:40:31 -0800 (PST)
From: zhou@nrcan.gc.ca
Subject: How to unpack 2-bytes float
Message-Id: <7b800a60-35cb-47fe-aa0f-16ba18602ec3@c1g2000yqg.googlegroups.com>
Hello,
How to unpack a float with only 2-bytes (the original data file
contains a series of 2-bytes float)?
unpack with template 'f' doesn't work as it requires 4 bytes.
thanks,
F. Z.
------------------------------
Date: Thu, 27 Nov 2008 22:41:49 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How to use special variable in regex?
Message-Id: <ggn7sv.f0.1@news.isolution.nl>
Peng Yu schreef:
> my @subset = grep(/^$_.+$/, @strings);
Since you are not capturing, /^$_./ should do.
Or use length()>1 and index()==0.
Or "substr($string, 0, 1) eq $_" in stead of index()==0.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Fri, 28 Nov 2008 17:02:58 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: How to use special variable in regex?
Message-Id: <slrngj05hj.m5f.hjp-usenet2@hrunkner.hjp.at>
On 2008-11-27 06:53, John W. Krahn <someone@example.com> wrote:
> That is short for:
>
> my @subset = grep( $_ =~ /^$_.+$/, @strings );
>
> So you are trying to match the current element of @strings against the
> current element of @strings plus one character. And since the current
> element of @strings cannot have more characters than the current element
> of @strings it will never match.
my @strings = ('a*');
my @subset = grep( $_ =~ /^$_.+$/, @strings );
foreach (@subset) {
print "$_\n";
}
SCNR,
hp
------------------------------
Date: Fri, 28 Nov 2008 05:37:54 -0800 (PST)
From: damjensen@gmail.com
Subject: Locales on Win32, with numbers
Message-Id: <c093587e-5695-4a3a-ad73-c1a707561813@k36g2000yqe.googlegroups.com>
I have some questions about Locales on Win32 (Perl 5.10.0, Activeperl)
I needed to process Excel sheets with numbers, formattet with comma as
decimal point.
In my programming I found this peculiar difference:
Danish POSIX local, which fails (drops decimal value):
use strict;
use locale;
use POSIX;
POSIX::setlocale( &POSIX::LC_ALL, "da" );
my $number1 = "-123,44";
my $number2 = 10;
my $result = $number1 / $number2;
printf ('%4.4f', $result);
printf ('%4.4f', $number1 * -1);
GERMAN version which works (discovered by mistake):
use strict;
use locale;
use POSIX;
POSIX::setlocale( &POSIX::LC_ALL, "ge" );
my $number1 = "-123,44";
my $number2 = 10;
my $result = $number1 / $number2;
printf ('%4.4f', $result);
printf ('%4.4f', $number1 * -1);
This leads me to my questions:
1) where is the use of Locale and Win32 documented ? The perllocale
mentions NOTHING of Win32, and their examples using setlocale(.. )
fails.
2) why are languages on Win32 different, and where is this
documented ? Maybe an MS thing...
3) can I import a module to make locales work as Unix, on Win32
systems.
4) can I change Danish setting to make it work with decimal numbers.
Hope some expert in Locales can help me.
------------------------------
Date: Thu, 27 Nov 2008 06:34:24 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: my variable is recognized in following sub
Message-Id: <866afe75-a5ac-4e06-9d86-bd34e864e4a4@z1g2000yqn.googlegroups.com>
On Nov 27, 1:16=A0am, Uri Guttman <u...@stemsystems.com> wrote:
> use lib 'Bar' ; # this also loads Bar.pm for you
I guess you mean "use base..." instead of "use lib..."
--
Klaus
------------------------------
Date: Thu, 27 Nov 2008 11:58:15 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: my variable is recognized in following sub
Message-Id: <x7iqq93y3c.fsf@stemsystems.com>
>>>>> "K" == Klaus <klaus03@gmail.com> writes:
K> On Nov 27, 1:16 am, Uri Guttman <u...@stemsystems.com> wrote:
>> use lib 'Bar' ; # this also loads Bar.pm for you
K> I guess you mean "use base..." instead of "use lib..."
yep!
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 27 Nov 2008 10:30:25 -0800 (PST)
From: ikeon <shay.rozen@gmail.com>
Subject: Re: negate a match in regex
Message-Id: <8a515416-17fe-4809-ac04-263a9fdbbb50@j35g2000yqh.googlegroups.com>
On Nov 27, 12:13=A0pm, "John W. Krahn" <some...@example.com> wrote:
> ikeon wrote:
>
> > I have a script that I convert xml tags to html. like "<" I convert to
> > "<" and so on.
> > after the conversion I need to capture the information inside the tag.
> > let take for example the string "<abcd>: which is equivalent to
> > "<abcd>".
> > I tried to capture the "abcd" which can be different from tag to tag
> > in the following way:
>
> > /\<\;([^\&\gt\;]*)/
>
> You probably want something like:
>
> /<(.*?)>/
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you
> can special-order certain sorts of tools at low cost and
> in short order. =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0--=
Larry Wall
The (?!string) didn't work for some reason but I have learned a lot
from "perldoc perlre" ;)
The solution was /<(.*?)>/ which is the simple one. I tried it
with only (.*) but it was "greedy".
Thanks John and Peter for your quick respone.
------------------------------
Date: Fri, 28 Nov 2008 05:42:23 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Nov 28 2008
Message-Id: <KB13un.17J5@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.
Email-Blaster-0.0001_02
http://search.cpan.org/~johnd/Email-Blaster-0.0001_02/
Scalable Mass Email System
----
Filter-BoxString-0.01
http://search.cpan.org/~dylan/Filter-BoxString-0.01/
Describe your multiline strings as text boxes.
----
Filter-BoxString-0.02
http://search.cpan.org/~dylan/Filter-BoxString-0.02/
Describe your multiline strings as text boxes.
----
List-Util-Superpositions-1.2
http://search.cpan.org/~rsod/List-Util-Superpositions-1.2/
Provides 'any' and 'all' for lists
----
Log-Handler-0.50
http://search.cpan.org/~bloonix/Log-Handler-0.50/
Log messages to several outputs.
----
Mail-SPF-Iterator-1.02
http://search.cpan.org/~sullr/Mail-SPF-Iterator-1.02/
iterative SPF lookup
----
Method-Cached-0.04
http://search.cpan.org/~boxphere/Method-Cached-0.04/
The return value of the method is cached to your storage
----
MultiThread-0.8
http://search.cpan.org/~dspadea/MultiThread-0.8/
----
OpenResty-0.5.2
http://search.cpan.org/~agent/OpenResty-0.5.2/
General-purpose web service platform for web applications
----
PICA-Record-0.391
http://search.cpan.org/~voj/PICA-Record-0.391/
Perl extension for handling PICA+ records
----
POE-Component-Daemon-0.1007
http://search.cpan.org/~gwyn/POE-Component-Daemon-0.1007/
Handles all the housework for a daemon.
----
Padre-Plugin-PerlTidy-0.02
http://search.cpan.org/~bricas/Padre-Plugin-PerlTidy-0.02/
Format perl files using Perl::Tidy
----
Parse-Eyapp-1.132
http://search.cpan.org/~casiano/Parse-Eyapp-1.132/
Extensions for Parse::Yapp
----
Parse-Gnaw-0.28
http://search.cpan.org/~gslondon/Parse-Gnaw-0.28/
An extensible parser, define grammars using subroutine calls, define your own grammar extensions by defining new subroutines, parse text in memory or from/to files or other streams.
----
SeeAlso-Server-0.52
http://search.cpan.org/~voj/SeeAlso-Server-0.52/
SeeAlso Linkserver Protocol Server
----
TAP-Harness-JUnit-0.25
http://search.cpan.org/~lkundrak/TAP-Harness-JUnit-0.25/
Generate JUnit compatible output from TAP results
----
Test-Most-0.20_02
http://search.cpan.org/~ovid/Test-Most-0.20_02/
Most commonly needed test functions and features.
----
TestGen4Web-Runner-0.11
http://search.cpan.org/~mackers/TestGen4Web-Runner-0.11/
A PERL module to replay files recorded with TestGen4Web
----
WWW-Rediff-iShare
http://search.cpan.org/~shardiwal/WWW-Rediff-iShare/
get ishare.rediff.com audio and video stream URLs and download file
----
WWW-Search-MSN-0.0105
http://search.cpan.org/~shlomif/WWW-Search-MSN-0.0105/
backend for searching search.msn.com
----
XML-RSS-1.38
http://search.cpan.org/~shlomif/XML-RSS-1.38/
creates and updates RSS files
----
XML-SemanticCompare-0.91
http://search.cpan.org/~ekawas/XML-SemanticCompare-0.91/
compare 2 XML trees semantically
----
Xacobeo-0.04_01
http://search.cpan.org/~potyl/Xacobeo-0.04_01/
XPath (XML Path Language) visualizer.
----
o2sms-3.32
http://search.cpan.org/~mackers/o2sms-3.32/
A module to send SMS messages using the website of O2 Ireland
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/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Thu, 27 Nov 2008 06:59:16 -0800 (PST)
From: jon.harrop.ms.sharp@gmail.com
Subject: Re: what's so difficult about namespace?
Message-Id: <b6680373-b548-43b1-b3f9-25224441376d@x8g2000yqk.googlegroups.com>
On Nov 26, 7:29=A0am, Xah Lee <xah...@gmail.com> wrote:
> ...
It's mostly a problem of culture.
If you look, for example, at chinese names, the name space is not that
much important:
"Xee Laa" only takes this space:
" "
^^^^^^^
Instead, if you take a typical english name, say, "Abraham Lincoln",
you instantly recognize the waste of space used by this name:
" "
^^^^^^^^^^^^^^
Concluding: I think that americans are very good at wasting name
spaces, whereas chinese ones seem less name space hungry.
Sure, you could make some other example, proving for the contrary, but
I think the one cited above already suffices.
Peace.
------------------------------
Date: Thu, 27 Nov 2008 10:21:00 -0500
From: Lew <noone@lewscanon.com>
Subject: Re: what's so difficult about namespace?
Message-Id: <ggmdss$rg6$2@aioe.org>
Xah Lee wrote:
> this one is published a decade ago by a lisp [sic] dignitary.
> Its theory of programing [sic] and software engineering is poetry and
> taoism [sic].
> It suggests that C will be the last lang.
In a paroxysm of precognitive genius, seemingly.
--
Lew
------------------------------
Date: Thu, 27 Nov 2008 10:25:14 -0500
From: Lew <noone@lewscanon.com>
Subject: Re: what's so difficult about namespace?
Message-Id: <ggme4r$tlg$1@aioe.org>
jon.harrop.ms.sharp@gmail.com wrote:
> It's mostly a problem of culture.
>
> If you look, for example, at chinese [sic] names, the name space is not that
> much important:
> "Xee Laa" only takes this space:
> " "
> ^^^^^^^
Chinese names are presumably not spelled with Roman letters in Chinese, so
this really says nothing about how Chinese "wastes" space.
> Instead, if you take a typical english [sic] name, say, "Abraham Lincoln",
> you instantly recognize the waste of space used by this name:
> " "
> ^^^^^^^^^^^^^^
How is that wasted? "Abraham Lincoln" is a longer name. Only one character
is silent. In the transliteration you show for a Chinese name, two characters
are wasted.
> Concluding: I think that americans [sic] are very good at wasting name
> spaces, whereas chinese [sic] ones seem less name space hungry.
>
> Sure, you could make some other example, proving for the contrary, but
> I think the one cited above already suffices.
Your example shows the opposite of what you claim. By your own example, the
Chinese transliteration "wasted" twice as much space as the American one.
--
Lew
------------------------------
Date: Fri, 28 Nov 2008 00:33:11 -0800
From: seeWebInstead@teh.intarweb.org (Robert Maas, http://tinyurl.com/uh3t)
Subject: Re: what's so difficult about namespace?
Message-Id: <REM-2008nov28-001@Yahoo.Com>
> From: Kaz Kylheku <kkylh...@gmail.com>
> Scheme hasn't officially supported breaking a program into
> multiple files until R6RS. If the language is defined in terms of
> one translation unit, it doesn't make sense to have a namespace
> feature.
Good point. Note that any language that uses optionally-loadable
"libraries" automatically has more than one translation unit,
namely the application itself and at least one loaded library. More
on this later.
> Javascript programs are scanned at the character level by the
> browser as part of loading a page. So there are severe practical
> limitations on how large Javascript programs can be.
That's only half the reason. The other half is that JavaScript
doesn't support requiring additional libraries to be downloaded
from another site to be added to the main JavaScript application,
right?
> Namespaces are useful only in very large programs.
Or in medium sized programs that require loading libraries written
by other people, of the total set of all such libraries is too
large to globally manage well enough to avoid name clashes. The
main program might not use namespaces internally, but the various
libraries *must* use namespaces internally, and then the main
program must arrange for external functions to be propertly called
with namespace+localname.
> The essence of a true namespace or package system or whatever is
> that you can establish situations in which you use the unqualified
> names.
Correct.
> You can emulate namespaces by adding prefixes to identifiers,
> which is how people get by in C.
With the pain that you must always use the fully-qualified name, right?
> In C, you can even get the functionality of short names using the
> preprocessor.
I hear Greenspun there! :-)
> I have done this before (but only once). ...
(Story of a Greenspun task. Yes, I agree what you did, after the
fact, to avoid needing to manually edit all the files in your
source to have fully-qualified names when porting for others to
use, was a reasonable hack.)
> I recently read about a very useful theory which explains why
> technologies succeed or fail.
> See: http://arcfn.com/2008/07/why-your-favorite-programming-language-is-unpopular.html
404 not found.
Otherwise this thread, and your article in it, are interesting and
enlightening. BTW comp.lang.lisp is my favorite newsgroup for
articles that give new insight I overlooked before. KentP and
PascalB have the largest amount of good insight, but other posters
contribute too. Thanks for posting Kaz et al. (I hope once in a
while something I post provides enlightening insight to somebody.)
------------------------------
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 2012
***************************************