[29180] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 424 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 11 03:10:05 2007

Date: Fri, 11 May 2007 00:09:06 -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           Fri, 11 May 2007     Volume: 11 Number: 424

Today's topics:
    Re: Any way to access global variable in Perl script fr <Michael.Yxf@gmail.com>
    Re: Any way to access global variable in Perl script fr <nobull67@gmail.com>
    Re: Can't spawn "cmd.exe" error while using system <nospam@somewhere.com>
    Re: Correlating Data from same .csv, line by line shadkeene@hotmail.com
    Re: Data structure problem to solve Linux memory fault xhoster@gmail.com
    Re: Data structure problem to solve Linux memory fault <rvtol+news@isolution.nl>
    Re: How do I create a new text file with utf-8 encoding <jurgenex@hotmail.com>
    Re: How to change the comparsion criteria of diff? <Michael.Yxf@gmail.com>
        How to concatenate cookies dr_phill123@yahoo.com
    Re: How to concatenate cookies <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: How to concatenate cookies dr_phill123@yahoo.com
        makefile shows wrong perl version <kari.bellew@rmhp.org>
    Re: makefile shows wrong perl version <mritty@gmail.com>
    Re: makefile shows wrong perl version <mritty@gmail.com>
        new CPAN modules on Fri May 11 2007 (Randal Schwartz)
    Re: perl out of memory xhoster@gmail.com
        Problems setting value in MLDBM created database <ecarlson@vmware.com>
    Re: Problems setting value in MLDBM created database xhoster@gmail.com
    Re: Problems setting value in MLDBM created database <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: Problems setting value in MLDBM created database <ecarlson@vmware.com>
    Re: Reason for specified Error Occurence <rvtol+news@isolution.nl>
    Re: warnings dilemma <socyl@987jk.com.invalid>
    Re: Website programming (search + statistics) <csoon@xilinx.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 10 May 2007 22:03:48 -0700
From: Michael Yang <Michael.Yxf@gmail.com>
Subject: Re: Any way to access global variable in Perl script from one module file?
Message-Id: <1178859827.956905.148070@l77g2000hsb.googlegroups.com>

On May 11, 1:07 am, Brian McCauley <nobul...@gmail.com> wrote:
> On May 10, 1:38 pm, Michael Yang <Michael....@gmail.com> wrote:
>
>
>
> > On May 10, 7:59 pm, Brian McCauley <nobul...@gmail.com> wrote:
> > > I suspect you have an XY problem here. Can you explain what you are
> > > trying to achieve? There is probably no reason to create a new perl
> > > instance. Unless A.pl is a test harness for C.pl then C.pl should
> > > probably just be another module.
>
> > I am designing a Test Harness for automation testing purpose.
> > The A.pl I mentioned is the entrance script of the harness, I call it
> > as main.pl here.
> > In main.pl, I need to call the invocant that is processing the jobs of
> > executing test cases, I call it Testrunner.pl here.
> > The $handler is a reference variable saved in the main.pl. I want it
> > be accessible from each case module, case1.pm, case2.pm, without
> > interference of Testrunner.pl. Because Testrunner.pl has been
> > finalized as the agent of running test jobs. I have to keep it
> > untouched.
> > What I only could do now is to modify the main.pl and case module
> > file. That's why I want to define the $handle as a global variable,
> > and want it be accessed from the module file.
>
> The way you are using the term "global variable" is not the way it is
> usually used in most languages. (You haven't been using MUMPS have
> you?) Usually a global variable is only global within a given process.
>
> > How can I call Testrunner.pl from main.pl without spawning a separate
> > child process?
>
> You could do() it. However this would possibly give odd effects if you
> try to call Testrunner.pl more than once from main.pl. I say /
> possibly/ because if Testrunner.pl has written following best
> practices then it would probably run OK (and all you'd need to do is
> suppress the subroutine redefined warning).
>
> > If it is a possibility, in this way, the solution Jens
> > gave will work by $main::handler.
>
> Actually if Testrunner.pl already "thinks" that it "owns" main:: then
> you should use another namespace.

I am thinking about using 'require' to do this:
@ARGV = ();
require 'Testrunner.pl';

In this way, the variable defined in the main script is in the same
context as the Testrunner.pl, and could be accessed from the module
file.
But I found it slows the harness greatly, the performance is lowered.
How to leaverage on this?



------------------------------

Date: 10 May 2007 23:43:05 -0700
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: Any way to access global variable in Perl script from one module file?
Message-Id: <1178865785.899194.232010@h2g2000hsg.googlegroups.com>

On 11 May, 06:03, Michael Yang <Michael....@gmail.com> wrote:
> On May 11, 1:07 am, Brian McCauley <nobul...@gmail.com> wrote:
> > On May 10, 1:38 pm, Michael Yang <Michael....@gmail.com> wrote:

> > > How can I call Testrunner.pl from main.pl without spawning a separate
> > > child process?

> > You could do() it. However this would possibly give odd effects if you
> > try to call Testrunner.pl more than once from main.pl.

> I am thinking about using 'require' to do this:
> @ARGV = ();
> require 'Testrunner.pl';
>
> In this way, the variable defined in the main script is in the same
> context as the Testrunner.pl, and could be accessed from the module
> file.

Yes that's what I said. Well I said do() not require(). But the only
difference in this conext is that main.pl _cannot_ run Testrunner.pl
more than once.

