[22873] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5094 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 8 06:05:38 2003

Date: Sun, 8 Jun 2003 03:05: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           Sun, 8 Jun 2003     Volume: 10 Number: 5094

Today's topics:
    Re: Perl exam - fair or not? <Nekid@jaybird.com>
    Re: Perl exam - fair or not? <uri@stemsystems.com>
    Re: Perl exam - fair or not? <tassilo.parseval@rwth-aachen.de>
    Re: socket.pm broken ? (getprotobyname does not work) <pilsl_usenet@goldfisch.at>
    Re: Strange errors with huge hash <uri@stemsystems.com>
    Re: Strange errors with huge hash <tassilo.parseval@rwth-aachen.de>
    Re: Strange errors with huge hash <uri@stemsystems.com>
    Re: Strange errors with huge hash (Sam Holden)
    Re: Strange errors with huge hash <tassilo.parseval@rwth-aachen.de>
    Re: Strange errors with huge hash <tassilo.parseval@rwth-aachen.de>
    Re: Strange errors with huge hash <me@privacy.net>
    Re: Strange errors with huge hash <me@privacy.net>
    Re: Unusual Can't load fail (web only) <randy@theoryx5.uwinnipeg.ca>
    Re: Unusual Can't load fail (web only) <kalinabears@hdc.com.au>
    Re: Unusual Can't load fail (web only) <randy@theoryx5.uwinnipeg.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 08 Jun 2003 00:18:30 -0400
From: Buck <Nekid@jaybird.com>
Subject: Re: Perl exam - fair or not?
Message-Id: <pan.2003.06.08.04.18.30.753873@jaybird.com>

On Sun, 08 Jun 2003 01:56:32 +0000, Uri Guttman wrote:

>>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
> 
>   >> 19. What is true about the ARGV array? 
>   >> (a) Identical to the ARGV array in C. 
>   >> (b) ARGV[0] holds the name of the program. 
>   >> (c) When no arguments are given to a program, the array evaluates to
>   >> FALSE. 
>   >> (d) Its array index starts at 1. 
> 
> 
>   TM> There is no correct answer for that question either.
> 
>   TM> What it evaluates to depends on what context it is evaluated in.
> 
> hmm, an empty array is () in list context and 0 in scalar context. both
> are false in my book. but there is not 'false' to evaluate too. (c) is
> just worded very poorly. the whole test is a crock like most HR oriented
> tests.
> 
> uri

Defined is more like it.  If you add use strict you find out quickly the
difference between false and undefined. :)  Unless you dont mind those
warning messages. 

Rich




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

Date: Sun, 08 Jun 2003 04:22:38 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl exam - fair or not?
Message-Id: <x73cilurjl.fsf@mail.sysarch.com>

>>>>> "B" == Buck  <Nekid@jaybird.com> writes:

  >> hmm, an empty array is () in list context and 0 in scalar context. both
  >> are false in my book. but there is not 'false' to evaluate too. (c) is
  >> just worded very poorly. the whole test is a crock like most HR oriented
  >> tests.
  >> 
  >> uri

  B> Defined is more like it.  If you add use strict you find out quickly the
  B> difference between false and undefined. :)  Unless you dont mind those
  B> warning messages. 

huh?

i think you mean warnings. strict has nothing to do with runtime stuff
like undef. and an empty array is still defined. try it out some time,
fill an array, empty it and test with defined. defined on aggregates is
meaningless and wrong.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 8 Jun 2003 06:20:09 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Perl exam - fair or not?
Message-Id: <bbukip$kg9$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Tad McClellan:

> anon <> wrote:

>> 19. What is true about the ARGV array? 
>>  (a) Identical to the ARGV array in C. 
>>  (b) ARGV[0] holds the name of the program. 
>>  (c) When no arguments are given to a program, the array evaluates to
>> FALSE. 
>>  (d) Its array index starts at 1. 
> 
> 
> There is no correct answer for that question either.
> 
> What it evaluates to depends on what context it is evaluated in.

I think no matter in which context you evaluate an empty array, it'll be
false.

>> 23. What is the return value of a subroutine?  (Choose only ONE)
> 
>>  (b) The value of the last _expression evaluated (either scalar or an
>> array). 
> 
> 
> The test writer seems confused about the distinction between
> an "array" and a "list".
> 
> Perhaps he/she just hasn't read the Perl FAQ...

I was never so sure about that. Even though a Perl function can only
return a list, there is still the distinction between:

    return qw/a b c/;

and

    @array = qw/a b c/;
    return @array;

