[32686] in Perl-Users-Digest
Perl-Users Digest, Issue: 3833 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 3 14:55:53 2013
Date: Sat, 8 Dec 2012 02:17:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 8 Dec 2012 Volume: 11 Number: 3833
Today's topics:
\my myphplists@yahoo.com
Re: \my <ben@morrow.me.uk>
Re: How to print function with the code in the function <glex_no-spam@qwest-spam-no.invalid>
Need porting of Wotan Supercomputer AI into Perl <mentifex@myuw.net>
Re: Need porting of Wotan Supercomputer AI into Perl <bugbear@trim_papermule.co.uk_trim>
perl 10^9 long strings of packed floats, getting 'panic pkoniusz@gmail.com
Re: perl 10^9 long strings of packed floats, getting 'p <ben@morrow.me.uk>
terminating fifo in perl <pengyu.ut@gmail.com>
Re: terminating fifo in perl <ben@morrow.me.uk>
Why 'z'..'a' is not empty? <pengyu.ut@gmail.com>
Re: Why 'z'..'a' is not empty? <ben@morrow.me.uk>
Re: Why 'z'..'a' is not empty? <derykus@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 7 Dec 2012 08:31:07 -0800 (PST)
From: myphplists@yahoo.com
Subject: \my
Message-Id: <d82d3fdc-a6bc-4697-941d-2c8c74ef5238@jj5g2000pbc.googlegroups.com>
I'm reading about tie in the camel book and came across this.
sub TIESCALAR { bless \my $self, shift }
Why is my escaped?
------------------------------
Date: Fri, 7 Dec 2012 16:40:34 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: \my
Message-Id: <2pi9p9-k851.ln1@anubis.morrow.me.uk>
Quoth myphplists@yahoo.com:
> I'm reading about tie in the camel book and came across this.
>
> sub TIESCALAR { bless \my $self, shift }
>
> Why is my escaped?
\ is the 'take a reference' operator (which I assume you understand
already, if you're reading about tie). This sub is equivalent to
sub TIESCALAR {
my $self;
bless \$self, shift;
}
Ben
------------------------------
Date: Thu, 06 Dec 2012 10:34:54 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: How to print function with the code in the function body?
Message-Id: <50c0c92e$0$9078$815e3792@news.qwest.net>
On 12/05/12 09:36, Peng Yu wrote:
> Hi,
>
> I try to use Dumper to print a hash which has a function ref as one of
> its value. But I only can get "sub { "DUMMY" }", which is not helpful
> for me to know what this function is. Is there a way to somehow print
> the function body?
[...]
See the $Data::Dumper::Deparse variable in the
Data::Dumper documentation.
------------------------------
Date: Thu, 6 Dec 2012 10:42:39 -0800 (PST)
From: Mentifex <mentifex@myuw.net>
Subject: Need porting of Wotan Supercomputer AI into Perl
Message-Id: <20bec359-2785-47bb-8a1b-0895db04ce40@vy11g2000pbb.googlegroups.com>
Which will come first, the Singularity or
http://en.wikipedia.org/wiki/Perl_6 ?
Wotan, the German AI Mind for 64-bit Linux
supercomputers, needs porting into Perl for
purposes of residing like an octopus on
central hubs of Web traffic and AI awakening.
http://www.scn.org/~mentifex/DeKi.txt
is the source code in Forth pre-perl.
There are no funds available for payment but
mega kudos will accrue to the successful Perl
programmer who creates the True AI Perlmind
based on the various other AI Minds such as
http://www.scn.org/~mentifex/AiMind.html
in English over JavaScript and the Russian
http://www.scn.org/~mentifex/Dushka.html
also in JavaScript.
Mentifex (Arthur)
--
http://mind.sourceforge.net/perl.html
http://www.listbox.com/subscribe/?list_id=303
http://www.cpan.org/authors/id/M/ME/MENTIFEX/mind.txt
http://www.amazon.com/The-Art-Meme-ebook/dp/B007ZI66FS
------------------------------
Date: Fri, 07 Dec 2012 09:35:18 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Need porting of Wotan Supercomputer AI into Perl
Message-Id: <EMSdnX2E8rrLJVzNnZ2dnUVZ8sWdnZ2d@brightview.co.uk>
Mentifex wrote:
> Which will come first, the Singularity or
> http://en.wikipedia.org/wiki/Perl_6 ?
>
> Wotan, the German AI Mind for 64-bit Linux
> supercomputers, needs porting into Perl for
> purposes of residing like an octopus on
> central hubs of Web traffic and AI awakening.
> http://www.scn.org/~mentifex/DeKi.txt
> is the source code in Forth pre-perl.
The java port you asked for isn't enough?!
BugBear
------------------------------
Date: Thu, 6 Dec 2012 17:14:01 -0800 (PST)
From: pkoniusz@gmail.com
Subject: perl 10^9 long strings of packed floats, getting 'panic: memory wrap' that didn't use to happen before
Message-Id: <20186a1d-f317-481e-9185-5c59d740810f@googlegroups.com>
Dear all.
I've had a simple way of creating array of floats:
my $xfArray=((pack "f1", 0.0) x $nSize);
I was able to create up to 10^9 long arrays of floats and pass them to perl inline c for further processing.
One beautiful day, I started getting message:
panic: memory wrap at prepare_chisqr_fastG3.pl line 917.
I thought this is due to fragmented memory on servers as some of them aren't rising this error. Then I tried ordinary MALLOC in C which was able always allocate the desired amount of memory.
My question is what could have happened? I've been trying to allocate less than 10% of overall RAM available on my machine (148GB RAM) ... It works with MALLOC, does not with the above code any more ...
This is the version of perl used:
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
Any sugestions?
Bests,
P.
------------------------------
Date: Fri, 7 Dec 2012 02:58:27 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: perl 10^9 long strings of packed floats, getting 'panic: memory wrap' that didn't use to happen before
Message-Id: <jj28p9-r0s.ln1@anubis.morrow.me.uk>
Quoth pkoniusz@gmail.com:
>
> I've had a simple way of creating array of floats:
> my $xfArray=((pack "f1", 0.0) x $nSize);
>
> I was able to create up to 10^9 long arrays of floats and pass them to
> perl inline c for further processing.
>
> One beautiful day, I started getting message:
> panic: memory wrap at prepare_chisqr_fastG3.pl line 917.
>
> I thought this is due to fragmented memory on servers as some of them
> aren't rising this error. Then I tried ordinary MALLOC in C which was
> able always allocate the desired amount of memory.
>
> My question is what could have happened? I've been trying to allocate
> less than 10% of overall RAM available on my machine (148GB RAM) ... It
> works with MALLOC, does not with the above code any more ...
Are you able to get a backtrace? Ideally from a perl built with
-DDEBUGGING, but if not you should at least be able to get function
names.
Ben
------------------------------
Date: Thu, 6 Dec 2012 13:30:14 -0800 (PST)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: terminating fifo in perl
Message-Id: <7ce2ee1c-f4d3-4897-b7d3-127077d4f084@vb8g2000pbb.googlegroups.com>
Hi,
Calling main.sh will hang. I think that this is related with the fifo.
Does anybody know a way to make the code finish without hanging?
Thanks!
~/linux/bin/xplat/src/coreutils/backup/headbody/perl/fifo/main$ cat
main.sh
#!/usr/bin/env bash
rm -rf head body
mkfifo head body
seq 10 | ../headbody.pl head body &
cat head body &
wait
~/linux/bin/xplat/src/coreutils/backup/headbody/perl/fifo/main$ cat ../
headbody.pl
#!/usr/bin/env perl
use strict;
use warnings;
#use FindBin;
#use lib "$FindBin::Bin/.";
open(HEAD, '>', $ARGV[0]) or die "cannot to open $ARGV[0] $!";
open(BODY, '>', $ARGV[1]) or die "cannot to open $ARGV[0] $!";
my $head = <STDIN>;
print HEAD $head;
close(HEAD) or die "cannot to close $ARGV[0] $!";
print STDERR "head";
while(<STDIN>) {
print BODY;
}
close(BODY) or die "cannot to close $ARGV[1] $!";
print STDERR "body";
--
Regards,
Peng
------------------------------
Date: Thu, 6 Dec 2012 22:13:30 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: terminating fifo in perl
Message-Id: <ath7p9-7vo.ln1@anubis.morrow.me.uk>
Quoth Peng Yu <pengyu.ut@gmail.com>:
>
> Calling main.sh will hang. I think that this is related with the fifo.
> Does anybody know a way to make the code finish without hanging?
> Thanks!
>
> ~/linux/bin/xplat/src/coreutils/backup/headbody/perl/fifo/main$ cat
> main.sh
> #!/usr/bin/env bash
>
> rm -rf head body
> mkfifo head body
> seq 10 | ../headbody.pl head body &
> cat head body &
> wait
>
> ~/linux/bin/xplat/src/coreutils/backup/headbody/perl/fifo/main$ cat ../
> headbody.pl
> #!/usr/bin/env perl
>
> use strict;
> use warnings;
>
> #use FindBin;
> #use lib "$FindBin::Bin/.";
>
> open(HEAD, '>', $ARGV[0]) or die "cannot to open $ARGV[0] $!";
> open(BODY, '>', $ARGV[1]) or die "cannot to open $ARGV[0] $!";
Opening a fifo for writing will block until someone opens it for
reading. cat will not open body for reading until after it has finished
reading from head, and headbody.pl will not close head until after it
has opened body. Either close head before opening body, or open the
fifos read-write (which will not block).
Ben
------------------------------
Date: Thu, 6 Dec 2012 08:01:32 -0800 (PST)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: Why 'z'..'a' is not empty?
Message-Id: <cab35e53-0307-49ee-af6c-465344749f4f@10g2000yqk.googlegroups.com>
Hi,
The following code shows that 'z'..'a' is not empty. But perlop says
the following. So it should return empty list. Does anybody know why
'z'..'a' is not empty?
"In list context, it returns a list of values counting (up by ones)
from the left value to the right value. If the left value is greater
than the right value then it returns the empty list."
~/linux/test/perl/man/perlop/dot_dot/list_context$ cat main.pl
#!/usr/bin/env perl
use warnings;
print join(',', 1..10), "\n";
print join(',', 10..1), "\n";
print join(',', 'a'..'z'), "\n";
print join(',', 'z'..'a'), "\n";
~/linux/test/perl/man/perlop/dot_dot/list_context$ ./main.pl
1,2,3,4,5,6,7,8,9,10
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
z
~/linux/test/perl/man/perlop/dot_dot/list_context$ perl --version
This is perl 5, version 14, subversion 2 (v5.14.2) built for darwin-
thread-multi-2level
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:58:41
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
------------------------------
Date: Thu, 6 Dec 2012 16:33:28 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Why 'z'..'a' is not empty?
Message-Id: <ovt6p9-t4m.ln1@anubis.morrow.me.uk>
Quoth Peng Yu <pengyu.ut@gmail.com>:
>
> The following code shows that 'z'..'a' is not empty. But perlop says
> the following. So it should return empty list. Does anybody know why
> 'z'..'a' is not empty?
This happens because of the way .. works on non-numeric values. It uses
the properties of ++ on strings, which means that "z" will roll over to
"aa" rather than to "{", but that also means that it can't compare the
endpoints before starting because that would make "z".."ab" return the
empty list.
Ben
------------------------------
Date: Thu, 6 Dec 2012 17:05:05 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: Why 'z'..'a' is not empty?
Message-Id: <fb9dd71d-6819-40d3-a4b7-1a0491864dfb@googlegroups.com>
On Thursday, December 6, 2012 8:33:28 AM UTC-8, Ben Morrow wrote:
> Quoth Peng Yu <pengyu.ut@gmail.com>:
>
> >
>
> > The following code shows that 'z'..'a' is not empty. But perlop says
>
> > the following. So it should return empty list. Does anybody know why
>
> > 'z'..'a' is not empty?
>
>
>
> This happens because of the way .. works on non-numeric values. It uses
>
> the properties of ++ on strings, which means that "z" will roll over to
>
> "aa" rather than to "{", but that also means that it can't compare the
>
> endpoints before starting because that would make "z".."ab" return the
>
> empty list.
>
>
And to expand on this, IIUC, .. gets really
twisty if there's magical ++ on strings:
perl -lE 'say join(",", "m" .. "a")'
m,n,o,p,q,r,s,t,u,v,w,x,y,z
Similarly:
perl -lE 'say join(",", "y" .. "a")'
y,z
Intuitively, you might think just as with
numeric operands, this should yield the empty list since "m" (or "y" in the latter case) is "greater" than "a" and But, since they're strings, it'll ++ until "z" falls over the edge
to "aa" which is longer than "a".
from perlop:
If the final value specified is not in the
sequence that the magical increment would
produce, the sequence goes until the next
value would be longer than the final value
specified.
So, Peng's 'z' to 'a' example ++'s to 'aa'
which it's longer than 'a' then stops which
leaves only the initial 'z' as output.
--
Charles DeRykus
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 3833
***************************************