> But I found it slows the harness greatly, the performance is lowered.

That seems highly counter-intuative. I would expect it to be a little
faster as you are only loading perl once.

How are you observing this? Is it possible that it's not the tests
that are running slowly but rather something like an output buffering
issue?

> How to leaverage on this?

Well the bunderbus thing would be to make a copy of the whole thing,
main.pl, Testrunner.pl and at least one test case and check you still
see the difference. Then cut bits out progressively checking at each
stage that you still see the difference.

Eventually you'll have a minimal but complete test case to illustrate
the behaviour. If but this time you've not spotted what's happening
then you should post the three files (which by now should be <20 lines
each).



------------------------------

Date: Thu, 10 May 2007 21:07:35 -0400
From: "Thrill5" <nospam@somewhere.com>
Subject: Re: Can't spawn "cmd.exe" error while using system
Message-Id: <GKidnZRDUNdKXN7bnZ2dnUVZ_sWdnZ2d@comcast.com>

Make sure your web server have access to the "C:\windows\system32", better 
yet copy cmd.exe to some other directory that the web server already has 
execute permissions, and make sure that the directory in the path of the 
user that runs as the web server.

Scott
<k.sanjith@gmail.com> wrote in message 
news:1178727200.536536.173550@u30g2000hsc.googlegroups.com...
>I am getting "Can't spawn "cmd.exe"" Error while trying to run a sytem
> call for starting my weblogic server.
> I can call other System calls like Ssystem "cd" etc from the same
> file.
> What can be done to fix this error?
> 




------------------------------

Date: 10 May 2007 15:10:47 -0700
From: shadkeene@hotmail.com
Subject: Re: Correlating Data from same .csv, line by line
Message-Id: <1178835047.495815.242420@p77g2000hsh.googlegroups.com>

Thanks very much for advice.  I do appreciate all your input and will
put more complete questions/code on the appropriate group's site.
Shad



------------------------------

Date: 10 May 2007 19:07:17 GMT
From: xhoster@gmail.com
Subject: Re: Data structure problem to solve Linux memory fault
Message-Id: <20070510150722.849$sX@newsreader.com>

"dalyea@gmail.com" <dalyea@gmail.com> wrote:
> I am running into a memory fault error when processing the
> contents of a database table into a lookup hash.
>
> The problem is that I store item equivalencies (IE) in a db table IE
> with primary key (a, b).  a and b are integers and correspond
> to productId values.
>
> For IE products a and b, I insert as primary key (a, b) and, notably,
> leave out (b, a).  This obviously reduces the IE table size by 50%.

Is that important?  If your data is so large that you need to resort to
space saving tricks even when storing it in a disk-based database, then
trying to load the whole thing into memory in an uncompressed format
seems to be a losing proposition.

>
> To build a single lookup data structure prior to writing to a lookup
> file,

Why?  Database systems are designed to efficiently handle such tasks.
If you need to take the data *out* of a database to make a lookup file,
then what is the point of having it in a database in the first place?

> I try to create hash %ie which for each row has:
>
> $ie{a}{b}=1;
> $ie{b}{a}=1;
>
> Then to get all the IE for a product a, one just looks at the slice
> %ie{a} and gets all the values b1, b2, b3, ... for it.
>
> The IE table has 1.4 million rows for 80,000 products, and sometimes
> (b, a) is written [which is not a problem really].  When I create %ie,
> it must
> be upwards of 2.7 million rows, and hence, I am getting a memory fault
> error.

2.7e6/80000 = almost 34 equivalences per item on average.  Is that right?

>
> The problem is, can I use a better (meaning smaller) data structure
> to capture the IE data?

Yes, but perhaps you should try to implement that structure in the
database, rather than Perl's memory.  Probably the best way would be to
define a canonical identifier to each equivalence class.  For example, just
pick the alphabetically first member of each class to be the canonical id
of that class.

In Perl , you would have two top-level hashes.  One would be a simple
single-level hash which would map each item ID to the canonical ID for the
class it belongs to, and would have 80,000 entries (the number of items).
The other would have one entry for each canonical item, and the value would
be a reference to either a hash or an array with all the other items in
that class.  For example, if you have A1, A2, A3 and B1, B2, B3, with the
As being equivalent to each other and the Bs being equivalent to each
other, you would have something like:

my %equiv=(
          'A3' => 'A1',
          'B3' => 'B1',
          'B1' => 'B1',
          'A1' => 'A1',
          'B2' => 'B1',
          'A2' => 'A1',
        );
my %class=(
          'B1' => {
                    'B3' => undef,
                    'B1' => undef,
                    'B2' => undef,
                  },
          'A1' => {
                    'A3' => undef,
                    'A1' => undef,
                    'A2' => undef,
                  },
        );


> I could lookup each product's IE data as needed, but that would be
> 80,000+ single queries to the database.  I don't even want to try
> that.

If you are going to read 1.4 million rows anyway, I don't see why issuing
80,000 queries would be out of the question.

>
> Also, my algorithm for matching products as IE pretty much puts
> all combinations of (a, b, c, d) in the table for products a b c d.

If you are motivated to save 50% by only storing one ordering of each pair,
it seems silly to use many times as much space to store each pairing
separately.  You are straining at a gnat but swallowing a camel.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: Fri, 11 May 2007 01:25:29 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Data structure problem to solve Linux memory fault
Message-Id: <f20gr7.t4.1@news.isolution.nl>