The outcome of such a function differs depending on context. Of course,
when calling the second one in scalar context, it still returns a
one-element list (holding the length of @array).

>> 28. Which are valid methods of turning on call-by-value? 
>>  (a) Using the local function. 
>>  (b) Using the my function. 
>>  (c) Using the values function. 
>>  (d) Using the & symbol to call the subroutine. 
> 
> 
> There is no correct answer for that question either.
> 
> call-by-value is *impossible* in Perl, so you cannot "turn it on",
> though you _can_ get the _effect_ of call-by-value by making a copy
> and operating only on the copy.

That had me confused, too. This test shows a problem a lot of people
seem to have with Perl (including teachers of Perl): They try to find
analogies between Perl and other programming languages when there are
none (the distinction between subroutine and function was one of those
attempts). Once in a while they have to acknowledge that perl does it
differently.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 8 Jun 2003 09:34:40 +0200
From: peter pilsl <pilsl_usenet@goldfisch.at>
Subject: Re: socket.pm broken ? (getprotobyname does not work)
Message-Id: <3ee2e7e4$1@e-post.inode.at>

Nicholas Dronen wrote:

> grep tcp /etc/protocols

>P.S.  Spend an hour or so introducing yourself to strace while you're
>at it.  It's a useful tool.

Thnx many thousand times. For some reason (that I still need to figure out) 
this file was completely missing on the system !! 

As your recommendation strace showed me socket.pm does not query socket.h 
(as it says in its documentation) but simple queries /etc/protocols.

Problem solved.

thnx,
peter

-- 
peter pilsl
pilsl_usenet@goldfisch.at
http://www.goldfisch.at



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

Date: Sun, 08 Jun 2003 04:20:48 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Strange errors with huge hash
Message-Id: <x765nhurmo.fsf@mail.sysarch.com>

>>>>> "e" == emcee  <res1uzbe@verizon.net> writes:


  e> Alright fine, next time you need to save a hash, you can go ahead and
  e> use Data::Dumper, I will use my module because it meets the criteria:

  e> A: It does what I need it to do.
  e> B: It's more efficent than the alternative.

efficient and wrong for complex structures. sorry, i take correct over
fast. and my development time is much more valuable than your cpu time.

this is the difference between being a professional coder and a web
monkey. you can decide which one is which. i know the correct answer.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 8 Jun 2003 04:59:20 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Strange errors with huge hash
Message-Id: <bbufr8$it9$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Uri Guttman:

>  d> "emcee" <res1uzbe@verizon.net> wrote in message
>  d> news:b4rEa.62180$Pb.53874@nwrddc01.gnilink.net...

