[29151] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 395 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 1 18:10:55 2007

Date: Tue, 1 May 2007 15:09:26 -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           Tue, 1 May 2007     Volume: 11 Number: 395

Today's topics:
    Re: Access hash of hashes element problem. <justin.0704@purestblue.com>
    Re: Access hash of hashes element problem. <someone@example.com>
    Re: Access hash of hashes element problem. <someone@example.com>
    Re: Access hash of hashes element problem. (Alan Curry)
    Re: Access hash of hashes element problem. <mgjv@tradingpost.com.au>
        capturing STDOUT from and piped "into" program <tbrazil@perforce.com>
    Re: capturing STDOUT from and piped "into" program <mritty@gmail.com>
    Re: capturing STDOUT from and piped "into" program xhoster@gmail.com
    Re: FAQ 4.46 How do I handle linked lists? <bik.mido@tiscalinet.it>
    Re: FAQ 4.51 How do I permute N elements of a list? <bik.mido@tiscalinet.it>
    Re: How to retrieve the Perl script returned value in C <needpassion@gmail.com>
        Install Mail::RBL failed in CPAN, how to fix it? <needpassion@gmail.com>
    Re: PERL OOP newbie question: What is the best way to h lovellj@mcmaster.ca
    Re: Perl threads in Object Oriented code xhoster@gmail.com
    Re: Sockets xhoster@gmail.com
    Re: Sockets <mgjv@tradingpost.com.au>
    Re: system call - how-to. <elsiddik@gmail.com>
    Re: using split to extract characters <purlgurl@purlgurl.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 01 May 2007 19:49:46 -0000
From: Justin C <justin.0704@purestblue.com>
Subject: Re: Access hash of hashes element problem.
Message-Id: <slrnf3f6es.1c8.justin.0704@satori.local>

In article <CNKZh.7221$j63.3948@newsread2.news.pas.earthlink.net>, Mumia W. wrote:
> On 05/01/2007 10:39 AM, Justin C wrote:
>> I can't seem to access the values in a hash of hashes, but if I iterate
>> over it I'm able to print all the values. The error I get if I try to
>> access one value is :
>> Use of uninitialized value in print at ./test line 20, <PRICES> line 62.
>> [...]
> 
> Your program is so close to working, but you have one problem--you 
> forgot that hash keys are strings and only strings. Where string 
> comparisons are concerned, '5' != '5.0'. Change $weight (at the top of 
> the program) to "5.0" and rerun your program.

Hash keys are strings! Of course! Thank you for pointing this out, I'd
been staring at it for hours and just could not see it.


> However, it's better to create the hash keys as simpler numbers, e.g. 
> insert 5 rather than 5.0:
> 
> $priceHash{$kg+0}{$_} = shift @prices;

I don't understand what's going on here. $kg is a string, the string is
"5.0", yet "$kg+0" removes ".0". Please tell me what's going on, it's
confusing and my brain is already a little bruised from today's work!


> This causes a warning about "per" which has some function in your data 
> that I don't know about.

Ah, yes, I need to skip that line too, I'll fix my script to ignore it.


> I also have two minor nickpicks: "open" is misspelled in the die() 
> statement,

That *is* a nit pick!
 

> and the PRICES file is never explicitly closed by program. 

I'm sure I read here that file-handles are closed automatically when
they go out of scope, I've not bothered closing a file since. Is this
bad?


> You also do a little more work than is necessary to read in the data.

I know, I don't do anywhere near enough perl to be proficient, though I
am trying!


> This is a shorter version of your program:
[snip]

Lots of better ways of doing things. Thank you for pointing them out.

	Justin.

-- 
Justin C, by the sea.


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

Date: Tue, 01 May 2007 20:42:05 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Access hash of hashes element problem.
Message-Id: <xCNZh.10214$Dq6.3967@edtnps82>