dalyea@gmail.com schreef:

> To build a single lookup data structure prior to writing to a lookup
> file, I try to create hash %ie which for each row has:
>
> $ie{a}{b}=1;
> $ie{b}{a}=1;

No need to add both, no need to give it a real value. Just make sure
that a < b, and let the value be undefined.


> Then to get all the IE for a product a, one just looks at the slice
> %ie{a} and gets all the values b1, b2, b3, ... for it.

So you also need a hash with a > b. (I am assuming that a and b are
never equal.)


> The problem is, can I use a better (meaning smaller) data structure
> to capture the IE data?

Use a proper database, with both (a,b) and (b,a) as index, and guard at
insert/update that a <= b.

> The point is, a single query won't necessarily get all the IE data
> for a single product.  The whole data structure should be pre-loaded
> all at once, as I'm trying to do.

  SELECT t1.a AS a, t1.b AS b, t2.b AS c FROM ab AS t1 JOIN ab AS t2 ON
t1.b = t2.a WHERE ...

-- 
Affijn, Ruud

"Gewoon is een tijger."



------------------------------

Date: Thu, 10 May 2007 20:50:27 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How do I create a new text file with utf-8 encoding
Message-Id: <nAL0i.14716$rm.2400@trndny03>

Brian McCauley wrote:
> In a situation where you've got a mixture of  Windows-1252 and utf8
> files knocking about then it's not a bad way to distinguish them. I'm
> not saying I particularly liked Microsoft's unilateral adoption of BOM
> in utf8 but I have to admit it makes the best of a bad job.

Fair enough, you got a point.
However calling it a _Byte_Order_ Mark in context of UTF-8 is a misnomer if 
there ever has been one ;-)

jue 




------------------------------

Date: 10 May 2007 21:59:04 -0700
From: Michael Yang <Michael.Yxf@gmail.com>
Subject: Re: How to change the comparsion criteria of diff?
Message-Id: <1178859544.436243.204830@e65g2000hsc.googlegroups.com>

On May 9, 10:02 am, Michael Yang <Michael....@gmail.com> wrote:
> On May 8, 2:47 pm, Michael Yang <Michael....@gmail.com> wrote:
>
>
>
> > On May 8, 11:18 am, Michael <Michael....@gmail.com> wrote:
>
> > > Hi all:
> > > I'm meeting the problem with diff methods in Perl.
> > > I am comparing two files, one containing regular-expression string
> > > texts,  and the other doesn't. what I need to do is to find the
> > > difference between EXCEPT FOR when regular expression matches with the
> > > other's corresponding text, which is shown as below,
> > > For example:
> > > A.txt: Hello every one! I like .* languages very much!
> > > B.txt: Hello every one! I like Perl Languages very much!
> > > The regexp ".*" in A.txt is used to match any string in B.txt as the
> > > normal regular expression does. Here A.txt and B.txt are considered
> > > equal. But the general diff method would consider them as difference
> > > with line-by-line text comparison. And if there are different, I want
> > > the output with same behavior as in the UNIX.
>
> > > I searched into the modules of Perl, like Text::Diff, Algorithm::Diff,
> > > but didn't get any idea of it. I saw that one comparison method can be
> > > passed into Algorithm::Diff as the new comparison criteria in the doc
> > > online, but failed after trying. Could any one give a simple example
> > > showing this feature?
> > > my (@seq1, @seq2) = (<FH1>, <FH2>);
> > > diff(\@seq1, \@seq2, $comparison_function);
> > > I don't know what is the rules of designing this $comparison_function?
>
> > > If there is some other way to do this, please kindly tell me, thanks
> > > very much!
>
> > To be more clearly on this question:
> > I need the script to ignore the text differences when the regex in one
> > file matches the corresponding part in the other. Thus I need to ask
> > the diff utility to compare two files with the new rules of regex as
> > shown above, which could be defined in a comparison function by user
> > self.
>
> Is there anyone could help me on this diff implementation?
>
> It's really appreciated.

