[28566] in Perl-Users-Digest
Perl-Users Digest, Issue: 9930 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 4 14:06:17 2006
Date: Sat, 4 Nov 2006 11:05: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 Sat, 4 Nov 2006 Volume: 10 Number: 9930
Today's topics:
Re: Data plotting questions Nov. 2, 2006 <edgrsprj@ix.netcom.com>
Re: how do i update one section of a page leaving rest? <jurgenex@hotmail.com>
Re: I sat, thought about this, and I still don't unders <cdalten@gmail.com>
Re: I sat, thought about this, and I still don't unders <hjp-usenet2@hjp.at>
multiple languages <betterdie@gmail.com>
new CPAN modules on Sat Nov 4 2006 (Randal Schwartz)
PERL for database professionals. <snojha@gmail.com>
Re: PERL for database professionals. yankeeinexile@gmail.com
Re: Sorting and Writing Effecient Code <benmorrow@tiscali.co.uk>
Re: Sorting and Writing Effecient Code <m@remove.this.part.rtij.nl>
Re: understanding an error <bik.mido@tiscalinet.it>
Re: understanding an error <bik.mido@tiscalinet.it>
Re: understanding an error anno4000@radom.zrz.tu-berlin.de
Re: understanding an error anno4000@radom.zrz.tu-berlin.de
Re: understanding an error <DJStunks@gmail.com>
Re: understanding an error <justin.0611@purestblue.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 04 Nov 2006 13:41:34 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Data plotting questions Nov. 2, 2006
Message-Id: <iM03h.2227$l25.2060@newsread4.news.pas.earthlink.net>
November 4, 2006
I have reviewed everyone's responses and am considering the various options.
Thanks for all of the suggestions.
------------------------------
Date: Sat, 04 Nov 2006 11:58:05 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: how do i update one section of a page leaving rest?
Message-Id: <hf%2h.944$C57.753@trndny05>
gavino wrote:
> vote republican.
Hmmmmmm, last time I checked my country was a republic already, no need to
vote against a Monarchy.
Of course it might be different for you if you are a victim of King George
in which case you should indeed vote in favour of restoring the republic.
jue
------------------------------
Date: 3 Nov 2006 21:11:08 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: I sat, thought about this, and I still don't understand it.
Message-Id: <1162617068.067767.119250@k70g2000cwa.googlegroups.com>
Peter J. Holzer wrote:
> On 2006-11-03 13:45, grocery_stocker <cdalten@gmail.com> wrote:
> > The following code is taken from perltooc
>
> Not quite. You made a small but crucial error in copying the code.
>
> > Subroutine Some_Class::datum redefined at ./att.pl line 33.
> >
> > I'm not too sure how the subroutine gets redefined.
>
> So you should have a closer look at that line.
>
> hp
>
Okay, I caught the error. I changed
*datum = sub {
to
*$datum = sub {
So this makes more sense. I'm dealing with a scalar and not a
subroutine. I'm still lost on how to insert data into the hash. In
main, I tried the following:
package main;
no strict "refs";
Some_Class::{$ClassData}{$CData1} = "no";
But I get:
syntax error at ./att.pl line 45, near "Some_Class::{"
Global symbol "$ClassData" requires explicit package name at ./att.pl
line 45.
Execution of ./att.pl aborted due to compilation errors.
$emacs -nw att.pl
I'm figuring the syntax is wrong. I know how to write this if this was
a scalar, but I'm lost no how to write it when this is a hash.
------------------------------
Date: Sat, 4 Nov 2006 13:31:26 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: I sat, thought about this, and I still don't understand it.
Message-Id: <slrnekp20u.bnk.hjp-usenet2@yoyo.hjp.at>
On 2006-11-04 05:11, grocery_stocker <cdalten@gmail.com> wrote:
>
> Peter J. Holzer wrote:
>> On 2006-11-03 13:45, grocery_stocker <cdalten@gmail.com> wrote:
>> > The following code is taken from perltooc
[slightly buggy code to automatically create accessor methods from a
hash]
> Okay, I caught the error. I changed
> *datum = sub {
>
> to
>
> *$datum = sub {
>
> So this makes more sense. I'm dealing with a scalar and not a
> subroutine. I'm still lost on how to insert data into the hash. In
> main, I tried the following:
> package main;
> no strict "refs";
> Some_Class::{$ClassData}{$CData1} = "no";
The assignment
*$datum = sub { ... }
installs a new function with the name $datum. So after the loop you have
two new functions CData1 and CData2, and you can simply call them:
package main;
Some_Class->CData1("test");
my $first_value = Some_Class->CData1();
print "The value in main is: $first_value \n";
will print
The value in main is: test
That's the point of the exercise: To encapsulate the hash so that it
can't be manipulated directly from the outside, only by calling the
accessor methods.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: 3 Nov 2006 20:36:09 -0800
From: "paul" <betterdie@gmail.com>
Subject: multiple languages
Message-Id: <1162614969.648288.21790@k70g2000cwa.googlegroups.com>
hello,
I would like to search for assistant regarding to building a system
will Perl to allow user to use multiple languages--Japanese, Chinese,
English.
could you pls give some suggestion?
Thank you
------------------------------
Date: Sat, 4 Nov 2006 05:42:10 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Nov 4 2006
Message-Id: <J86yIA.Lvs@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.
Acme-DonMartin-0.09
http://search.cpan.org/~dland/Acme-DonMartin-0.09/
For programs that are easy to dictate over the telephone
----
Apache-Session-DBMS-0.32
http://search.cpan.org/~areggiori/Apache-Session-DBMS-0.32/
An implementation of Apache::Session using DBMS
----
Asterisk-FastAGI-0.01
http://search.cpan.org/~jaywhy/Asterisk-FastAGI-0.01/
Module for FastAGI handling.
----
DBD-Oracle-1.19
http://search.cpan.org/~pythian/DBD-Oracle-1.19/
Oracle database driver for the DBI module
----
DBIx-Class-EncodeColumns-0.02
http://search.cpan.org/~esskar/DBIx-Class-EncodeColumns-0.02/
Handle column encodings
----
DBIx-Class-FormatColumns-0.01
http://search.cpan.org/~esskar/DBIx-Class-FormatColumns-0.01/
Creates format accessors for you
----
Data-Hierarchy-0.32
http://search.cpan.org/~clkao/Data-Hierarchy-0.32/
Handle data in a hierarchical structure
----
Data-Hierarchy-0.33
http://search.cpan.org/~clkao/Data-Hierarchy-0.33/
Handle data in a hierarchical structure
----
Data-PowerSet-0.03
http://search.cpan.org/~dland/Data-PowerSet-0.03/
Generate all subsets of a list of elements
----
ExtUtils-MY_Metafile-0.04
http://search.cpan.org/~hio/ExtUtils-MY_Metafile-0.04/
META.yml customize with ExtUtil::MakeMaker 1
----
Games-3D-0.10
http://search.cpan.org/~tels/Games-3D-0.10/
a package containing an object system for (not only) 3D games
----
Graph-Convert-0.04
http://search.cpan.org/~tels/Graph-Convert-0.04/
Convert between graph formats: Graph and Graph::Easy
----
HTML-ResolveLink-0.04
http://search.cpan.org/~miyagawa/HTML-ResolveLink-0.04/
Resolve relative links in (X)HTML into absolute URI
----
HTML-Template-Compiled-0.81
http://search.cpan.org/~tinita/HTML-Template-Compiled-0.81/
Template System Compiles HTML::Template files to Perl code
----
HTML-Template-Compiled-Plugin-HTML_Tags-0.01
http://search.cpan.org/~tinita/HTML-Template-Compiled-Plugin-HTML_Tags-0.01/
HTC-Plugin for various HTML tags
----
JSON-Shell-1.0
http://search.cpan.org/~markpasc/JSON-Shell-1.0/
an interactive shell for performing JSON and JSON-RPC requests
----
Lemonldap-NG-Handler-0.62
http://search.cpan.org/~guimard/Lemonldap-NG-Handler-0.62/
The Apache module part of Lemonldap::NG Web-SSO system.
----
Lemonldap-NG-Portal-0.41
http://search.cpan.org/~guimard/Lemonldap-NG-Portal-0.41/
The authentication portal part of Lemonldap::NG Web-SSO system.
----
Math-Symbolic-0.504
http://search.cpan.org/~smueller/Math-Symbolic-0.504/
Symbolic calculations
----
Net-Elexol-EtherIO24-0.11
http://search.cpan.org/~chrisy/Net-Elexol-EtherIO24-0.11/
Object interface for manipulating Elexol Ether I/O 24 units with Perl
----
POE-0.9500
http://search.cpan.org/~rcaputo/POE-0.9500/
portable multitasking and networking framework for Perl
----
Qpsmtpd-Plugin-Quarantine-0.32
http://search.cpan.org/~muir/Qpsmtpd-Plugin-Quarantine-0.32/
filter outbound email to prevent blacklisting
----
SQL-Translator-0.08_02
http://search.cpan.org/~jrobinson/SQL-Translator-0.08_02/
manipulate structured data definitions (SQL and more)
----
SVK-1.99_03
http://search.cpan.org/~clkao/SVK-1.99_03/
A Distributed Version Control System
----
SVN-Dump-0.02
http://search.cpan.org/~book/SVN-Dump-0.02/
A Perl interface to Subversion dumps
----
SVN-Mirror-0.72
http://search.cpan.org/~clkao/SVN-Mirror-0.72/
Mirror remote repository to local Subversion repository
----
SVN-Notify-Config-0.0903
http://search.cpan.org/~jpeacock/SVN-Notify-Config-0.0903/
Config-driven Subversion notification
----
Sledge-View-0.04
http://search.cpan.org/~tokuhirom/Sledge-View-0.04/
abstract base class for Sledge's view(EXPERIMENTAL!!)
----
Sub-ScopeFinalizer-0.02
http://search.cpan.org/~hio/Sub-ScopeFinalizer-0.02/
execute a code on exiting scope. 1
----
Template-Provider-FromDATA-0.05
http://search.cpan.org/~bricas/Template-Provider-FromDATA-0.05/
Load templates from your __DATA__ section
----
Tie-Cycle-Sinewave-0.04
http://search.cpan.org/~dland/Tie-Cycle-Sinewave-0.04/
Cycle through a series of values on a sinewave
----
Typist-0.02
http://search.cpan.org/~tima/Typist-0.02/
A template engine and framework like the ones found in Movable Type and TypePad
----
XML-DT-0.46
http://search.cpan.org/~ambs/XML-DT-0.46/
a package for down translation of XML files
----
XML-RSS-Headline-PerlMonks-0.1
http://search.cpan.org/~donshank/XML-RSS-Headline-PerlMonks-0.1/
Subclass of XML::RSS::Headline for reading RSS feed from perlmonks.org
----
XML-TreePP-0.19
http://search.cpan.org/~kawasaki/XML-TreePP-0.19/
Pure Perl implementation for parsing/writing xml files
----
threads-1.49
http://search.cpan.org/~jdhedden/threads-1.49/
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: 4 Nov 2006 05:29:31 -0800
From: "snojha@gmail.com" <snojha@gmail.com>
Subject: PERL for database professionals.
Message-Id: <1162646970.941317.265580@h54g2000cwb.googlegroups.com>
PERL scripts for database professionals. Please join our new group
dbhelpdesk. This website is specially for database professionals
managing multiple databases.
you can subscribe to this group from dbhelpdesk.com website.
www.dbhelpdesk.com
------------------------------
Date: 04 Nov 2006 10:26:51 -0600
From: yankeeinexile@gmail.com
Subject: Re: PERL for database professionals.
Message-Id: <87irhvyy7o.fsf@gmail.com>
Some idiot writes:
> PERL scripts for database professionals. Please join our new group
> {name elided}. This website is specially for database professionals
> managing multiple databases.
> you can subscribe to this group from {domain elided} website.
> {domain elided}
>
Y'all expect us to believe "scripts for database professionals" when you
can't even spell the word "Perl" right?
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
------------------------------
Date: Sat, 4 Nov 2006 00:53:35 +0000
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Sorting and Writing Effecient Code
Message-Id: <ft4t14-omq.ln1@osiris.mauzo.dyndns.org>
Quoth xhoster@gmail.com:
> wahab-mail@gmx.net wrote:
> > Thus spoke Tad McClellan (on 2006-11-03 00:21):
> >
> > >> # file stuff
> > >> foreach my $fname (@files) {
> > >> open(my $fh, "$dir$fname") or die "$fname: $!";
> > >> ...
> > >> ...
> > >> close $fh;
> > >> }
> > >>
> > >> Don't forget to close your files, otherwise
> > >> your program will fail sensational ...
> > >
> > >
> > > How will it fail?
> > > Perl closes any open filehandles when it exits anyway.
> >
> > If you have several thousand file names in @files,
> > the O.P.'s Windows OS should bark after the first
> > hundred opened - but not closed ...
>
> lexical file handles are automatically closed when they go out of
> scope.
However, if you are writing to the filehandle, you should close them
yourself *and check for an error*, as a write error (disk full, network
down, or whatever) may not be reported until the file is closed.
Ben
--
I touch the fire and it freezes me, [benmorrow@tiscali.co.uk]
I look into it and it's black.
Why can't I feel? My skin should crack and peel---
I want the fire back... Buffy, 'Once More With Feeling'
------------------------------
Date: Sat, 04 Nov 2006 18:20:06 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Sorting and Writing Effecient Code
Message-Id: <pan.2006.11.04.17.20.05.803932@remove.this.part.rtij.nl>
On Fri, 03 Nov 2006 06:08:50 +0100, Mirco Wahab wrote:
> If you have several thousand file names in @files,
> the O.P.'s Windows OS should bark after the first
> hundred opened - but not closed ...
>
> Maybe I'm wrong and it's a modern OS these days ...
Yes, you're wrong. Windows supported open files limited only by memory
when many unixes didn't.
M4
-= Not a Windows fan at all =-
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: Sat, 04 Nov 2006 00:08:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: understanding an error
Message-Id: <usink2t9h16p4iss4kt5eg0vrcnc11vbqp@4ax.com>
On Fri, 03 Nov 2006 19:43:21 +0000, Justin C
<justin.0611@purestblue.com> wrote:
>> perldoc perldata, look for the paragraph starting
>>
>> If you evaluate a hash in scalar context,
>
>Hmmm... I prefer Michele's answer!
Which somehow makes me glad, but doesn't take into account that the
docs *do* explain the whole thing much better than I ever could...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Sat, 04 Nov 2006 00:09:21 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: understanding an error
Message-Id: <avink213mmh2s9u30a6lb5lms15a25j2ba@4ax.com>
On Fri, 03 Nov 2006 20:36:07 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>> As somebody put it, "the value of a hash in scalar context is of
>> interest only to a perl programmer, not to a Perl programmer".
>
>Sometimes I do:
>
> if ( %hash ) {
> # do something...
> }
>
>and I'm certainly not a perl programmer, so "somebody" must be wrong. ;-)
Well, maybe there should be a "generally" somewhere...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 4 Nov 2006 00:48:30 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: understanding an error
Message-Id: <4r26auFp664uU1@news.dfncis.de>
Justin C <justin.0611@purestblue.com> wrote in comp.lang.perl.misc:
> In article <4r0mibFov98sU1@news.dfncis.de>,
> anno4000@radom.zrz.tu-berlin.de wrote:
>
> > perldoc perldata, look for the paragraph starting
> >
> > If you evaluate a hash in scalar context,
>
> Hmmm... I prefer Michele's answer!
Rightly so. Michele actually discusses the original article and
the questions it raises. That wasn't my intention, I answered the
explicit question "Where does this output come form" with the
appropriate doc pointer. That is more quickly done and requires
less thought, but isn't entirely without merit.
Anno
------------------------------
Date: 4 Nov 2006 00:58:39 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: understanding an error
Message-Id: <4r26tvFp5qv6U1@news.dfncis.de>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
> Michele Dondi wrote:
> > Justin C wrote:
> >>
> >>print scalar ( %hash ), "\n" ;
> > [snip]
> >>The output, when this is run, is:
> >>4/8
> >
> > As somebody put it, "the value of a hash in scalar context is of
> > interest only to a perl programmer, not to a Perl programmer".
>
> Sometimes I do:
>
> if ( %hash ) {
> # do something...
> }
>
> and I'm certainly not a perl programmer, so "somebody" must be wrong. ;-)
Ah, but it's Perl, so context matters. The scalar value only interests
perl programmers. The boolean value is routinely used by Perl
programmers. Or not, looking at Tad's contribution to this thread.
Anno
------------------------------
Date: 3 Nov 2006 17:41:34 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: understanding an error
Message-Id: <1162604494.273682.270480@h54g2000cwb.googlegroups.com>
Justin C wrote:
> I'm counting hash elements: my $n_items = scalar( keys( %hash)); now.
by the way, your scalar assignment
here ----------------------------^^^^^^^^
already imposes scalar context rendering it unneccessary to force
context manually
here --------------------------------------^^^^^^
-jp
------------------------------
Date: Sat, 04 Nov 2006 11:57:22 +0000
From: Justin C <justin.0611@purestblue.com>
Subject: Re: understanding an error
Message-Id: <justin.0611-6960D2.11571604112006@stigmata>
In article <1162604494.273682.270480@h54g2000cwb.googlegroups.com>,
"DJ Stunks" <DJStunks@gmail.com> wrote:
> Justin C wrote:
> > I'm counting hash elements: my $n_items = scalar( keys( %hash)); now.
>
> by the way, your scalar assignment
>
> here ----------------------------^^^^^^^^
>
> already imposes scalar context rendering it unneccessary to force
> context manually
>
> here --------------------------------------^^^^^^
>
> -jp
Thanks for pointing that out.
--
Justin C, by the sea.
------------------------------
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 9930
***************************************