>  >> sub walk
>  >> {
>  >> my $hash=shift;
>  >> foreach(@_)
>  >> {
>  >> s/'/\'/g;
>  >> s/\\/\\\\/g;

> well, duh, we know data::dumper gets it right. we have all said that. but
> emcee refuses to understand why dumping a hash tree accurately and in a
> way that can be evaled is NOT TRIVIAL and not for beginners.

So even if he is reinventing the wheel: What is so wrong when the OP
asks why his reinvention doesn't work? He can naturally use Data::Dumper
and he is in fact advised to do so. Still, he has provided some code
(finally) and he'll surely benefit if a few regulars of this group have
a look at it and make some suggestions.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 08 Jun 2003 05:06:47 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Strange errors with huge hash
Message-Id: <x7znkttaxk.fsf@mail.sysarch.com>

>>>>> "TvP" == Tassilo v Parseval <tassilo.parseval@rwth-aachen.de> writes:

  TvP> So even if he is reinventing the wheel: What is so wrong when the
  TvP> OP asks why his reinvention doesn't work? He can naturally use
  TvP> Data::Dumper and he is in fact advised to do so. Still, he has
  TvP> provided some code (finally) and he'll surely benefit if a few
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                  

  TvP> regulars of this group have a look at it and make some
  TvP> suggestions.

that says it all.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 8 Jun 2003 05:30:36 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Strange errors with huge hash
Message-Id: <slrnbe5ifs.kq8.sholden@flexal.cs.usyd.edu.au>

On Sun, 08 Jun 2003 02:25:46 GMT, emcee <res1uzbe@verizon.net> wrote:
> 
> Who said I was a beginner?  If it was so incredibly hard, and I was such 
> a novice, I wouldn't have gotten anything that almost worked. But I 
> wrote it and it worked fine right from the first run, with the exception 
> of this one situation, which wasn't an issue of me not grasping some 
> concept or something, I just typed a couple of commands in the wrong order.

Non-beginners (note that beginner doesn't necessarily equate to time spent
using perl, but to what you have learnt in that time) know that 
"Premature optimization is the root of all evil." 

I took the code the posted, and fixed the \' => \\' bit, and swapped the
two substitutions (so that "'" doesn't end up as "\\'"). I then copied it
into another file and changed the save and open functions to be:

sub save_hash
{
  ($hash=shift or $hash=$last_hash) or return &error('No hash open');
  ($file=shift or $file=$hashes{$hash})
    or return &error("That hash isn't open");
  open(HASH, '>'.$path."data/$file.msh") or return &error($!);
  flock(HASH,2);
  print HASH Dumper($hash);
  close(HASH);
  1;
}

sub open_hash
{
  &clear_errors;
  $hashes{$_[1]}=$_[0];
  (open(HASH, $path."data/$_[0].msh") or
  create_hash($path."data/$_[0].msh")) or return &error($!);
  flock(HASH,1);
  $cpt->reval(join '', <HASH>);
  close(HASH);
  return &error($@) if $@;
  %{$_[1]}=%{$Safe::Root1::VAR1};
  $last_hash=$_[1];
  1;
}

The Root0 -> Root1 since two Safe compartments are being created, and I happen
to know the order they are created in. Using the root() method would be much
better (safety wise) but would require a symbolic reference.

Plus a few minor changes to include Data::Dumper and put the files in slightly
different places. (I didn't change the join '', <HASH> to a slurp since I
wanted to make as few changes as possible).

I then spent far to long before I realised that your save_hash is destructive
and hence was ruining my benchmarks so the following doesn't generate any
's or \s in the keys and values:

use msh;
use dd;
use Benchmark 'cmpthese';
use strict;

sub make_small_hash {
  my %hash;
  for (1...12) {
    my ($key,$val) = ('','');
    $key.=chr(rand(26)+ord('A')) for (0..rand(10)+1);
    $val.=chr(rand(26)+ord('A')) for (0..rand(10)+1);
    $hash{$key} = $val;
  }
  return \%hash;
}

sub make_hash {
  my %hash;
  my $t = 'aaaa';
  for (1..12) {
    $hash{$t++} = make_small_hash();
  }
  return \%hash;
}

my $hash = make_hash();
my $hash_out_msh = {};
my $hash_out_dd = {};

msh::create_hash('testmsh');
dd::create_hash('testdd');

use Data::Dumper;
cmpthese(500, {  
  'msh::save_hash' => sub {msh::save_hash($hash,'testmsh')},
  'dd::save_hash'  => sub {dd::save_hash($hash,'testdd')},
});

cmpthese(500, {
  'msh::open_hash' => sub {msh::open_hash('testmsh',$hash_out_msh)},
  'dd::open_hash' => sub {dd::open_hash('testdd',$hash_out_dd)},
});


Which gave the following (after some editing to make it fit in 80 cols) over
a couple of runs:

Benchmark: timing 500 iterations of dd::save_hash, msh::save_hash...
dd::save_hash: 11 wallclock secs (7.03 usr + 0.17 sys = 7.20 CPU) @ 69.44/s
msh::save_hash: 5 wallclock secs (3.25 usr + 0.09 sys = 3.34 CPU) @ 149.70/s
                 Rate  dd::save_hash msh::save_hash
dd::save_hash  69.4/s             --           -54%
msh::save_hash  150/s           116%             --
Benchmark: timing 500 iterations of dd::open_hash, msh::open_hash...
dd::open_hash:  9 wallclock secs (6.14 usr + 0.03 sys = 6.17 CPU) @ 81.04/s
msh::open_hash: 9 wallclock secs (6.03 usr + 0.11 sys = 6.14 CPU) @ 81.43/s
                 Rate  dd::open_hash msh::open_hash
dd::open_hash  81.0/s             --            -0%
msh::open_hash 81.4/s             0%             --

Benchmark: timing 500 iterations of dd::save_hash, msh::save_hash...
dd::save_hash: 16 wallclock secs (6.95 usr + 0.08 sys = 7.03 CPU) @ 71.12/s
msh::save_hash: 5 wallclock secs (3.19 usr + 0.12 sys = 3.31 CPU) @ 151.06/s
                 Rate  dd::save_hash msh::save_hash
dd::save_hash  71.1/s             --           -53%
msh::save_hash  151/s           112%             --
Benchmark: timing 500 iterations of dd::open_hash, msh::open_hash...
dd::open_hash: 10 wallclock secs (6.17 usr + 0.08 sys = 6.25 CPU) @ 80.00/s
msh::open_hash:10 wallclock secs (6.13 usr + 0.06 sys = 6.19 CPU) @ 80.78/s
                 Rate  dd::open_hash msh::open_hash
dd::open_hash  80.0/s             --            -1%
msh::open_hash 80.8/s             1%             --


So your code is twice as fast, So you'll save an an entire second of CPU time
every time you save 130 or so hashes.

But of course you've spent some time and effort fixing the bugs and testing.

The destructive nature of your code will possibly cause a future bug as well
(I sure hope that's commented).

However, was this operation the bottleneck in your code's execution time?
Could you have saved more CPU timeby optmising something else instead?
Is the disk flast or slow? Would compressing the storage and hence trading
some CPU for disk result in a lower wallclock time?

All those questions (and many more) are best answered before implementing a
specific case version of a well tested general functionf

> 
> I have now just used the module to store a hash with over 12,000 entries 
> each with 12 key/value pairs, and it worked fine.

The structure of which may be very different from what I created above,of
course and hence the benchmarks are probably meaningless.

-- 
Sam Holden



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

Date: 8 Jun 2003 05:56:36 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Strange errors with huge hash
Message-Id: <bbuj6k$k1p$1@nets3.rz.RWTH-Aachen.DE>

Also sprach emcee:

> No, the generated code is 4800 lines, the module is as follows:

[...]

> 	&walk($hash, keys %{$hash});

First of all, I'd say that having walk() take a reference and the keys
is more complicated than necessary. Just pass a reference to a hash to
walk and let it extract the keys. That way, you make the overall logic a
little clearer (it's also minimally more efficient because you don't
create lists of keys).

[...]

> sub walk
> {
> 	my $hash=shift;
> 	foreach(@_)
> 	{
> 		s/'/\'/g;
> 		s/\\/\\\\/g;

That has been mentioned somewhere else. You need to have them in the
reverse order. Out of fun, I just implemented a hash-serializer (see
below) and made the very same mistake the first time.

> 		if(ref $hash->{$_})
> 		{
> 			$hasht.="'$_'=>{";
> 			&walk($hash->{$_}, keys %{$hash->{$_}});
> 			chop $hasht;

Is this chop() there to remove trailing commatas? Just leave them in,
they wont hurt.

> 			$hasht.="},";
> 		}
> 		else
> 		{
> 			$hash->{$_}=~s/'/\'/g;
> 			$hash->{$_}=~s/\\/\\\\/g;

Again, the order is wrong. Also, you are manipulating the original hash
via references which you shouldn't do.

> 			$hasht.="'$_'=>'$hash->{$_}',";
> 		}
> 	}
> }
> 1;

Finally - and most importantly - make your code strictures safe. Use
lexical variables instead of globals. That alone will catch a lot of
errors on the long run.

I came up with this that also indents an arbitrary hash properly. The
main difference is that I use a closure to not allow any variable to
leak into the main program. Furthermore, I don't pass any keys. I use
each() inside the recursive walk() function to traverse a hash. $code
and $pad are the two variables that are closed over by the walk() and
serialize() function:

    my $hash = {
        key     => 'value',
        key1    => "value2's val",
        nest    => { key     => 'value',
                     key1    => "value2's val" },
        key2    => 1,
        2       => { 1 => 2, 
                     3 => { 4 => 5 },
                   },
    };
    
    print serialize($hash, "hash");
    
    {
        my $code;   # serialized code will be in here
        my $pad;    # for indentation
        
        sub walk {
            my $ref = shift;
            while (my ($k, $v) = each %$ref) {
                for ($k, $v) {
                    s/\\/\\\\/g;
                    s/'/\\'/g;
                }
                $code .= qq( $pad'$k' =>);
                $code .= qq( '$v',\n ) and next if ! ref $v;
                
                $pad .= "\t";
                $code .= qq( {\n);
                walk($v);
                $code .= qq( $pad},\n );
                chop($pad);
            }
        }

        sub serialize {
            my ($hash, $name) = @_;
            
            # reset the buffer and state-aware $pad
            undef $code;
            $pad = "\t";
            
            $code .= qq! %$name = (\n !;
            walk($hash);
            $code .= qq! ); !;
            return $code;
        }
    }
    __END__

That produces:

     %hash = (
        'key2' => '1',
        'nest' => {
            'key1' => 'value2\'s val',
            'key' => 'value',
            },
        'key1' => 'value2\'s val',
        '2' => {
            '1' => '2',
            '3' => {
                '4' => '5',
                },
            },
        'key' => 'value',
    );
    
Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 8 Jun 2003 06:28:47 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Strange errors with huge hash
Message-Id: <bbul2v$kmf$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Uri Guttman:

>>>>>> "TvP" == Tassilo v Parseval <tassilo.parseval@rwth-aachen.de> writes:
> 
>  TvP> So even if he is reinventing the wheel: What is so wrong when the
>  TvP> OP asks why his reinvention doesn't work? He can naturally use
>  TvP> Data::Dumper and he is in fact advised to do so. Still, he has
>  TvP> provided some code (finally) and he'll surely benefit if a few
>       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                  
> 
>  TvP> regulars of this group have a look at it and make some
>  TvP> suggestions.
> 
> that says it all.

Hmmh, I can't quite follow you now. What does that say?

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 8 Jun 2003 21:02:31 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: Strange errors with huge hash
Message-Id: <bbuu03$dfn5u$1@ID-172104.news.dfncis.de>


"emcee" <res1uzbe@verizon.net> wrote in message
news:mMwEa.36649$iT.19254@nwrddc04.gnilink.net...
> > That code might be useful in the winter, since the cycles
> > may have the effect of keeping your feet warm, but it is summer(ish).
>
> What part exactly is so inefficent? I've looked through the Data::Dumper
> source, it seems no more efficent than my code.

Maybe, maybe not.  But at least Data::Dumper doesn't have bugs :-)




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

Date: Sun, 8 Jun 2003 21:06:13 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: Strange errors with huge hash
Message-Id: <bbuu71$dn9v8$1@ID-172104.news.dfncis.de>


"emcee" <res1uzbe@verizon.net> wrote in message
news:vwyEa.30499$JW6.30072@nwrddc02.gnilink.net...
> Uri Guttman wrote:
>
> >>>>>>"e" == emcee  <res1uzbe@verizon.net> writes:
> >
> >
> >
> >   e> Who said I was a beginner?  If it was so incredibly hard, and I was
> >   e> such a novice, I wouldn't have gotten anything that almost worked.
But
> >   e> I wrote it and it worked fine right from the first run, with the
> >   e> exception of this one situation, which wasn't an issue of me not
> >   e> grasping some concept or something, I just typed a couple of
commands
> >   e> in the wrong order.
> >
> >   e> I have now just used the module to store a hash with over 12,000
> >   e> entries each with 12 key/value pairs, and it worked fine.
> >
> > i saw many general errors in your code but since you know better i won't
> > correct them.
> >
> > and here is my version which is guaranteed to work with array refs,
> > circular data, all forms of scalar data, etc.
> >
> > use Data::Dumper ;
> >
> > print Dumper $ref_to_dumbass_large_hash ;
> >
> > exit ;
> >
> > uri
> >
>
> Alright fine, next time you need to save a hash, you can go ahead and
> use Data::Dumper, I will use my module because it meets the criteria:
>
> A: It does what I need it to do.

Then why are you asking for help to fix bugs?

> B: It's more efficent than the alternative.

Efficiency != accuracy




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

Date: Sat, 7 Jun 2003 23:22:21 -0500
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Unusual Can't load fail (web only)
Message-Id: <%RyEa.34451$NC4.135101@news1.mts.net>

"Sisyphus" <kalinabears@hdc.com.au> wrote in message
  news:3ee28abb$0$1218@echo-01.iinet.net.au...
> "Randy Kobes" <randy@theoryx5.uwinnipeg.ca> wrote
>
> > > Does that sound right, or am I on the wrong track?
> >
> > It might help if it's a problem in finding and loading shared
> > libraries
>
> I don't think that there's a problem in *finding* the shared libs. If
there
> was such a problem then the error message should start with
> "Can't locate loadable object..." , not "Can't load...".

I'm just guessing here, but if it was a problem in loading a
shared external library (not a Perl one), then one could get
a message about not being able to locate a loadable object ...
For example, (on Win32) I built XML::LibXML against a dynamic
libxml2 library, and if I hide that libxml2.dll (and keep all the Perl
files in place) and use XML::LibXML, then I get a message

Can't load '/Path/to/XML/LibXML/Common/Common.dll' for
module XML::LibXML::Common: load_file: The specified module
could not be found at /Path/to/Dynaloader.pm
at /Path/to/XML/LibXML.pm

You're right if it was a problem in finding a Perl lib - for example,
if I hide the Perl lib /Path/to/XML/LibXML/Common/Common.dll,
then trying to use XML::LibXML results in a message

Can't locate loadable object for module XML::LibXML::Common ...

best regards,
randy





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

Date: Sun, 8 Jun 2003 15:13:14 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Unusual Can't load fail (web only)
Message-Id: <3ee2c714$0$1208@echo-01.iinet.net.au>


"Randy Kobes" <randy@theoryx5.uwinnipeg.ca> wrote
> >
> > I don't think that there's a problem in *finding* the shared libs. If
> there
> > was such a problem then the error message should start with
> > "Can't locate loadable object..." , not "Can't load...".
>
> I'm just guessing here, but if it was a problem in loading a
> shared external library (not a Perl one), then one could get
> a message about not being able to locate a loadable object ...

I thought that would produce the complaint that the perl lib (which needs
that unfindable shared external library) could not be *loaded* - as per your
example immediately below.

> For example, (on Win32) I built XML::LibXML against a dynamic
> libxml2 library, and if I hide that libxml2.dll (and keep all the Perl
> files in place) and use XML::LibXML, then I get a message
>
> Can't load '/Path/to/XML/LibXML/Common/Common.dll' for
> module XML::LibXML::Common: load_file: The specified module
> could not be found at /Path/to/Dynaloader.pm
> at /Path/to/XML/LibXML.pm
>

Yep - I follow .... and agree.

> You're right if it was a problem in finding a Perl lib - for example,
> if I hide the Perl lib /Path/to/XML/LibXML/Common/Common.dll,
> then trying to use XML::LibXML results in a message
>
> Can't locate loadable object for module XML::LibXML::Common ...
>
> best regards,
> randy

I think I get your point .... but I don't quite follow the ( first part of
the) elaboration you provided :-)

I believe the error message is complaining that a perl lib, although found,
cannot be loaded.

I think you're saying the reason the perl lib cannot be loaded is (perhaps)
that a requisite external lib cannot be found. And that is quite correct,
afaik.
In such cases, on Win32, you'll get a popup telling you just which external
lib could not be found.

Alternatively the problem could be that the perl lib in question is in some
way unsuitable - as you've previously hinted. (The stuff about " undefined
symbol: PL_perl_destruct_level" seems to me to support this .... but the
fact that the there's no problem from the command line goes against it.)

I'm not a linux person ..... should probably just shut up :-)

Cheers,
Rob




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

Date: Sun, 8 Jun 2003 00:52:43 -0500
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Unusual Can't load fail (web only)
Message-Id: <JaAEa.34570$NC4.135355@news1.mts.net>

"Sisyphus" <kalinabears@hdc.com.au> wrote in message
  news:3ee2c714$0$1208@echo-01.iinet.net.au...
>
> "Randy Kobes" <randy@theoryx5.uwinnipeg.ca> wrote
> > >
> > > I don't think that there's a problem in *finding* the shared libs. If
> > there
> > > was such a problem then the error message should start with
> > > "Can't locate loadable object..." , not "Can't load...".
> >
> > I'm just guessing here, but if it was a problem in loading a
> > shared external library (not a Perl one), then one could get
> > a message about not being able to locate a loadable object ...
>
> I thought that would produce the complaint that the perl lib (which needs
> that unfindable shared external library) could not be *loaded* - as per
your
> example immediately below.

You're right - sorry about that; that should have read that one
would get a message about something that cannot be loaded,
in the case of an unfindable shared external lib.
[ .. ]
> I think you're saying the reason the perl lib cannot be loaded is
(perhaps)
> that a requisite external lib cannot be found. And that is quite correct,
> afaik. In such cases, on Win32, you'll get a popup telling you just
> which external lib could not be found.
>
> Alternatively the problem could be that the perl lib in question is in
some
> way unsuitable - as you've previously hinted. (The stuff about " undefined
> symbol: PL_perl_destruct_level" seems to me to support this .... but the
> fact that the there's no problem from the command line goes against it.)

As you're well aware of in the Win32 world :), it can be tricky mixing
and matching binaries (in this case, from rpms). From what I understand,
Mike, the original poster, built DBD::mysql himself, and the script
ran fine from the command line, but not from the web. This may be
due to the web environment not seeing some external libraries that
the command-line environment sees. It might also be that the web
version is using an older DBD::mysql from the Perl rpm - the error
referenced /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/,
whereas CPAN.pm might have installed things under something like
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/.

best regards,
randy





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

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.  

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


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