no answer yet~~ :(



------------------------------

Date: 10 May 2007 19:41:39 -0700
From: dr_phill123@yahoo.com
Subject: How to concatenate cookies
Message-Id: <1178851299.006111.149920@u30g2000hsc.googlegroups.com>

I would like to send multiple cookies in one variable, however the
code below just send one cookie:

for (my $j=0 ; $j<@custom_fields; $j++) {
        $cookie_custom_fields .= $query->cookie(-domain=>$domainname,
                        -name=>"custom$j",
                         -value=>"$in_field[$j]" ) . ', ';
                                        }
print $query->header(-cookie=>[$cookie_custom_fields]);



------------------------------

Date: Fri, 11 May 2007 04:35:16 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: How to concatenate cookies
Message-Id: <8oS0i.5832$296.2830@newsread4.news.pas.earthlink.net>

On 05/10/2007 09:41 PM, dr_phill123@yahoo.com wrote:
> I would like to send multiple cookies in one variable, however the
> code below just send one cookie:
> 
> for (my $j=0 ; $j<@custom_fields; $j++) {
>         $cookie_custom_fields .= $query->cookie(-domain=>$domainname,
>                         -name=>"custom$j",
>                          -value=>"$in_field[$j]" ) . ', ';
>                                         }
> print $query->header(-cookie=>[$cookie_custom_fields]);
> 

You can put several values into a single cookie like so:

my $cookie = $query->cookie(
	-domain => $domainname,
	-name => 'customfields',
	-value => \@custom_fields
	);
print $query->header(-cookie => $cookie);


Read the CGI docs again: perldoc CGI


------------------------------

Date: 10 May 2007 22:09:26 -0700
From: dr_phill123@yahoo.com
Subject: Re: How to concatenate cookies
Message-Id: <1178860166.082448.56880@h2g2000hsg.googlegroups.com>

On May 10, 11:35 pm, "Mumia W." <paduille.4061.mumia.w
+nos...@earthlink.net> wrote:
> You can put several values into a single cookie like so:
>
> my $cookie = $query->cookie(
>         -domain => $domainname,
>         -name => 'customfields',
>         -value => \@custom_fields
>         );
> print $query->header(-cookie => $cookie);
>
> Read the CGI docs again: perldoc CGI

Thanks, but I am actually looking for each cookie to be seperate, so
have multiple cookies in one variable $cookie. The docs says:

you may concatenate the cookies together with ``; ''

I am not sure what those characters mean ``; " ?



------------------------------

Date: 10 May 2007 13:32:40 -0700
From: Kari <kari.bellew@rmhp.org>
Subject: makefile shows wrong perl version
Message-Id: <1178829160.858754.176870@e51g2000hsg.googlegroups.com>

Hello,

I am trying to link the DBI module to my perl install on HPUX.  This
box has multiple versions of perl.  I am trying to link to a version
that is not the default version.  I set:
  $PATH to new version plus /usr/bin
  $PERL5LIB to new version
  $PERLLIB to new version.

Inside my script I tried "use 5.8.8".  (I have tried different forms
of use.)

No luck.  When I run the Makefile.PL at the end I get a message that
says, "I see you're using perl 5.008008..."

I tried making HelloWorld.pl and having it print $] -- it says
5.008008, too.

What environment variable am I missing?

Thanks for your help,
Kari



------------------------------

Date: 10 May 2007 15:16:00 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: makefile shows wrong perl version
Message-Id: <1178835360.413533.173310@y80g2000hsf.googlegroups.com>

On May 10, 4:32 pm, Kari <kari.bel...@rmhp.org> wrote:
> Hello,
>
> I am trying to link the DBI module to my perl install on HPUX.  This
> box has multiple versions of perl.  I am trying to link to a version
> that is not the default version.  I set:
>   $PATH to new version plus /usr/bin
>   $PERL5LIB to new version
>   $PERLLIB to new version.
>
> Inside my script I tried "use 5.8.8".  (I have tried different forms
> of use.)
>
> No luck.  When I run the Makefile.PL at the end I get a message that
> says, "I see you're using perl 5.008008..."
>
> I tried making HelloWorld.pl and having it print $] -- it says
> 5.008008, too.
>
> What environment variable am I missing?

None.  It's a concept you're missing.  v5.8.8 *IS* 5.008008.  Two
different expansions of the same value.

See also: perldoc perlvar (the $^V variable), and perldoc -f require

Paul Lalli



------------------------------

Date: 10 May 2007 15:42:40 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: makefile shows wrong perl version
Message-Id: <1178836960.494740.93270@l77g2000hsb.googlegroups.com>

On May 10, 6:16 pm, Paul Lalli <mri...@gmail.com> wrote:

> None.  It's a concept you're missing.  v5.8.8 *IS* 5.008008.  Two
> different expansions of the same value.
>
> See also: perldoc perlvar (the $^V variable), and perldoc -f require

Perhaps this output will make that more explicit for you:
$ /usr/bin/perl -wle'print for sprintf("%vd", $^V), $]'
5.8.4
5.008004

$ /usr/local/bin/perl -wle'print for sprintf("%vd", $^V), $]'
5.8.5
5.008005

C:\>perl -wle"print for sprintf('%vd', $^V), $]"
5.8.8
5.008008

Paul Lalli



------------------------------

Date: Fri, 11 May 2007 04:42:09 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri May 11 2007
Message-Id: <JHv129.GvF@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.