Jens Thoms Toerring wrote:
> 
> Your problem is that you use floating point numbers as hash keys
> and rely on some automatic conversion between strings and floating
> point values.
> 
> In this line
> 
>       $priceHash{$kg}{$_} = shift @prices ;
> 
> '$kg' will be a floating point number you just read from the file.
> This could be e.g. "5.0" within the file but since floating point
> numbers only have a limited precision the key in the hash could
> actually be 4.9999999999 or 5.000000000001 or something similar.
> So you end up with an element that has a key of e.g. 4.9999999999
> and that, of course, won't be found when you look for an element
> by the number 5 as the key.

No, that is not correct.  The data is read from the file and stored in Perl's
scalars as strings and is not converted to a floating point number because it
is not used in any mathematical operations.


John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall


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

Date: Tue, 01 May 2007 20:50:55 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Access hash of hashes element problem.
Message-Id: <PKNZh.10216$Dq6.8764@edtnps82>

Mumia W. wrote:
> On 05/01/2007 10:39 AM, Justin C wrote:
>> I can't seem to access the values in a hash of hashes, but if I iterate
>> over it I'm able to print all the values. The error I get if I try to
>> access one value is :
>> Use of uninitialized value in print at ./test line 20, <PRICES> line 62.
>> [...]
> 
> Your program is so close to working, but you have one problem--you
> forgot that hash keys are strings and only strings. Where string
> comparisons are concerned, '5' != '5.0'. Change $weight (at the top of
> the program) to "5.0" and rerun your program.
> 
> However, it's better to create the hash keys as simpler numbers, e.g.
> insert 5 rather than 5.0:
> 
> $priceHash{$kg+0}{$_} = shift @prices;
> 
> This causes a warning about "per" which has some function in your data
> that I don't know about.
> 
> I also have two minor nickpicks: "open" is misspelled in the die()
> statement, and the PRICES file is never explicitly closed by program.
> You also do a little more work than is necessary to read in the data.
> 
> This is a shorter version of your program:
> 
>     use strict;
>     use warnings;
>     use File::Slurp;
> 
>     my %priceHash;
>     my $weight = 5;
>     my $zone = 5;
> 
>     my @lines = read_file('pforcePrices.csv');
>     s/\cM\cJ$// for @lines;
> 
>     my $header = shift @lines;
>     $header =~ s/(zone|\s+|^,)//ig;
>     my @zones = split /,/,$header;
> 
>     foreach my $line (@lines) {
>         next unless $line =~ /^\d/;
>         my @prices = split /,/,$line;
>         my $kg = shift @prices;
>         foreach my $zn (@zones) {
>             $priceHash{$kg+0}{$zn} = shift @prices;
>         }
>     }
> 
>     print "Price: $priceHash{$weight}{$zone}\n";

I'd do it more like this instead:   :-)

open my $PRICES, '<', 'pforcePrices.csv'
    or die "Cannot open 'pforcePrices.csv' $!";

