[31787] in Perl-Users-Digest
Perl-Users Digest, Issue: 3050 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 11:09:26 2010
Date: Thu, 29 Jul 2010 08:09:08 -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 Thu, 29 Jul 2010 Volume: 11 Number: 3050
Today's topics:
Can not install Net::SSLeay <pengyu.ut@gmail.com>
Re: Can not install Net::SSLeay <sherm.pendley@gmail.com>
Re: Can not install Net::SSLeay <justin.1007@purestblue.com>
Re: Confusion about the smart matching operator <nospam-abuse@ilyaz.org>
Re: Confusion about the smart matching operator <klaus03@gmail.com>
Re: FAQ 5.12 How can I write() into a string? <sherm.pendley@gmail.com>
How to synchronize I/O (Parallel::ForkManager) <pengyu.ut@gmail.com>
Re: How to synchronize I/O (Parallel::ForkManager) <ben@morrow.me.uk>
Re: How to synchronize I/O (Parallel::ForkManager) <whynot@pozharski.name>
Re: If Perl is compiled on a 32-bit system, and the sys <sherm.pendley@gmail.com>
Re: If Perl is compiled on a 32-bit system, and the sys <tzz@lifelogs.com>
Re: If Perl is compiled on a 32-bit system, and the sys <sherm.pendley@gmail.com>
Re: If Perl is compiled on a 32-bit system, and the sys <ben@morrow.me.uk>
Re: If Perl is compiled on a 32-bit system, and the sys <ben@morrow.me.uk>
Re: Speed of reading some MB of data using qx(...) <nospam-abuse@ilyaz.org>
Re: Speed of reading some MB of data using qx(...) <w.c.humann@arcor.de>
Re: XML::Simple - Processing Query <xhoster@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jul 2010 20:28:16 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: Can not install Net::SSLeay
Message-Id: <e671971d-9dd3-4652-9dea-4b5ad3c38a79@w31g2000yqb.googlegroups.com>
Hi,
I try to install Net::SSLeay. And I have openssl installed. But I'm
not sure why see the following error. Could anybody help?
pengy@pearson:~/download/linux/perl_library/IO-Socket-SSL-1.33$ cpan
Net::SSLeay
CPAN: Storable loaded ok (v2.20)
Going to read '/home/pengy/.cpan/Metadata'
Database was generated on Thu, 29 Jul 2010 02:28:36 GMT
Running install for module 'Net::SSLeay'
CPAN: YAML loaded ok (v0.70)
Running make for F/FL/FLORA/Net-SSLeay-1.36.tar.gz
CPAN: Digest::SHA loaded ok (v5.47)
CPAN: Compress::Zlib loaded ok (v2.02)
Checksum for /home/pengy/.cpan/sources/authors/id/F/FL/FLORA/Net-
SSLeay-1.36.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.54)
Net-SSLeay-1.36/
Net-SSLeay-1.36/constants.c
Net-SSLeay-1.36/inc/
Net-SSLeay-1.36/inc/Module/
Net-SSLeay-1.36/inc/Module/Install/
Net-SSLeay-1.36/inc/Module/Install/External.pm
Net-SSLeay-1.36/inc/Module/Install/Can.pm
Net-SSLeay-1.36/inc/Module/Install/WriteAll.pm
Net-SSLeay-1.36/inc/Module/Install/Makefile.pm
Net-SSLeay-1.36/inc/Module/Install/Metadata.pm
Net-SSLeay-1.36/inc/Module/Install/PRIVATE/
Net-SSLeay-1.36/inc/Module/Install/PRIVATE/Net/
Net-SSLeay-1.36/inc/Module/Install/PRIVATE/Net/SSLeay.pm
Net-SSLeay-1.36/inc/Module/Install/Base.pm
Net-SSLeay-1.36/inc/Module/Install/Fetch.pm
Net-SSLeay-1.36/inc/Module/Install/Compiler.pm
Net-SSLeay-1.36/inc/Module/Install/Win32.pm
Net-SSLeay-1.36/inc/Module/Install.pm
Net-SSLeay-1.36/QuickRef
Net-SSLeay-1.36/TODO
Net-SSLeay-1.36/README.Win32
Net-SSLeay-1.36/ppport.h
Net-SSLeay-1.36/MANIFEST.SKIP
Net-SSLeay-1.36/Changes
Net-SSLeay-1.36/t/
Net-SSLeay-1.36/t/data/
Net-SSLeay-1.36/t/data/0f89dbb5.0
Net-SSLeay-1.36/t/data/key.pem
Net-SSLeay-1.36/t/data/cert.pem
Net-SSLeay-1.36/t/data/key.pem.e
Net-SSLeay-1.36/t/handle/
Net-SSLeay-1.36/t/handle/external/
Net-SSLeay-1.36/t/handle/external/50_external.t
Net-SSLeay-1.36/t/handle/external/10_destroy.t
Net-SSLeay-1.36/t/handle/local/
Net-SSLeay-1.36/t/handle/local/05_use.t
Net-SSLeay-1.36/t/external/
Net-SSLeay-1.36/t/external/08_external.t
Net-SSLeay-1.36/t/external/15_altnames.t
Net-SSLeay-1.36/t/local/
Net-SSLeay-1.36/t/local/15_bio.t
Net-SSLeay-1.36/t/local/31_rsa_generate_key.t
Net-SSLeay-1.36/t/local/08_pipe.t
Net-SSLeay-1.36/t/local/03_use.t
Net-SSLeay-1.36/t/local/01_pod.t
Net-SSLeay-1.36/t/local/kwalitee.t
Net-SSLeay-1.36/t/local/04_basic.t
Net-SSLeay-1.36/t/local/06_tcpecho.t
Net-SSLeay-1.36/t/local/ptr_cast_test.c
Net-SSLeay-1.36/t/local/20_autoload.t
Net-SSLeay-1.36/t/local/07_sslecho.t
Net-SSLeay-1.36/t/local/00_ptr_cast.t
Net-SSLeay-1.36/t/local/02_pod_coverage.t
Net-SSLeay-1.36/t/local/30_error.t
Net-SSLeay-1.36/t/local/35_ephemeral.t
Net-SSLeay-1.36/t/local/05_passwd_cb.t
Net-SSLeay-1.36/t/local/50_digest.t
Net-SSLeay-1.36/typemap
Net-SSLeay-1.36/Makefile.PL
Net-SSLeay-1.36/META.yml
Net-SSLeay-1.36/examples/
Net-SSLeay-1.36/examples/stdio_bulk.pl
Net-SSLeay-1.36/examples/https-proxy-snif.pl
Net-SSLeay-1.36/examples/tcpcat.pl
Net-SSLeay-1.36/examples/cb-testi.pl
Net-SSLeay-1.36/examples/get_page.pl
Net-SSLeay-1.36/examples/req.conf
Net-SSLeay-1.36/examples/cli-cert.pl
Net-SSLeay-1.36/examples/sslecho.pl
Net-SSLeay-1.36/examples/get_page_cert.pl
Net-SSLeay-1.36/examples/makecert.pl
Net-SSLeay-1.36/examples/minicli.pl
Net-SSLeay-1.36/examples/ssl-inetd-serv.pl
Net-SSLeay-1.36/examples/tcpecho.pl
Net-SSLeay-1.36/examples/sslcat.pl
Net-SSLeay-1.36/examples/get_authenticated_page.pl
Net-SSLeay-1.36/examples/callback.pl
Net-SSLeay-1.36/examples/bio.pl
Net-SSLeay-1.36/examples/server_key.pem
Net-SSLeay-1.36/examples/ephemeral.pl
Net-SSLeay-1.36/examples/bulk.pl
Net-SSLeay-1.36/examples/ssl_diff.pl
Net-SSLeay-1.36/examples/passwd-cb.pl
Net-SSLeay-1.36/SSLeay.xs
Net-SSLeay-1.36/Credits
Net-SSLeay-1.36/RECIPE.Win32
Net-SSLeay-1.36/MANIFEST
Net-SSLeay-1.36/lib/
Net-SSLeay-1.36/lib/Net/
Net-SSLeay-1.36/lib/Net/SSLeay.pm
Net-SSLeay-1.36/lib/Net/SSLeay/
Net-SSLeay-1.36/lib/Net/SSLeay/Handle.pm
Net-SSLeay-1.36/README
CPAN: File::Temp loaded ok (v0.22)
CPAN.pm: Going to build F/FL/FLORA/Net-SSLeay-1.36.tar.gz
Cannot determine perl version info from lib/Net/SSLeay.pm
Cannot determine license info from lib/Net/SSLeay.pm
*** Could not find OpenSSL
If it's already installed, please set the OPENSSL_PREFIX
environment
variable accordingly. If it isn't installed yet, get the latest
version
from http://www.openssl.org/.
Warning: No success on command[/pearson/data/pengy/utility/linux/opt/
perl-5.10.1/bin/perl Makefile.PL]
FLORA/Net-SSLeay-1.36.tar.gz
/pearson/data/pengy/utility/linux/opt/perl-5.10.1/bin/perl
Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
pengy@pearson:~/download/linux/perl_library/IO-Socket-SSL-1.33$ su
administrator
Password:
administrator@pearson:/pearson/data/pengy/download/linux/perl_library/
IO-Socket-SSL-1.33$ sudo apt-get install libssl-dev
[sudo] password for administrator:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
------------------------------
Date: Wed, 28 Jul 2010 23:48:09 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Can not install Net::SSLeay
Message-Id: <m2hbjjkkxy.fsf@sherm.shermpendley.com>
Peng Yu <pengyu.ut@gmail.com> writes:
> I try to install Net::SSLeay. And I have openssl installed. But I'm
> not sure why see the following error. Could anybody help?
...
> *** Could not find OpenSSL
> If it's already installed, please set the OPENSSL_PREFIX
> environment
> variable accordingly.
Have you tried doing what the error message suggests doing?
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Thu, 29 Jul 2010 09:41:13 +0100
From: Justin C <justin.1007@purestblue.com>
Subject: Re: Can not install Net::SSLeay
Message-Id: <9er7i7-6s2.ln1@zem.masonsmusic.co.uk>
On 2010-07-29, Peng Yu <pengyu.ut@gmail.com> wrote:
> Hi,
>
> I try to install Net::SSLeay. And I have openssl installed. But I'm
> not sure why see the following error. Could anybody help?
>
[snip]
I would say that this is your problem, and, I'm guessing, I think it
might be that cpan/perl doesn't know where to look for your user
installed modules.
> *** Could not find OpenSSL
> If it's already installed, please set the OPENSSL_PREFIX environment
> variable accordingly. If it isn't installed yet, get the latest
I would do what it suggests above and try again.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 29 Jul 2010 04:44:24 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Confusion about the smart matching operator
Message-Id: <slrni521p8.crp.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-07-27, Ben Morrow <ben@morrow.me.uk> wrote:
> Smartmatch semantics changed in several small but important ways between
> 5.10.0 and 5.10.1. I would highly recommend avoiding smartmatch on
> 5.10.0 for this reason. (I believe the intention is not to change them
> again.)
I strongly hope that this intention will be violated. *THERE IS* a
way to salvage smart match - but it must be made non-backward
compatible.
E.g., consider the following scenario:
a) Choose a small number N (I favor 3 ;-).
b) Write N simple rules explaining what ~~ should do (and "simple"
means AT LEAST having no "...except for...").
c) Add new `use strict' type 'smartmatch', enabled by default.
d) In scope of `use strict "smartmatch"', force ~~ to die() if it
encounters something not covered by (b), or when more than one
rule in (b) is applicable, and results conflict.
And I'm pretty sure that there must be yet smarter fixes...
Yours,
Ilya
------------------------------
Date: Wed, 28 Jul 2010 23:11:51 -0700 (PDT)
From: Klaus <klaus03@gmail.com>
Subject: Re: Confusion about the smart matching operator
Message-Id: <3d652b57-00ff-4fcf-8bd9-d769b03d3fe6@5g2000yqz.googlegroups.com>
> However, what trips me up with smartmatching is the combination of
> numbers on the lefthand side combined with what looks like a number on
> the righthand side.
>
> Here is my (admittedly contrived) example:
>
> ******************************
> use strict;
> use warnings;
> use 5.010;
>
> my $val =3D ' =A03';
>
> checkvalue($val);
>
> my $formatted =3D sprintf '%6.2f', $val;
>
> checkvalue($val);
>
> sub checkvalue {
> =A0 =A0 if =A0 =A0($_[0] ~~ =A0 =A0'3') { say "there is no space"; =A0 =
=A0 =A0 =A0 =A0 }
> =A0 =A0 elsif ($_[0] ~~ =A0 ' 3') { say "there is one space"; =A0 =A0 =A0=
=A0 =A0}
> =A0 =A0 elsif ($_[0] ~~ =A0' =A03') { say "there are two spaces"; =A0 =A0=
=A0 =A0}
> =A0 =A0 elsif ($_[0] ~~ ' =A0 3') { say "there are three spaces"; =A0 =A0=
=A0}
> =A0 =A0 else =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ say "I don't know w=
hat to say..."; }}
One possible solution is to always quote the lefthand side of a
smartmatch
sub checkvalue {
if ("$_[0]" ~~ '3') { say "there is no space"; }
elsif ("$_[0]" ~~ ' 3') { say "there is one space"; }
elsif ("$_[0]" ~~ ' 3') { say "there are two spaces"; }
elsif ("$_[0]" ~~ ' 3') { say "there are three spaces"; }
else { say "I don't know what to say..."; }}
This works, but I don't think it is a good solution in the light of
perlfaq4 - What's wrong with always quoting "$vars"?
--
Klaus
------------------------------
Date: Thu, 29 Jul 2010 00:25:16 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: FAQ 5.12 How can I write() into a string?
Message-Id: <m2tynioqxf.fsf@sherm.shermpendley.com>
PerlFAQ Server <brian@theperlreview.com> writes:
> 5.12: How can I write() into a string?
>
> See "Accessing Formatting Internals" in perlform for an "swrite()"
> function.
Alternatively:
my $writeout;
my $fh;
open($fh, '>', \$writeout) or die "Epic fail: $!";
write $fh;
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Wed, 28 Jul 2010 15:33:56 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: How to synchronize I/O (Parallel::ForkManager)
Message-Id: <15fe947f-67be-42f9-8ac2-1d19bc593654@t2g2000yqe.googlegroups.com>
I have the following code. The there is a chance that the two print
line (with '#') may not function print consecutively. Is there a way
to lock so that I can guarantee they write consecutively?
$ cat main.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Parallel::ForkManager;
open OUT, ">main.txt";
my $pm = new Parallel::ForkManager(5);
foreach my $n (1..10) {
my $pid = $pm->start and next;
print $n, "\n";
sleep rand(1);
print OUT $n;#
print OUT $n;#
$pm->finish;
}
$pm->wait_all_children;
------------------------------
Date: Thu, 29 Jul 2010 01:18:16 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to synchronize I/O (Parallel::ForkManager)
Message-Id: <8vt6i7-e0a.ln1@osiris.mauzo.dyndns.org>
Quoth Peng Yu <pengyu.ut@gmail.com>:
> I have the following code. The there is a chance that the two print
> line (with '#') may not function print consecutively. Is there a way
> to lock so that I can guarantee they write consecutively?
>
> $ cat main.pl
> #!/usr/bin/env perl
>
> use strict;
> use warnings;
>
> use Parallel::ForkManager;
>
> open OUT, ">main.txt";
*Always* check the return value of open.
Use 3-arg open.
Keep filehandles in variables.
open my $OUT, ">", "main.txt"
or die "can't write to 'main.txt': $!";
> my $pm = new Parallel::ForkManager(5);
>
> foreach my $n (1..10) {
> my $pid = $pm->start and next;
> print $n, "\n";
> sleep rand(1);
> print OUT $n;#
> print OUT $n;#
Since you are writing, you also need to close the filehandle and check
for errors. Since perl buffers writes, you need to do this *inside* the
lock. (If you want to keep the file open, you can call IO::Handle::flush
inside the lock instead.)
> $pm->finish;
> }
>
> $pm->wait_all_children;
There are lots of ways. The simplest is to flock a file; however, you
can't just use the main.txt file you've already got open due to the way
fork(2) and flock(2) interact (at least on systems with proper BSD flock
semantics).
use Fcntl qw/:flock/;
...
sleep rand(1);
open my $LOCK, ">", "main.txt.lock"
or die "can't open main.txt.lock: $!";
flock $LOCK, LOCK_EX or die "can't lock main.txt.lock: $!";
print $OUT "...";
close $OUT or die "can't write to main.txt: $!";
# close will release the lock
close $LOCK;
(You can get all those 'or die's supplied automatically by using the
'autodie' module.)
Alternatively, if you open the file separately in each child, you *can*
flock the $OUT filehandle; however, you will need to be careful to seek
to the end of the file under the lock or open in append mode.
Other locking primitives include fcntl file locking, which will allow
you to lock against other forked processes so long as you are careful
never to reopen the same file; SysV semaphores (IPC::Semaphore), which
are usually supported on Unix systems but not usually elsewhere; and
POSIX.1b semaphores (POSIX::RT::Semaphore), which are not yet
universally supported. Your system may also support other lock types.
Ben
------------------------------
Date: Thu, 29 Jul 2010 07:53:45 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: How to synchronize I/O (Parallel::ForkManager)
Message-Id: <slrni522aq.btb.whynot@orphan.zombinet>
with <15fe947f-67be-42f9-8ac2-1d19bc593654@t2g2000yqe.googlegroups.com> Peng Yu wrote:
> I have the following code. The there is a chance that the two print
> line (with '#') may not function print consecutively. Is there a way
> to lock so that I can guarantee they write consecutively?
*SKIP*
> sleep rand(1);
Please, read carefully the very last paragraph of 'perldoc -f sleep'
% perl -wle 'print "$_ -> ", sleep $_ foreach map rand 1, 0 .. 10'
0.040502967153774 -> 0
0.135818231941329 -> 0
0.57742617841917 -> 0
0.999873014489772 -> 0
0.560751288326248 -> 0
0.480306753175668 -> 0
0.0107077151972952 -> 0
0.870398831594763 -> 0
0.131003141627307 -> 0
0.957688366820321 -> 0
0.803041790395394 -> 0
(That's just "my 0.02$"; others showed you light already)
*CUT*
--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
------------------------------
Date: Wed, 28 Jul 2010 18:30:16 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: If Perl is compiled on a 32-bit system, and the system is upgraded to 64-bit...
Message-Id: <m24ofj1bpj.fsf@sherm.shermpendley.com>
David Filmer <usenet@davidfilmer.com> writes:
> If Perl is compiled on a 32-bit system, and the system is later
> upgraded to 64-bit hardware and O/S, would Perl programs then be able
> to use the full amount of memory that a 64-bit system would allow?
Not unless the upgrade included a 64-bit perl - which, on many *nix
systems, it would.
> Or would I need to re-compile Perl in the 64-bit environment to access
> the larger memory?
You'd need a 64-bit Perl interpreter, certainly, but there's no reason
you'd *need* to compile it yourself. You could just as easily use the
one that shipped with the OS, or download a binary installer if you're
using Windows.
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Thu, 29 Jul 2010 09:06:15 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: If Perl is compiled on a 32-bit system, and the system is upgraded to 64-bit...
Message-Id: <87r5imqt60.fsf@lifelogs.com>
On Wed, 28 Jul 2010 23:31:50 +0100 Ben Morrow <ben@morrow.me.uk> wrote:
BM> (Think about it for a minute. The 32bit perl was, by definition,
BM> compiled with 32bit pointers. Thus, it cannot address more than 32 bits'
BM> worth of memory, regardless of what the OS can address or what is
BM> physically present in the machine.)
It's not the case here, but it's not generally true (as you imply) that
just because pointers are N-bit you are limited to 2^N memory. You can
definitely address more than the pointer size will allow in a segmented
memory model, just not necessarily all at once.
Ted
------------------------------
Date: Thu, 29 Jul 2010 10:23:28 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: If Perl is compiled on a 32-bit system, and the system is upgraded to 64-bit...
Message-Id: <m2mxtajrj3.fsf@sherm.shermpendley.com>
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Wed, 28 Jul 2010 23:31:50 +0100 Ben Morrow <ben@morrow.me.uk> wrote:
>
> BM> (Think about it for a minute. The 32bit perl was, by definition,
> BM> compiled with 32bit pointers. Thus, it cannot address more than 32 bits'
> BM> worth of memory, regardless of what the OS can address or what is
> BM> physically present in the machine.)
>
> It's not the case here, but it's not generally true (as you imply) that
> just because pointers are N-bit you are limited to 2^N memory. You can
> definitely address more than the pointer size will allow in a segmented
> memory model, just not necessarily all at once.
You can even access it all at once, if your pointer data structures
contain both a segment identifier and an address. I remember quite
well using memory models and different size pointers in MS-DOS, to
access up to 1MB on a 16-bit 8086.
Theory and history aside though, I don't think perl uses far pointers,
even on a system that supports them. Nor can I think of any such system
that's still in use.
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Thu, 29 Jul 2010 15:51:47 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: If Perl is compiled on a 32-bit system, and the system is upgraded to 64-bit...
Message-Id: <35h8i7-7ni.ln1@osiris.mauzo.dyndns.org>
Quoth Sherm Pendley <sherm.pendley@gmail.com>:
> Ted Zlatanov <tzz@lifelogs.com> writes:
>
> > On Wed, 28 Jul 2010 23:31:50 +0100 Ben Morrow <ben@morrow.me.uk> wrote:
> >
> > BM> (Think about it for a minute. The 32bit perl was, by definition,
> > BM> compiled with 32bit pointers. Thus, it cannot address more than 32 bits'
> > BM> worth of memory, regardless of what the OS can address or what is
> > BM> physically present in the machine.)
> >
> > It's not the case here, but it's not generally true (as you imply) that
> > just because pointers are N-bit you are limited to 2^N memory. You can
> > definitely address more than the pointer size will allow in a segmented
> > memory model, just not necessarily all at once.
>
> You can even access it all at once, if your pointer data structures
> contain both a segment identifier and an address. I remember quite
> well using memory models and different size pointers in MS-DOS, to
> access up to 1MB on a 16-bit 8086.
...but then your pointers are more than (32|16) bits wide. A DOS/Win16
__far pointer is a perfectly respectable 32bit pointer.
> Theory and history aside though, I don't think perl uses far pointers,
> even on a system that supports them. Nor can I think of any such system
> that's still in use.
PAE on x86 systems, though it's mostly kernel-only. (A bad idea never
dies...)
Ben
------------------------------
Date: Wed, 28 Jul 2010 23:31:50 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: If Perl is compiled on a 32-bit system, and the system is upgraded to 64-bit...
Message-Id: <mnn6i7-r09.ln1@osiris.mauzo.dyndns.org>
Quoth David Filmer <usenet@davidfilmer.com>:
> If Perl is compiled on a 32-bit system, and the system is later
> upgraded to 64-bit hardware and O/S, would Perl programs then be able
> to use the full amount of memory that a 64-bit system would allow?
No.
(Though you may, of course, gain some benefit from being able to run
several full-32bit-address-space processes side-by-side without
swapping.)
> Or would I need to re-compile Perl in the 64-bit environment to access
> the larger memory?
Yes.
(Think about it for a minute. The 32bit perl was, by definition,
compiled with 32bit pointers. Thus, it cannot address more than 32 bits'
worth of memory, regardless of what the OS can address or what is
physically present in the machine.)
Ben
------------------------------
Date: Thu, 29 Jul 2010 04:30:08 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Speed of reading some MB of data using qx(...)
Message-Id: <slrni520ug.crp.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-07-28, Wolfram Humann <w.c.humann@arcor.de> wrote:
> So now we have:
> if (newlen > SvLEN(sv)) { /* need more room? */
> newlen += (newlen >> 2) + 10;
> #ifndef Perl_safesysmalloc_size
> newlen = PERL_STRLEN_ROUNDUP(newlen);
> #endif
> if (SvLEN(sv) && s) {
> s = (char*)saferealloc(s, newlen);
> }
I think you make your life too simple. What you must do is find the
chain of events which sets
Perl_safesysmalloc_size/PERL_STRLEN_ROUNDUP, and modify this chain. :-(
> I tried several values from (newlen >> 0) to (newlen >> 6) for the
> best compromise between execution time and memory usage and my
> personal favorite is (newlen >> 2). What do others here think?
My approach is never to take responsibility for such decisions.
Make a default value, and shift responsibility to the user. ;-)
#ifndef PERL_STRLEN_ROUNDUP_SHIFT
# define PERL_STRLEN_ROUNDUP_SHIFT 2
#endif
The suggestion to use the OLD length is also very viable...
> 1E5 chars + 1E4 x 1E2 chars: 1.5 ms
I hope your `ms' are actually seconds. It does not make sense to
measure performance on runs shorter than a second (maybe more on Win,
which is doing more unknown stuff in background)...
Yours,
Ilya
------------------------------
Date: Thu, 29 Jul 2010 08:05:16 -0700 (PDT)
From: Wolfram Humann <w.c.humann@arcor.de>
Subject: Re: Speed of reading some MB of data using qx(...)
Message-Id: <0d219a51-2650-4563-8db3-783423ae3dc1@d8g2000yqf.googlegroups.com>
On Jul 29, 6:30=A0am, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> On 2010-07-28, Wolfram Humann <w.c.hum...@arcor.de> wrote:
>
> > So now we have:
> > =A0 =A0 if (newlen > SvLEN(sv)) { =A0 =A0 =A0 =A0 =A0 /* need more room=
? */
> > =A0 =A0newlen +=3D (newlen >> 2) + 10;
> > #ifndef Perl_safesysmalloc_size
> > =A0 =A0newlen =3D PERL_STRLEN_ROUNDUP(newlen);
> > #endif
> > =A0 =A0if (SvLEN(sv) && s) {
> > =A0 =A0 =A0 =A0s =3D (char*)saferealloc(s, newlen);
> > =A0 =A0}
>
> I think you make your life too simple. =A0What you must do is find the
> chain of events which sets
> Perl_safesysmalloc_size/PERL_STRLEN_ROUNDUP, and modify this chain. =A0:-=
(
I'm traveling territory that's fairly unknown to me already, so if
this is too simple I should leave it to someone more knowledgeable to
do it right. What I *think* is, that PERL_STRLEN_ROUNDUP is just
concerned with memory boundary alignment, e.g. roundup to the next
multiple of 4. If this is the case, it should be independent of any
string memory expansion strategy.
>
> > I tried several values from (newlen >> 0) to (newlen >> 6) for the
> > best compromise between execution time and memory usage and my
> > personal favorite is (newlen >> 2). What do others here think?
>
> My approach is never to take responsibility for such decisions.
> Make a default value, and shift responsibility to the user. =A0;-)
>
> #ifndef PERL_STRLEN_ROUNDUP_SHIFT
> # =A0define PERL_STRLEN_ROUNDUP_SHIFT 2
> #endif
Given that nobody stumbled across the devastating current state, I
don't envision hoards of users trying to optimize this. But I agree
that it serves well as a reminder for someone reading the code that
this is not *the* correct value but a trade-off and could be decided
differently. However, given that IMO it's a different concept from the
existing PERL_STRLEN_ROUNDUP, I would prefer to give it a different
name. How about PERL_STRLEN_EXPAND_SHIFT?
> The suggestion to use the OLD length is also very viable...
Agreed.
> > 1E5 chars + 1E4 x 1E2 chars: =A0 =A01.5 ms
>
> I hope your `ms' are actually seconds. =A0It does not make sense to
> measure performance on runs shorter than a second (maybe more on Win,
> which is doing more unknown stuff in background)...
No, these are milliseconds. Yes, this makes it a lousy benchmark. Yes,
these numbers do vary easily by +-30% and sometimes more from run to
run. I tried to post "average" runs, but that's even more subjective,
of course. However the time differences encountered between different
cases are often a factor of 10 or even much more (in the unmodified
case, many of these do run for several seconds ;-)), so I think this
is a valid base for comparison.
So my current proposal reads like this:
#ifndef PERL_STRLEN_EXPAND_SHIFT
# define PERL_STRLEN_EXPAND_SHIFT 2
#endif
if (newlen > SvLEN(sv)) { /* need more room? */
size_t minlen =3D SvCUR(sv);
minlen +=3D (minlen >> PERL_STRLEN_EXPAND_SHIFT) + 10;
if (newlen < minlen) newlen =3D minlen;
#ifndef Perl_safesysmalloc_size
newlen =3D PERL_STRLEN_ROUNDUP(newlen);
#endif
if (SvLEN(sv) && s) {
s =3D (char*)saferealloc(s, newlen);
}
My benchmark script does run slower now. The previous version did
expand allocated memory beyond minimum requirements during the initial
assignment, so that the reallocation count during append was 0 in many
cases. The new version does not do that so that at least 1 realloc is
required when one starts appending to the string.
Wolfram
------------------------------
Date: Wed, 28 Jul 2010 17:58:01 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: XML::Simple - Processing Query
Message-Id: <4c50d1b7$0$13736$ed362ca5@nr5-q3a.newsreader.com>
Jane D. wrote:
> Okay, here's the first bit of the Data Dumper result, content edited
> for brevity:
>
> $VAR1 = {
>
> 'count' => '10',
> 'story' => {
In addition to what Ben said about KeyAttr, the outermost tag around the
XML is not reported by XML::Simple (unless you specify KeepRoot), so
{stories} does not appear in the data dump, but your original code was
looking for it. (Which caused it to be autovivified)
I don't know if the XML::Simple's default value of KeyAttr is all that
clever. Sometimes trying to making something too simple results in it
being more complicated.
Cheers,
Xho
------------------------------
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 3050
***************************************