Apache-Htpasswd-Shadow-0.02
http://search.cpan.org/~adamk/Apache-Htpasswd-Shadow-0.02/
Apache::Htpasswd variant that saves to a different file
----
App-Addex-0.004
http://search.cpan.org/~rjbs/App-Addex-0.004/
generate mail tool configuration from an address book
----
App-Addex-0.005
http://search.cpan.org/~rjbs/App-Addex-0.005/
generate mail tool configuration from an address book
----
App-Addex-0.006
http://search.cpan.org/~rjbs/App-Addex-0.006/
generate mail tool configuration from an address book
----
App-Addex-AddressBook-Abook-0.001
http://search.cpan.org/~rjbs/App-Addex-AddressBook-Abook-0.001/
use the "abook" program as the addex source
----
App-Addex-AddressBook-Apple-0.004
http://search.cpan.org/~rjbs/App-Addex-AddressBook-Apple-0.004/
use Apple Address Book as the addex source
----
App-Build-0.64
http://search.cpan.org/~mbarbon/App-Build-0.64/
extends Module::Build to build/install/configure entire applications (i.e. web applications), not just modules and programs
----
Bigtop-0.27
http://search.cpan.org/~philcrow/Bigtop-0.27/
A web application data language processor
----
Bio-DOOP-DOOP-0.19
http://search.cpan.org/~tibi/Bio-DOOP-DOOP-0.19/
DOOP API main module
----
Brick-0.224_02
http://search.cpan.org/~bdfoy/Brick-0.224_02/
Complex business rule data validation
----
Bundle-POPFile-1.01
http://search.cpan.org/~manni/Bundle-POPFile-1.01/
The modules needed by POPFile in one clean bundle
----
CGI-Session-Driver-pure_sql-0.62
http://search.cpan.org/~markstos/CGI-Session-Driver-pure_sql-0.62/
Pure SQL driver with no embedded Perl stored in the database
----
Cache-Adaptive-0.02
http://search.cpan.org/~kazuho/Cache-Adaptive-0.02/
A Cache Engine with Adaptive Lifetime Control
----
Cache-FastMmap-1.16
http://search.cpan.org/~robm/Cache-FastMmap-1.16/
Uses an mmap'ed file to act as a shared memory interprocess cache
----
Cairo-1.040
http://search.cpan.org/~tsch/Cairo-1.040/
Perl interface to the cairo library
----
Class-Accessor-Grouped-0.05001
http://search.cpan.org/~claco/Class-Accessor-Grouped-0.05001/
Lets you build groups of accessors
----
Class-Accessor-Ref-0.05
http://search.cpan.org/~gaal/Class-Accessor-Ref-0.05/
Access members by reference
----
Class-Component-0.03
http://search.cpan.org/~yappo/Class-Component-0.03/
pluggable component framework
----
Class-Rebless-0.08
http://search.cpan.org/~gaal/Class-Rebless-0.08/
Rebase deep data structures
----
Config-INI-Reader-0.003
http://search.cpan.org/~rjbs/Config-INI-Reader-0.003/
a subclassable .ini-file parser
----
DBI-1.56_01
http://search.cpan.org/~timb/DBI-1.56_01/
Database independent interface for Perl
----
DBIx-Perlish-0.25
http://search.cpan.org/~gruber/DBIx-Perlish-0.25/
a perlish interface to SQL databases
----
Date-Tiny-0.02
http://search.cpan.org/~adamk/Date-Tiny-0.02/
A date object, with as little code as possible
----
DateTime-Format-Natural-0.32
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.32/
Create machine readable date/time with natural parsing logic
----
Egg-Model-DBIC-2.01
http://search.cpan.org/~lushe/Egg-Model-DBIC-2.01/
DBIx::Class for Egg Model.
----
Egg-Plugin-Crypt-CBC-2.00
http://search.cpan.org/~lushe/Egg-Plugin-Crypt-CBC-2.00/
Crypt::CBC for Egg Plugin.
----
Egg-Plugin-Crypt-CBC-2.01
http://search.cpan.org/~lushe/Egg-Plugin-Crypt-CBC-2.01/
Crypt::CBC for Egg Plugin.
----
Egg-Plugin-LWP-2.00
http://search.cpan.org/~lushe/Egg-Plugin-LWP-2.00/
LWP for Egg Plugin.
----
Egg-Plugin-LWP-2.01
http://search.cpan.org/~lushe/Egg-Plugin-LWP-2.01/
LWP for Egg Plugin.
----
Egg-Plugin-MailSend-2.00
http://search.cpan.org/~lushe/Egg-Plugin-MailSend-2.00/
Mail is delivered for Egg Plugin.
----
Egg-Plugin-Net-Ping-2.00
http://search.cpan.org/~lushe/Egg-Plugin-Net-Ping-2.00/
Net::Ping for Egg plugin.
----
Egg-Plugin-Net-Ping-2.01
http://search.cpan.org/~lushe/Egg-Plugin-Net-Ping-2.01/
Net::Ping for Egg plugin.
----
Egg-Plugin-Net-Scan-2.00
http://search.cpan.org/~lushe/Egg-Plugin-Net-Scan-2.00/
Network host's port is checked.
----
Egg-Release-2.03
http://search.cpan.org/~lushe/Egg-Release-2.03/
Version of Egg WEB Application Framework.
----
Exception-Base-0.04
http://search.cpan.org/~dexter/Exception-Base-0.04/
Lightweight exceptions
----
File-Copy-Recursive-0.32
http://search.cpan.org/~dmuey/File-Copy-Recursive-0.32/
Perl extension for recursively copying files and directories
----
File-Copy-Recursive-0.33
http://search.cpan.org/~dmuey/File-Copy-Recursive-0.33/
Perl extension for recursively copying files and directories
----
GD-Icons-0.02
http://search.cpan.org/~pcanaran/GD-Icons-0.02/
Utility for generating series of icons of varying color and shapes
----
GoferTransport-http-1.00
http://search.cpan.org/~timb/GoferTransport-http-1.00/
----
HTML-GMap-0.02
http://search.cpan.org/~pcanaran/HTML-GMap-0.02/
Generic Perl infrastructure to build Google Maps displays
----
Image-ExifTool-6.90
http://search.cpan.org/~exiftool/Image-ExifTool-6.90/
Read and write meta information
----
JE-0.011
http://search.cpan.org/~sprout/JE-0.011/
Pure-Perl ECMAScript (JavaScript) Engine
----
JSON-1.14
http://search.cpan.org/~makamaka/JSON-1.14/
parse and convert to JSON (JavaScript Object Notation).
----
JSON-Any-1.06_01
http://search.cpan.org/~perigrin/JSON-Any-1.06_01/
Wrapper Class for the various JSON classes.
----
Log-Handler-0.33
http://search.cpan.org/~bloonix/Log-Handler-0.33/
A simple handler to log messages to log files.
----
MARC-XML-0.86
http://search.cpan.org/~kados/MARC-XML-0.86/
----
Module-CoreList-2.11
http://search.cpan.org/~rgarcia/Module-CoreList-2.11/
what modules shipped with versions of perl
----
OOPS-0.2002
http://search.cpan.org/~muir/OOPS-0.2002/
Object Oriented Persistent Store
----
Object-InsideOut-3.15
http://search.cpan.org/~jdhedden/Object-InsideOut-3.15/
Comprehensive inside-out object support module
----
Object-InsideOut-3.16
http://search.cpan.org/~jdhedden/Object-InsideOut-3.16/
Comprehensive inside-out object support module
----
POE-Component-Client-MPD-0.0.3
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.0.3/
a full-blown mpd client library
----
POE-Component-Client-MPD-0.1.0
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.1.0/
a full-blown mpd client library
----
POE-Component-Server-SimpleSMTP-1.04
http://search.cpan.org/~bingos/POE-Component-Server-SimpleSMTP-1.04/
A simple to use POE SMTP Server.
----
POE-Session-AttributeBased-0.06
http://search.cpan.org/~cfedde/POE-Session-AttributeBased-0.06/
POE::Session syntax sweetener
----
Perl-Metrics-Simple-0.032
http://search.cpan.org/~matisse/Perl-Metrics-Simple-0.032/
Count packages, subs, lines, etc. of many files.
----
Qpsmtpd-Plugin-Quarantine-1.01
http://search.cpan.org/~muir/Qpsmtpd-Plugin-Quarantine-1.01/
filter outbound email to prevent blacklisting
----
Sepia-0.71
http://search.cpan.org/~seano/Sepia-0.71/
Simple Emacs-Perl Interface
----
Tcl-Tk-0.95
http://search.cpan.org/~vkon/Tcl-Tk-0.95/
Extension module for Perl giving access to Tk via the Tcl extension
----
Template-Parser-CET-0.02
http://search.cpan.org/~rhandom/Template-Parser-CET-0.02/
CGI::Ex::Template based parser for the TT2 engine
----
Term-Clui-1.40
http://search.cpan.org/~pjb/Term-Clui-1.40/
Perl module offering a Command-Line User Interface
----
Test-Unit-Lite-0.02
http://search.cpan.org/~dexter/Test-Unit-Lite-0.02/
Unit testing without external dependencies
----
Thread-Pool-Simple-0.22
http://search.cpan.org/~jwu/Thread-Pool-Simple-0.22/
A simple thread-pool implementation
----
Tk-Pod-0.9934
http://search.cpan.org/~srezic/Tk-Pod-0.9934/
Pod browser toplevel widget
----
URI-ParseSearchString-2.2
http://search.cpan.org/~sden/URI-ParseSearchString-2.2/
parse Apache refferer logs and extract search engine query strings.
----
WWW-Mechanize-Plugin-Display-1.01
http://search.cpan.org/~markstos/WWW-Mechanize-Plugin-Display-1.01/
Display WWW::Mechanize results in a local web browser.
----
Web-Scraper-0.05
http://search.cpan.org/~pjb/Web-Scraper-0.05/
Web Scraping Toolkit inspired by Scrapi
----
WebService-Gnavi-0.01
http://search.cpan.org/~dmaki/WebService-Gnavi-0.01/
Use Gnavi API From Perl
----
WebService-Gnavi-0.011
http://search.cpan.org/~dmaki/WebService-Gnavi-0.011/
Use Gnavi API From Perl
----
XLSperl-0.03
http://search.cpan.org/~jonallen/XLSperl-0.03/
----
YAML2-0.02
http://search.cpan.org/~ingy/YAML2-0.02/
Next Generation YAML Tools For Perl


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: 10 May 2007 18:16:47 GMT
From: xhoster@gmail.com
Subject: Re: perl out of memory
Message-Id: <20070510141651.988$kK@newsreader.com>