( my $header = <$PRICES> ) =~ s/\s+\z//;
my ( undef, @zones ) = map { s/\s*zone\s*//i; $_ } split /,/ , $header;

my %priceHash;
while ( <$PRICES> ) {
    s/\s+\z//;
    my ( $kg, @prices ) = split /,/;
    @{ $priceHash{ $kg } }{ @zones } = @prices;
    }




John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall


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

Date: Tue, 1 May 2007 21:33:12 +0000 (UTC)
From: pacman@TheWorld.com (Alan Curry)
Subject: Re: Access hash of hashes element problem.
Message-Id: <f18bmo$3q8$1@pcls6.std.com>

In article <slrnf3f6es.1c8.justin.0704@satori.local>,
Justin C  <justin.news@purestblue.com> wrote:
>In article <CNKZh.7221$j63.3948@newsread2.news.pas.earthlink.net>, Mumia
>W. wrote:
>> 
>> $priceHash{$kg+0}{$_} = shift @prices;
>
>I don't understand what's going on here. $kg is a string, the string is
>"5.0", yet "$kg+0" removes ".0". Please tell me what's going on, it's
>confusing and my brain is already a little bruised from today's work!

The + operator doesn't work on strings. It works on numbers. To enable the
addition operator to work, the string "5.0" had to be converted to a number
first. Then 0 was added and the result was a numeric 5.0, which was converted
back to a string to be used as a hash key. The conversion from number to
string doesn't give trailing zeros.

-- 
Alan Curry
pacman@world.std.com


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

Date: Wed, 2 May 2007 07:29:06 +1000
From: Martien verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Access hash of hashes element problem.
Message-Id: <slrnf3fc92.bob.mgjv@martien.heliotrope.home>

On Tue, 01 May 2007 19:49:46 -0000,
	Justin C <justin.0704@purestblue.com> wrote:
> In article <CNKZh.7221$j63.3948@newsread2.news.pas.earthlink.net>, Mumia W. wrote:
>> On 05/01/2007 10:39 AM, Justin C wrote:

>> However, it's better to create the hash keys as simpler numbers, e.g. 
>> insert 5 rather than 5.0:
>> 
>> $priceHash{$kg+0}{$_} = shift @prices;
>
> I don't understand what's going on here. $kg is a string, the string is
> "5.0", yet "$kg+0" removes ".0". Please tell me what's going on, it's
> confusing and my brain is already a little bruised from today's work!

$kg + 0 is an arithmetic expression, which perl calculates. The result
of it is a number (not a string). That number happens to be 5. The
number then gets stringified, because it is used as a hash key, and the
result is "5". There is a lot of stuff going on behind the scenes, which
has to do with the way Perl's scalars can represent all these different
things like strings, integers, doubles, references, etc.

Watch:

$ perl -w      
my $a1 = 5.0;
my $a2 = "5.0";
print "$a1 $a2\n";
$a2 += 0;
print "$a1 $a2\n";
__END__
5 5.0
5 5

Generally, if you want numbers to be stringified in a particular format
you should use (s)printf.

Martien
-- 
                        | 
Martien Verbruggen      | We are born naked, wet and hungry. Then
                        | things get worse.
                        | 


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

Date: 1 May 2007 13:33:06 -0700
From: Tim <tbrazil@perforce.com>
Subject: capturing STDOUT from and piped "into" program
Message-Id: <1178051586.669258.305350@q75g2000hsh.googlegroups.com>

Hi

I've read a lot good info on this list about capturing STDOUT but I'm
still having a problems grasping it. I think I'm missing something. I
am trying to capture the output from the "$p4 $spectype -i" command
and place it in a $scalar. I know I can't redirect directly into a
scalar.

        open(FULLSPEC,"|$p4 $spectype -i");
        print FULLSPEC @fullspec;
        close(FULLSPEC);

Can someone please show me an example on how I can directly place the
output of the above example into a scalar variable?


Up to now I've cludged it by placing the output into a file and then
reading it however it's ugly.

        open(FULLSPEC,"|$p4 $spectype -i > $outfile");
        print FULLSPEC @fullspec;
        close(FULLSPEC);

        open(OUTPUT,"<$outfile");
        $specout = <OUTPUT>;
        close(OUTPUT);
        chomp($specout);
        unlink($outfile);
        return $specout;



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

Date: 1 May 2007 14:35:06 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: capturing STDOUT from and piped "into" program
Message-Id: <1178055305.999937.210860@c35g2000hsg.googlegroups.com>

On May 1, 4:33 pm, Tim <tbra...@perforce.com> wrote:
> Hi
>
> I've read a lot good info on this list about capturing STDOUT but I'm
> still having a problems grasping it. I think I'm missing something. I
> am trying to capture the output from the "$p4 $spectype -i" command
> and place it in a $scalar. I know I can't redirect directly into a
> scalar.
>
>         open(FULLSPEC,"|$p4 $spectype -i");
>         print FULLSPEC @fullspec;
>         close(FULLSPEC);
>
> Can someone please show me an example on how I can directly place the
> output of the above example into a scalar variable?
>
> Up to now I've cludged it by placing the output into a file and then
> reading it however it's ugly.
>
>         open(FULLSPEC,"|$p4 $spectype -i > $outfile");
>         print FULLSPEC @fullspec;
>         close(FULLSPEC);
>
>         open(OUTPUT,"<$outfile");
>         $specout = <OUTPUT>;
>         close(OUTPUT);
>         chomp($specout);
>         unlink($outfile);
>         return $specout;

perldoc -q pipe
Found in /software/perl-5.8.5-0/pkg/lib/5.8.5/pod/perlfaq8.pod
     How can I open a pipe both to and from a command?

http://perldoc.perl.org/IPC/Open2.html

[untested]
use IPC::Open2;
my $pid = open2(my $read_fh, my $write_fh, "$p4 $spectype -i");
print $write_fh @fullspec;
my $specout = do { local $/; <$read_fh> };

Hope this helps,
Paul Lalli



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

Date: 01 May 2007 21:48:32 GMT
From: xhoster@gmail.com
Subject: Re: capturing STDOUT from and piped "into" program
Message-Id: <20070501174835.570$fA@newsreader.com>

Tim <tbrazil@perforce.com> wrote:
> Hi
>
> I've read a lot good info on this list about capturing STDOUT but I'm
> still having a problems grasping it. I think I'm missing something. I
> am trying to capture the output from the "$p4 $spectype -i" command
> and place it in a $scalar. I know I can't redirect directly into a
> scalar.
>
>         open(FULLSPEC,"|$p4 $spectype -i");
>         print FULLSPEC @fullspec;
>         close(FULLSPEC);

One possibility, depending on what kinds of characters can exist in
@fullspec, would be:

my $output = `echo '@fullspec'|$p4 $spectype -i`;

For portability and also for safety (WRT weird characters in @fullspec) you
could use IPC::Open2, but you have to be careful to handle buffering to
avoid deadlock.  Deadlock should not be a problem either if $p4 reads all
of the input before generating any output, or if join (" ", @fullspec) is
small. On many systems, small means less than 4096 bytes.

Perhaps a better answer would be IPC::Run:

my ($out,$err);
my $in=join " ", @fullspec;

IPC::Run::run([$p4, $spectype, '-i'],\$in,\$out,\$err) or die $!;

print $out;

Xho

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


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

Date: Tue, 01 May 2007 23:44:50 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 4.46 How do I handle linked lists?
Message-Id: <p2df33d302rnj8g1o6eujbp07lk54jagdl@4ax.com>

On 1 May 2007 05:21:22 -0700, Brad Baxter <baxter.brad@gmail.com>
wrote:

>s/Both pop and shift are both/Both pop and shift are/;

s/(?<=Both pop and shift are) both//;


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: Tue, 01 May 2007 23:46:53 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 4.51 How do I permute N elements of a list?
Message-Id: <u9df33hhhtjgrqa8sjaeuccj5aqde5jpri@4ax.com>

On Tue, 01 May 2007 09:33:43 -0700, Jim Gibson
<jgibson@mail.arc.nasa.gov> wrote:

>It is probably better to go to the source than ask here:
>
><http://www-cs-faculty.stanford.edu/~knuth/>

But don't ask by email:

http://www-cs-faculty.stanford.edu/~knuth/email.html


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: 1 May 2007 13:27:56 -0700
From: mike <needpassion@gmail.com>
Subject: Re: How to retrieve the Perl script returned value in C program? Many thanks
Message-Id: <1178051276.051227.294840@n76g2000hsh.googlegroups.com>

Thanks a lot for all you guys suggestion.



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

Date: 1 May 2007 13:31:36 -0700
From: mike <needpassion@gmail.com>
Subject: Install Mail::RBL failed in CPAN, how to fix it?
Message-Id: <1178051496.951718.185360@o5g2000hsb.googlegroups.com>

I tried to install Mail::RBL in CPAN, and got many errors. After I
installed it forcedly, I still got many errors, and the RBL pack
doesn't work properly. Any ideas would be appreciated.

Here is the test Perl script, and it always says that any IP or
domains are in the RBL list.
====================================================================

#!/usr/bin/perl

use Mail::RBL;

$spam_org = 'spamhouse.org';
my $list = new Mail::RBL($spam_org);
if ($list->check($ARGV[0])) {
        print "$ARGV[0] is in the RBL of $spam_org!\n";
}
else {
        print "$ARGV[0] is fine.\n";
}


Following is the output in CPAN:
====================================================================

cpan> test Mail::RBL
Running test for module Mail::RBL
Running make for L/LU/LUISMUNOZ/Mail-RBL-1.09.tar.gz
  Is already unwrapped into directory /root/.cpan/build/Mail-RBL-1.09
  Has already been processed within this session
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load....ok
t/10-rbl.....#
#
# The following tests perform queries to some known RBLs.
# Failures do not necesarily mean that the code is broken
# If failures are seen, please insure that the relevant RBL
# Can be queried from this machine.
#
# You can skip this test by setting the environment variable
# $SKIP_RBL_TESTS to true
#
t/10-rbl.....NOK 4#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 7/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 11/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 15/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 19/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 23/95#     Failed test (t/10-rbl.t at line 75)
#     Failed test (t/10-rbl.t at line 76)
t/10-rbl.....ok 33/95#     Failed test (t/10-rbl.t at line 95)
t/10-rbl.....NOK 35#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 38#     Failed test (t/10-rbl.t at line 105)
t/10-rbl.....NOK 39#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....ok 49/95#     Failed test (t/10-rbl.t at line 95)
t/10-rbl.....NOK 50#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 54#     Failed test (t/10-rbl.t at line 105)
#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....NOK 66#     Failed test (t/10-rbl.t at line 95)
t/10-rbl.....NOK 67#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 70#     Failed test (t/10-rbl.t at line 105)
t/10-rbl.....NOK 71#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....NOK 82#     Failed test (t/10-rbl.t at line 95)
#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 86#     Failed test (t/10-rbl.t at line 105)
t/10-rbl.....NOK 87#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....ok 95/95# Looks like you failed 23 tests of 95.
t/10-rbl.....dubious
        Test returned status 23 (wstat 5888, 0x1700)
DIED. FAILED tests 4, 8, 12, 16, 20, 24-25, 34-35, 38-39, 50-51,
54-55, 66-67, 70-71, 82-83, 86-87
        Failed 23/95 tests, 75.79% okay
Failed Test Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/10-rbl.t    23  5888    95   23  24.21%  4 8 12 16 20 24-25 34-35
38-39 50-51
                                           54-55 66-67 70-71 82-83
86-87
Failed 1/2 test scripts, 50.00% okay. 23/96 subtests failed, 76.04%
okay.
make: *** [test_dynamic] Error 2
  /usr/bin/make test -- NOT OK

cpan>
cpan> force install Mail::RBL
Running install for module Mail::RBL
Running make for L/LU/LUISMUNOZ/Mail-RBL-1.09.tar.gz
Checksum for /root/.cpan/sources/authors/id/L/LU/LUISMUNOZ/Mail-
RBL-1.09.tar.gz ok
Mail-RBL-1.09/
Mail-RBL-1.09/Makefile.PL
Mail-RBL-1.09/MANIFEST
Mail-RBL-1.09/MANIFEST.SKIP
Mail-RBL-1.09/META.yml
Mail-RBL-1.09/RBL.pm
Mail-RBL-1.09/README
Mail-RBL-1.09/t/
Mail-RBL-1.09/t/00-load.t
Mail-RBL-1.09/t/10-rbl.t
Removing previously used /root/.cpan/build/Mail-RBL-1.09

  CPAN.pm: Going to build L/LU/LUISMUNOZ/Mail-RBL-1.09.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Mail::RBL
cp RBL.pm blib/lib/Mail/RBL.pm
Manifying blib/man3/Mail::RBL.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load....ok
t/10-rbl.....#
#
# The following tests perform queries to some known RBLs.
# Failures do not necesarily mean that the code is broken
# If failures are seen, please insure that the relevant RBL
# Can be queried from this machine.
#
# You can skip this test by setting the environment variable
# $SKIP_RBL_TESTS to true
#
t/10-rbl.....NOK 4#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 7/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 11/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 15/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 19/95#     Failed test (t/10-rbl.t at line 60)
t/10-rbl.....ok 23/95#     Failed test (t/10-rbl.t at line 75)
#     Failed test (t/10-rbl.t at line 76)
t/10-rbl.....NOK 34#     Failed test (t/10-rbl.t at line 95)
t/10-rbl.....NOK 35#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 38#     Failed test (t/10-rbl.t at line 105)
t/10-rbl.....NOK 39#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....ok 49/95#     Failed test (t/10-rbl.t at line 95)
t/10-rbl.....NOK 50#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 54#     Failed test (t/10-rbl.t at line 105)
#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....NOK 66#     Failed test (t/10-rbl.t at line 95)
#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....NOK 70#     Failed test (t/10-rbl.t at line 105)
t/10-rbl.....NOK 71#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....ok 81/95#     Failed test (t/10-rbl.t at line 95)
t/10-rbl.....NOK 82#     Failed test (t/10-rbl.t at line 97)
t/10-rbl.....ok 85/95#     Failed test (t/10-rbl.t at line 105)
t/10-rbl.....NOK 86#     Failed test (t/10-rbl.t at line 107)
t/10-rbl.....ok 92/95# Looks like you failed 23 tests of 95.
t/10-rbl.....dubious
        Test returned status 23 (wstat 5888, 0x1700)
DIED. FAILED tests 4, 8, 12, 16, 20, 24-25, 34-35, 38-39, 50-51,
54-55, 66-67, 70-71, 82-83, 86-87
        Failed 23/95 tests, 75.79% okay
Failed Test Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/10-rbl.t    23  5888    95   23  24.21%  4 8 12 16 20 24-25 34-35
38-39 50-51
                                           54-55 66-67 70-71 82-83
86-87
Failed 1/2 test scripts, 50.00% okay. 23/96 subtests failed, 76.04%
okay.
make: *** [test_dynamic] Error 2
  /usr/bin/make test -- NOT OK
Running make install
Writing /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/
Mail/RBL/.packlist
Appending installation info to /usr/lib/perl5/5.8.6/i386-linux-thread-
multi/perllocal.pod
  /usr/bin/make install  -- OK

cpan>



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

Date: 1 May 2007 13:51:25 -0700
From: lovellj@mcmaster.ca
Subject: Re: PERL OOP newbie question: What is the best way to handle array data?
Message-Id: <1178052685.660992.104660@n59g2000hsh.googlegroups.com>

On May 1, 6:28 am, Paul Lalli <mri...@gmail.com> wrote:

> I strongly suggest you have a read of:
> perldoc perlreftut
> perldoc perllol
> perldoc perldsc
> perldoc perlref
> (in that order)

Thanks very much.
Jon




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

Date: 01 May 2007 17:42:19 GMT
From: xhoster@gmail.com
Subject: Re: Perl threads in Object Oriented code
Message-Id: <20070501134220.921$Ia@newsreader.com>

Eric <ecarlson@vmware.com> wrote:
> xhoster@gmail.com wrote:
> > >
> > > Attempt to free unreferenced scalar: SV 0xafc2db8, Perl interpreter:
> > > 0xaa069a0 at <file> <line>
> >
> > What version of Perl are you using?  I've seen things like that in
> > some of the early 5.8.x perls that went away in the some of the later
> > ones.
> >
> > Xho
>
> I'm using:
>
> $ perl -v
>
> This is perl, v5.8.0 built for i386-linux-thread-multi
> (with 1 registered patch, see perl -V for more detail)

If you want to use threads, you should definitely upgrade.  v5.8.0 did
all kinds of misbehavior under threading.

Xho

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


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

Date: 01 May 2007 17:39:49 GMT
From: xhoster@gmail.com
Subject: Re: Sockets
Message-Id: <20070501133950.919$p9@newsreader.com>

Monty <dale.schmitz@offutt.af.mil> wrote:
> >But I suspect you will find it less confusing to just accept
> > that IO::Select is what it is
>
> So what is it?

A block-box object which behaves the way its docs says it behaves, mostly.

Xho

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


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

Date: Wed, 2 May 2007 07:21:07 +1000
From: Martien verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Sockets
Message-Id: <slrnf3fbq3.bob.mgjv@martien.heliotrope.home>

On 1 May 2007 09:59:06 -0700,
	Monty <dale.schmitz@offutt.af.mil> wrote:
>>But I suspect you will find it less confusing to just accept
>> that IO::Select is what it is
>
> So what is it?

It is mainly an IO::Select object, i.e. you use it in accordance with
the IO::Select documentation, generally by calling methods on it.

It is also a reference blessed into the IO::Select class, but that's
just the way perl implements OO.

What it is a reference to (and that may very well be an array, but more
commonly a hash is used) is not important, unless you have to modify the
code of IO::Select itself. Actually, I just checked, and IO::Select
objects are indeed references to arrays, but again, it doesn't matter. 

One of the points of OO classes is to encapsulate and hide the
implementation from the user of the class. It should never be necessary
to need to know what exactly underlies the implementation.

If you want to know, however, a quick look at the code is often the best
way to find out. I used perldoc -m IO::Select to check.

Martien
-- 
                        | 
Martien Verbruggen      | Blessed are the Fundamentalists, for they
                        | shall inhibit the earth.
                        | 


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

Date: 1 May 2007 14:30:26 -0700
From: elsiddik <elsiddik@gmail.com>
Subject: Re: system call - how-to.
Message-Id: <1178055026.306958.105340@p77g2000hsh.googlegroups.com>

On May 2, 3:12 am, Paul Lalli <mri...@gmail.com> wrote:
> > > On May 1, 7:22 am, elsiddik <elsid...@gmail.com> wrote:
>
> > > > perl -e "system qw (whatis /usr/bin/*)"
>
> > > > but its not giving me the same whatislog - what am i doing wrong ?
>
> > > You are using the qw operator.  This operator takes a space-separated
> > > list of barewords and returns a quoted list of words.  That is, your
> > > system() call is equivalent to:
> > > system('whatis', '/usr/bin/*');
>
> > > Change your qw() to qq() or q(), and read up on `perldoc -f system`
> > > for more information.
> > well i tried running the code with q and qq but im still getting the
> > same output --
>
> I don't believe you.  Please post a short-but-complete script that
> demonstrates this, like so:
>
> $ perl -e'system qq(whatis /usr/bin/*)'
> acctcom         acctcom (1)     - search and print process accounting
> files
> activation-client               activation-client ()    - bonobo-
> activationdebugging tool
> adb             adb (1)         - general-purpose debugger
> <remainder snipped>
>
> > the part that i cant understand is when you run the shell script - i
> > could see all the /usr/bin/files output with <whatis> details ,
> > with perls everything looks quiet good also but instead of the
> > <whatis> details - keeps giving me /usr/bin/filename: nothing
> > appropriate.
>
> Again, post a short-but-complete script that generates this output.
>
> > i even tried to write a perl script - used File::Basename
>
> I have no idea what you think File::Basename has to do with this.
>
> > <code>
>
> > #!/usr/bin/perl -w
>
> > use strict;
> > use warnings;
>
> > use File::Basename;
>
> > my $path  = "/usr/bin/";
> > my $files = basename($path);
> > my $dir   = dirname($path);
>
> I still have no idea what you think File::Basename has to do with
> this.
>
> > print "dir is $dir , files is $files\n";
>
> Didn't that output tell you you're doing something very wrong?  It
> should have claimed that $dir is /usr and $files is the empty string.
>
> > system "whatis $path";
>
> Now you're just calling whatis on "/usr/bin/", rather than on all the
> files in /usr/bin.  Why did you omit the * this time?
>
> Paul Lalli


i could solve it with :
perl -e 'chdir (shift || "/usr/bin"); system whatis => <*>'

thx anyway guys

zaher elsiddik
http;//elsiddik.blogspot.com/



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

Date: Tue, 01 May 2007 11:05:25 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: using split to extract characters
Message-Id: <9eudnSMGvaHMHKrbnZ2dnUVZ_oipnZ2d@giganews.com>

zenny lenny wrote:

(snipped)

> extract the center 3 characters from this data.  The text xyz and abc
> do not change:

> xyz3r4abc
> xyzm9zabc
> xyzuukabc

#!perl

while (<DATA>)
  { print substr ($_, 3, 3), "\n"; }


__DATA__
xyz3r4abc
xyzm9zabc
xyzuukabc


PRINTED RESULTS:

3r4
m9z
uuk


Purl Gurl


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

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


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