xlue897@rogers.com wrote:
> >
> > >Thanks everyone for your help.  The while loop works.  However,  the
> > >perl code seems much slower than awk code.  For the same file size
> > >around 5M records, the awk takes only 1 min to loop to find the max
> > >value, the perl takes around 20 mins.  Does perl slower than awk?
> >
 ...
>
> Here is the test code with result. test file generated by (perl -le
> 'print rand for 1..5_000_000' > test.txt)
> $time awk -F'.' '{ if($2 > max) {max = $2;} } END{print max;}'
> <test.txt
> 999969482421875
>
> real    0m18.16s
> user    0m17.38s
> sys     0m0.18s
>
> $time perl  -a -F'\.' -n -e '{ if($F[1] >$max) {$max=$F[1];} }
> END{print $max;}'  test.txt
> 999969482421875
>
> real    0m41.57s
> user    0m41.14s
> sys     0m0.16s

So the difference here is less than a factor of 3, rather than the factor
of 20 you originally said.  A factor of 3 is easy to believe.  Different
languages have different strengths.

>
> BTW, why the code below doesn't work?
> perl -a -F/\./ -n -e '{print $F[1], "\n";} ' test.txt

The shell eats the backslash, so Perl never sees it and treats . as the
special character rather than as a literal.  It often helps to use echo
to tell you exactly what Perl is seeing once the shell is done:


$ echo F/\./
F/./

$ echo 'F/\./'
F/\./

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: 10 May 2007 12:40:08 -0700
From: Eric <ecarlson@vmware.com>
Subject: Problems setting value in MLDBM created database
Message-Id: <1178826008.144858.54590@q75g2000hsh.googlegroups.com>

We have an existing database named 'DBfile' that was created using
MLDBM. I want to modify the value of 'Cnt' in this database using the
following script:

=============================================
#! /usr/bin/perl

use Data::Dumper;
use Fcntl;
use MLDBM qw(DB_File Storable);

&DBprint("nfs", "32039", '0');

sub DBprint {
   my $protocol = shift;
   my $bldNum = shift;
   my $mntPnt = shift;
   my $DBFile = "./DBfile";

   tie( %$mntsDB, "MLDBM", $DBFile, O_CREAT|O_RDWR, 0666,
$DB_File::DB_BTREE );

   $mntPnt = "mnt".$mntPnt;

   print STDOUT "\nBEFORE\n";

   print STDOUT (Dumper $mntsDB);

   print STDOUT "\nInitial Cnt is: $mntsDB->{$mntPnt}->{Cnt};\n";

   my $tmp = $mntsDB->{$mntPnt}->{Cnt};

   print STDOUT "\n\$tmp is: $tmp\n";

   $tmp{Cnt}[0] = 'foo';   ## key line of code

   print STDOUT "\n\$tmp is now: $tmp->{Cnt}[0]\n";

   $mntsDB->{$mntPnt}->{Cnt} = $tmp;

   print STDOUT "\nCnt is now: $mntsDB->{$mntPnt}->{Cnt};\n";

   print STDOUT "\nAFTER\n";

   print STDOUT (Dumper $mntsDB);

   untie(%$mntsDB);
}
=============================================

But note in the output below that the value is not modified:

=============================================
BEFORE
$VAR1 = {
          'mnt0' => {
                         'Cnt' => 2,
                         'BldNum' => '32039',
                         'Protocol' => 'nfs'
                       }
        };

Initial Cnt is: 2;

$tmp is: 2

$tmp is now: foo

Cnt is now: 2;

AFTER
$VAR1 = {
          'mnt0' => {
                         'Cnt' => 2,
                         'BldNum' => '32039',
                         'Protocol' => 'nfs'
                       }
        };
=============================================

I read the CPAN page carefully, and although it seems as if this
should work, it does not. The Cnt value is not getting reset to the
value 'foo'.

Does anyone see where I am making my mistake? I noted a key line of
code in the script that I think may be preventing this from working,
although I did try several variations. I'm thinking that maybe I am
getting tangled up in my references.

Thanks.

Eric



------------------------------

Date: 10 May 2007 22:23:51 GMT
From: xhoster@gmail.com
Subject: Re: Problems setting value in MLDBM created database
Message-Id: <20070510182358.794$zz@newsreader.com>

Eric <ecarlson@vmware.com> wrote:
> We have an existing database named 'DBfile' that was created using
> MLDBM. I want to modify the value of 'Cnt' in this database using the
> following script:

<snip code that doesn't compile under strict>

>
> Does anyone see where I am making my mistake?

Yes.  From a programming perspective, you apparently aren't using strict.
From a clpm perspective, you posted code that doesn't compile under
"use strict".  Both of those are mistakes in themselves, and are
probably hiding other mistakes from you.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: Thu, 10 May 2007 23:05:28 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Problems setting value in MLDBM created database
Message-Id: <YyN0i.9767$j63.9339@newsread2.news.pas.earthlink.net>

On 05/10/2007 02:40 PM, Eric wrote:
> We have an existing database named 'DBfile' that was created using
> MLDBM. I want to modify the value of 'Cnt' in this database using the
> following script:
> [...]

Here is your program modified to work. I've placed a few numbered 
comments in the code:

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Fcntl;
use DB_File;
# 1: use DB_File to ensure that DB_BTREE is defined.

use MLDBM qw(DB_File Storable);

&DBprint("nfs", "32039", '0');

sub DBprint {
    my $protocol = shift;
    my $bldNum = shift;
    my $mntPnt = shift;
    my $DBFile = "./DBfile";
    my $mntsDB;

    tie( %$mntsDB, "MLDBM", $DBFile, O_RDWR, 0666, $DB_File::DB_BTREE  )
     or die("Tie failure: $!");
    # 2: die() if the tie fails.

    $mntPnt = "mnt".$mntPnt;

    print STDOUT "\nBEFORE\n";

    print STDOUT (Dumper $mntsDB);

    print STDOUT "\nInitial Cnt is: $mntsDB->{$mntPnt}->{Cnt};\n";

    my $tmp = $mntsDB->{$mntPnt};
    # 3: $mntsDB->{$mntPnt}->{Cnt} is a scalar element
    #   of a hash--not an array.

    print STDOUT "\n\$tmp is: $tmp\n";

    $tmp->{Cnt} = 'foo';   ## (modified) key line of code

    print STDOUT "\n\$tmp is now: $tmp->{Cnt}\n";

    # $mntsDB->{$mntPnt}->{Cnt} = $tmp;
    $mntsDB->{$mntPnt} = $tmp;
    # 4: Aggregates in a DB_File need to be updated all at once.

    print STDOUT "\nCnt is now: $mntsDB->{$mntPnt}->{Cnt};\n";

    print STDOUT "\nAFTER\n";

    print STDOUT (Dumper $mntsDB);

    untie(%$mntsDB);
}

__END__

Comment #4 is the most important. I can't remember where I first read 
about it, but you can't update a sub-hash within a tied database hash. 
The top-level entry must be updated.



------------------------------

Date: 10 May 2007 16:24:43 -0700
From: Eric <ecarlson@vmware.com>
Subject: Re: Problems setting value in MLDBM created database
Message-Id: <1178839483.240343.201140@q75g2000hsh.googlegroups.com>

> Mumia W. wrote:
<removed>

Thank you very much for your solution, Munia. I tried it and it does
in fact work.

> Comment #4 is the most important. I can't remember where I first read
> about it, but you can't update a sub-hash within a tied database hash.
> The top-level entry must be updated.

Obviously I had made several mistakes that prevented this from
working, but this one was key.

Eric



------------------------------

Date: Fri, 11 May 2007 01:43:25 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Reason for specified Error Occurence
Message-Id: <f21aaa.js.1@news.isolution.nl>

Ranjit schreef:

> Could any one let us know the reason why the below error is showing
> from this code.
> 
> ERROR :
> 
> Use of uninitialized value in subroutine entry at C:/Perl/lib/
> Socket.pm line 373.
> Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4
> at C:/Perl/lib/Socket.pm line 373.
> 
> 
> #!/usr/bin/perl

Missing:

  use strict;
  use warnings;


> use Socket;
> $proto = getprotobyname('tcp');
> $domain = PF_INET;
> $type = SOCK_STREAM;

printf "proto:%s, domain:%s, type:%s\n", 
       $proto, $domain, $type;

> socket(CLIENT,$domain,$type,$proto);

Missing: test for succes.


> $port = 0 ;
> $ipaddr = INADDR_ANY;
> $sockaddr = sockaddr_in($port,$ipaddr);

printf ...

> bind(CLIENT,$sockaddr);

test ...

> print "sathi";
> 
> $host = 'www.yahoo.com';
> $port = getservbyname('http','tcp');
> $ip_addr= inet_aton($host);

printf ...

> $sockaddr = sockaddr_in($port,$ip_addr);

printf ...

> connect(CLIENT,$sockaddr);

test ...

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Thu, 10 May 2007 21:05:35 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: Re: warnings dilemma
Message-Id: <f201eu$q0q$1@reader2.panix.com>

In <1178818888.039832.23680@y5g2000hsa.googlegroups.com> Brian McCauley <nobull67@gmail.com> writes:

>On May 10, 5:28 pm, kj <s...@987jk.com.invalid> wrote:
>> I've read the PODs (warnings, perllexwarn) but I still don't know
>> how to solve this problem.  Here's a toy version of it.
>>
>> First some random module:
>>
>>   # Foo.pm
>>   package Foo;
>>   use strict;
>>   use warnings;
>>
>>   # calling foo() will result in an 'uninitialized' warning
>>   sub foo { my %h; exists $h{ $_[ 0 ] } }
>>   1;
>>
>>   __END__
>>
>> The function Foo::foo represents one of those situtations in which
>> the author of the module, for whatever reason, has not taken steps
>> to avoid a default warning.

>So you don't like something about the way the module works.

No, that's *not* the problem.  The problem is that, as far as I
can tell, there is no good way (either through code or through
coding practices) to provide control over warnings to the calling
script.  Every alternative is deficient in one way or another.

>> Next, my script
>>
>>   use strict;
>>   use Foo;
>>   { no warnings; Foo::foo(); }
>>   exit;
>>
>> Now, despite the "no warnings" in the script, when I run it I still
>> get the "Use of initialized value in exists" warning.

>That's right. That's the whole point of lexical scope.

I disagree.  I think a far more useful implementation of lexical
control is to give each lexical scope the ability to control which
warnings it allows to "bubble up" through it, in a way entirely
analogous to the lexical control of fatal errors with eval.  E.g.
under this version, code like this:

  if ( $verbose ) {
    use warnings;
    Foo::foo();
  }
  else {
    no warnings;
    Foo::foo();
  }

would result in warnings only if $verbose is true.  This is more
useful than what we have now, because it privileges scopes in
proportion to their proximity to the top-level scope, as it should
be.  I don't understand why it wasn't designed like this in the
first place...

kj
-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


------------------------------

Date: Fri, 11 May 2007 13:56:41 +0800
From: "Ken Soon" <csoon@xilinx.com>
Subject: Re: Website programming (search + statistics)
Message-Id: <f210oo$ba02@cnn.xsj.xilinx.com>

Ah cool thanks ppls!
Been big help. I shall start with CGI first though. Seems easier to 
understand.




------------------------------

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 424
**************************************


home help back first fref pref prev next nref lref last post