[32275] in Perl-Users-Digest
Perl-Users Digest, Issue: 3542 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 13 21:09:29 2011
Date: Sun, 13 Nov 2011 18:09:07 -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 Sun, 13 Nov 2011 Volume: 11 Number: 3542
Today's topics:
Can't connect to BackPan - Error 404 <klaus03@gmail.com>
Re: Can't connect to BackPan - Error 404 <klaus03@gmail.com>
Re: How to import only part of a large XML file? <klaus03@gmail.com>
Re: How to import only part of a large XML file? <dwightarmyofchampions@hotmail.com>
Re: How to import only part of a large XML file? <hjp-usenet2@hjp.at>
Re: How to import only part of a large XML file? <klaus03@gmail.com>
PhD and Postdoc positions at ETH Zurich <martin.vechev@gmail.com>
Unexplained delay Module::Build + ExtUtils::MakeMaker b <klaus03@gmail.com>
Re: Unexplained delay Module::Build + ExtUtils::MakeMak <klaus03@gmail.com>
Re: Unexplained delay Module::Build + ExtUtils::MakeMak <ben@morrow.me.uk>
Re: Unexplained delay Module::Build + ExtUtils::MakeMak <klaus03@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 13 Nov 2011 07:04:02 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Can't connect to BackPan - Error 404
Message-Id: <b56dabd3-cf89-4fdd-9154-9d10da77d5c6@u5g2000vbd.googlegroups.com>
Hi everybody,
I can't connect to http://backpan.perl.org/
I get an error 404.
Does anybody have the same problems ?
-- Klaus
------------------------------
Date: Sun, 13 Nov 2011 08:00:07 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: Can't connect to BackPan - Error 404
Message-Id: <afb603ec-b75a-472f-8be9-92725ab6429e@o14g2000yqh.googlegroups.com>
On 13 nov, 16:04, Klaus <klau...@gmail.com> wrote:
> Hi everybody,
>
> I can't connect to http://backpan.perl.org/
> I get an error 404.
>
> Does anybody have the same problems ?
>
> -- Klaus
http://backpan.perl.org/ is still down, but meanwhile I came across a
posting at http://london.pm.org/pipermail/london.pm/Week-of-Mon-20090302/016801.html
that mentioned an alternative BackPan Server at http://backpan.hexten.net/
which is currently up and running.
So my immediate problem is resolved ( in so far as I can access
BackPan via http://backpan.hexten.net/ ), but my next question is as
follows:
Is there a list of all the different available BackPan Servers that
can be used in case one particular server goes offline ?
------------------------------
Date: Sat, 12 Nov 2011 05:09:24 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: How to import only part of a large XML file?
Message-Id: <e401bae5-e6e3-49e6-a967-3e313afbb946@y7g2000vbe.googlegroups.com>
On 12 nov, 11:28, Klaus <klau...@gmail.com> wrote:
> That's a perfect Job for XML::Reader
> [...]
> my $huge_xml =3D
> q{<?xml version=3D"1.0"?>
> <library>
> [...]
> </library>
> };
> [...]
> my $rdr =3D XML::Reader->new(\$huge_xml, {mode =3D> 'branches'},
> =A0 { root =3D> '/library/book', branch =3D> '*' });
That's, of course, better written with an external file ('huge.xml'):
open my $fh, '>', 'huge.xml' or die $!;
print {$fh}
q{<?xml version=3D"1.0"?>
<library>
[...]
</library>
};
close $fh;
[...]
my $rdr =3D XML::Reader->new('huge.xml', {mode =3D> 'branches'},
{ root =3D> '/library/book', branch =3D> '*' });
[...]
The rest stays exactly the same:
> while ($rdr->iterate) {
> =A0 =A0 my $small_ref =3D XMLin($rdr->rvalue);
>
> =A0 =A0 my ($day, $month, $year) =3D
> =A0 =A0 =A0 $small_ref->{'publication_date'} =3D~
> =A0 =A0 =A0 m{\A (\d+) / (\d+) / (\d+) \z}xms;
>
> =A0 =A0 unless (defined $day) =A0 { $day =A0 =3D 0; }
> =A0 =A0 unless (defined $month) { $month =3D 0; }
> =A0 =A0 unless (defined $year) =A0{ $year =A0=3D 0; }
>
> =A0 =A0 my $date =3D sprintf('%04d-%02d-%02d', $year, $month, $day);
>
> =A0 =A0 if ($date ge '2002-01-01') {
> =A0 =A0 =A0 =A0 push @{$selected->{book}}, $small_ref;
> =A0 =A0 }}
>
> print Dumper($selected);
>
> > The import will completely ignore entries that don't meet the
> > specified criteria (in this case, publication_date >=3D '1/1/2002').
>
> Yes, the way it works is that XML::Reader reads from a huge XML only
> small chunks (via $rdr->rvalue) (a small chunk being the '<book>...</
> book> part). This small chunk is then fed into XML::Simple::XMLin() to
> generate a small structure in memory which can then be used to extract
> the date. if the date is >=3D 1/1/2002, then that small structure in
> memory is pushed to a selected structure.
------------------------------
Date: Sat, 12 Nov 2011 21:44:03 -0800 (PST)
From: Dwight Army of Champions <dwightarmyofchampions@hotmail.com>
Subject: Re: How to import only part of a large XML file?
Message-Id: <5802f59e-ea92-4889-9f7b-8a0cc4fa627a@o9g2000vbc.googlegroups.com>
On Nov 12, 5:28=A0am, Klaus <klau...@gmail.com> wrote:
> On 12 nov, 01:11, Dwight Army of Champions
>
>
>
>
>
>
>
>
>
> <dwightarmyofchampi...@hotmail.com> wrote:
> > Suppose I only want to import books that were published after January
> > 1, 2002. If I apply such a filter when I do my initial import, the
> > result should look like this:
>
> > $VAR1 =3D {
> > =A0 =A0 =A0 =A0 =A0 'book' =3D> [
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'publication_date' =3D> '07=
/22/2003',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'price' =3D> '17.49',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'author' =3D> 'Dennis Lehan=
e',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'title' =3D> 'Mystic River'=
,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'rating' =3D> '4',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'pages' =3D> '390',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'genre' =3D> 'Thriller'
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 },
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'publication_date' =3D> '10=
/12/2005',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'price' =3D> '10.99',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'author' =3D> 'J. R. R. Tol=
kien',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'title' =3D> 'The Lord Of T=
he Rings',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'rating' =3D> '5',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'pages' =3D> '3489',
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'genre' =3D> 'Fantasy'
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ]
> > =A0 =A0 =A0 =A0 };
>
> That's a perfect Job for XML::Reader
>
> use strict;
> use warnings;
>
> use XML::Reader;
> use XML::Simple;
> use Data::Dumper;
>
> my $huge_xml =3D
> q{<?xml version=3D"1.0"?>
> <library>
> =A0 =A0 <book>
> =A0 =A0 =A0 =A0 <title>Dreamcatcher</title>
> =A0 =A0 =A0 =A0 <author>Stephen King</author>
> =A0 =A0 =A0 =A0 <genre>Horror</genre>
> =A0 =A0 =A0 =A0 <pages>899</pages>
> =A0 =A0 =A0 =A0 <price>23.99</price>
> =A0 =A0 =A0 =A0 <rating>5</rating>
> =A0 =A0 =A0 =A0 <publication_date>11/27/2001</publication_date>
> =A0 =A0 </book>
> =A0 =A0 <book>
> =A0 =A0 =A0 =A0 <title>Mystic River</title>
> =A0 =A0 =A0 =A0 <author>Dennis Lehane</author>
> =A0 =A0 =A0 =A0 <genre>Thriller</genre>
> =A0 =A0 =A0 =A0 <pages>390</pages>
> =A0 =A0 =A0 =A0 <price>17.49</price>
> =A0 =A0 =A0 =A0 <rating>4</rating>
> =A0 =A0 =A0 =A0 <publication_date>07/22/2003</publication_date>
> =A0 =A0 </book>
> =A0 =A0 <book>
> =A0 =A0 =A0 =A0 <title>The Lord Of The Rings</title>
> =A0 =A0 =A0 =A0 <author>J. R. R. Tolkien</author>
> =A0 =A0 =A0 =A0 <genre>Fantasy</genre>
> =A0 =A0 =A0 =A0 <pages>3489</pages>
> =A0 =A0 =A0 =A0 <price>10.99</price>
> =A0 =A0 =A0 =A0 <rating>5</rating>
> =A0 =A0 =A0 =A0 <publication_date>10/12/2005</publication_date>
> =A0 =A0 </book>
> </library>
>
> };
>
> my $selected =3D { book =3D> [] };
>
> my $rdr =3D XML::Reader->new(\$huge_xml, {mode =3D> 'branches'},
> =A0 { root =3D> '/library/book', branch =3D> '*' });
>
> while ($rdr->iterate) {
> =A0 =A0 my $small_ref =3D XMLin($rdr->rvalue);
>
> =A0 =A0 my ($day, $month, $year) =3D
> =A0 =A0 =A0 $small_ref->{'publication_date'} =3D~
> =A0 =A0 =A0 m{\A (\d+) / (\d+) / (\d+) \z}xms;
>
> =A0 =A0 unless (defined $day) =A0 { $day =A0 =3D 0; }
> =A0 =A0 unless (defined $month) { $month =3D 0; }
> =A0 =A0 unless (defined $year) =A0{ $year =A0=3D 0; }
>
> =A0 =A0 my $date =3D sprintf('%04d-%02d-%02d', $year, $month, $day);
>
> =A0 =A0 if ($date ge '2002-01-01') {
> =A0 =A0 =A0 =A0 push @{$selected->{book}}, $small_ref;
> =A0 =A0 }}
>
> print Dumper($selected);
>
> > The import will completely ignore entries that don't meet the
> > specified criteria (in this case, publication_date >=3D '1/1/2002').
>
> Yes, the way it works is that XML::Reader reads from a huge XML only
> small chunks (via $rdr->rvalue) (a small chunk being the '<book>...</
> book> part). This small chunk is then fed into XML::Simple::XMLin() to
> generate a small structure in memory which can then be used to extract
> the date. if the date is >=3D 1/1/2002, then that small structure in
> memory is pushed to a selected structure.
Yes that is exactly what I need. Thank you!
Follow-up question: Suppose that the library contains more than just
books. Let's say we expand the XML file to include music items, like
so:
<music>
<title>The Future Will Come</title>
<artist>The Juan Maclean</artist>
<release_date>04/21/2009</release_date>
<label>DFA</label>
</music>
<music>
<title>Laughing Stock</title>
<artist>Talk Talk</artist>
<release_date>09/16/1991</release_date>
<label>Verve</label>
</music>
<music>
<title>Hardcore Will Never Die, But You Will</title>
<artist>Mogwai</artist>
<release_date>02/14/2011</release_date>
<label>Rock Action Records</label>
</music>
Can we take the January 1, 2002 date and apply it to both
publication_date for books and release_date for music?
if ($item_is_a_book && $publication_date ge '2002-01-01') {
push @{$selected->{book}}, $small_ref;
}
else if ($item_is_a_music_item && $release_date ge '2002-01-01') {
push @{$selected->{music}}, $small_ref;
}
I mean, I'm sure we could create an entirely separate XML::Reader
object and do another traversal of the input file in another while
loop (this time looking for music instead of books), but that would
double the execution time of the program. I was wondering if we could
look for both types of items in one go.
------------------------------
Date: Sun, 13 Nov 2011 11:29:51 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: How to import only part of a large XML file?
Message-Id: <slrnjbv710.j50.hjp-usenet2@hrunkner.hjp.at>
On 2011-11-11 23:10, Dwight Army of Champions <dwightarmyofchampions@hotmail.com> wrote:
> On Nov 11, 5:59 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>> Quoth Dwight Army of Champions <dwightarmyofchampi...@hotmail.com>:
>>
>> > I have a very large XML file that I want to load, but I don't want to
>> > necessarily load the entire document; that takes too long. What I want
>> > to do instead is only key/value pairs that meet certain criteria, like
>> > only grab entries whose value fall within a certain date for a key
>> > date_of_entry. Can I just use XML::Simple for this or do I need a
>> > better module?
>>
>> It sounds like you want either XML::Twig or one of the SAX modules.
>> XML::Simple, at least in non-SAX mode, will load the entire document
>> into a tree structure before letting you see any of it.
>>
>> Ben
>
> I'm glancing at XML::Twig on search.cpan.org, What methods can I use
> to accomplish these tasks? I don't see any kind of "filter" method...
You specify the "filter" in the constructor. The twig_handlers attribute
specifies which handler to call for each "twig" (i.e. an element and its
descendants) that matches an XPath expression. So, if you can express
your filter as an XPath, you just specify that and your handler will be
called for each matching twig. If your filter is more complicated, you
specify a more lenient XPath expression and then do additional filtering
in the handler.
For example, here is an excerpt from one of my scripts:
[...]
my $twig=XML::Twig->new(
start_tag_handlers => {
'table[@class="route"]' => sub {
$in_route = 1;
},
},
twig_handlers => {
'title' => sub {
my ($t, $title) = @_;
my $stored_title = $title->children_trimmed_text();
my $computed_title = "hjp: laufen: $date";
unless ($stored_title eq $computed_title) {
$title->set_inner_xml($computed_title);
$modified = 1;
}
},
'table[@class="route"]' => sub {
$in_route = 0;
},
'tr' => sub {
my ($t, $row) = @_;
return unless $in_route;
my @cells = $row->children;
# print "# of cells: ", scalar(@cells), "\n";
my @pl = $row->get_xpath('th');
my $place = $pl[0]->children_trimmed_text if (@pl);
# there doesn't seem to be an XPath expression
# equivalent to the CSS selector [att~=val], so
# we have to do it the hard way.
my @dt = $row->get_xpath('td');
@dt = grep { ($_->att('class') // '') =~ /\bdt\b/ } @dt;
my $stored_dt = "";
my $stored_q = "";
if (@dt) {
$stored_dt = $dt[0]->children_trimmed_text;
if ($dt[0]->att('class') =~ /\bq([0-9])\b/) {
$stored_q = $1;
}
}
[...]
I matched <title> and <table class="route"> elements directly, but I
couldn't figure out how to match all td elements belonging to class
"dt", so I matched on <tr> instead and then did a grep over the child
elements. (I now also see that matching a <tr> within a <table
class="route"> could be achieved in a much simpler way than I did it. I
obviously didn't understand XPath very well when I wrote that.
hp
------------------------------
Date: Sun, 13 Nov 2011 02:47:48 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: How to import only part of a large XML file?
Message-Id: <733146fb-04ce-4e39-8e74-7b6522da513a@e15g2000vba.googlegroups.com>
On 13 nov, 06:44, Dwight Army of Champions
<dwightarmyofchampi...@hotmail.com> wrote:
> On Nov 12, 5:28=A0am, Klaus <klau...@gmail.com> wrote:
> > That's a perfect Job for XML::Reader
> > [...]
> > my $rdr =3D XML::Reader->new(\$huge_xml, {mode =3D> 'branches'},
> > =A0 { root =3D> '/library/book', branch =3D> '*' });
> > while ($rdr->iterate) {
> > =A0 =A0 my $small_ref =3D XMLin($rdr->rvalue);
> Yes that is exactly what I need. Thank you!
>
> Follow-up question: Suppose that the library contains more than just
> books. Let's say we expand the XML file to include music
> items [...]
>
> Can we take the January 1, 2002 date and apply it to both
> publication_date for books and release_date for music?
>
> if ($item_is_a_book && $publication_date ge '2002-01-01') {
> =A0 push @{$selected->{book}}, $small_ref;}
>
> else if ($item_is_a_music_item && $release_date ge '2002-01-01') {
> =A0 push @{$selected->{music}}, $small_ref;
>
> }
>
> I mean, I'm sure we could create an entirely separate XML::Reader
> object and do another traversal of the input file in another while
> loop (this time looking for music instead of books), but that would
> double the execution time of the program. I was wondering if we could
> look for both types of items in one go.
Yes, that's in fact what XML::Reader is designed to do. You just need
to add another line { root =3D> '/library/music', branch =3D> '*' } and
then, inside your loop you just need to check $rdr->rx (which is 0 if
it found a <book> item or 1 if it found a <music> item). With that
logic, the file 'huge.xml' is parsed only once, while extracting
<book> and/or <music> items as it goes along.
*****************************************************
The important lines are:
[...]
my $selected =3D { book =3D> [], music =3D> [] };
my $rdr =3D XML::Reader->new('huge.xml', {mode =3D> 'branches'},
{ root =3D> '/library/book', branch =3D> '*' },
{ root =3D> '/library/music', branch =3D> '*' });
while ($rdr->iterate) {
my $small_ref =3D XMLin($rdr->rvalue);
my $topic =3D $rdr->rx =3D=3D 0 ? 'book' : 'music';
[...]
*****************************************************
Here is a complete program:
use strict;
use warnings;
use XML::Reader;
use XML::Simple;
use Data::Dumper;
open my $fh, '>', 'huge.xml' or die $!;
print {$fh}
q{<?xml version=3D"1.0"?>
<library>
<book>
<title>Dreamcatcher</title>
<author>Stephen King</author>
<genre>Horror</genre>
<pages>899</pages>
<price>23.99</price>
<rating>5</rating>
<publication_date>11/27/2001</publication_date>
</book>
<music>
<title>The Future Will Come</title>
<artist>The Juan Maclean</artist>
<release_date>04/21/2009</release_date>
<label>DFA</label>
</music>
<book>
<title>Mystic River</title>
<author>Dennis Lehane</author>
<genre>Thriller</genre>
<pages>390</pages>
<price>17.49</price>
<rating>4</rating>
<publication_date>07/22/2003</publication_date>
</book>
<music>
<title>Laughing Stock</title>
<artist>Talk Talk</artist>
<release_date>09/16/1991</release_date>
<label>Verve</label>
</music>
<book>
<title>The Lord Of The Rings</title>
<author>J. R. R. Tolkien</author>
<genre>Fantasy</genre>
<pages>3489</pages>
<price>10.99</price>
<rating>5</rating>
<publication_date>10/12/2005</publication_date>
</book>
<music>
<title>Hardcore Will Never Die, But You Will</title>
<artist>Mogwai</artist>
<release_date>02/14/2011</release_date>
<label>Rock Action Records</label>
</music>
</library>
};
close $fh;
my $selected =3D { book =3D> [], music =3D> [] };
my $rdr =3D XML::Reader->new('huge.xml', {mode =3D> 'branches'},
{ root =3D> '/library/book', branch =3D> '*' },
{ root =3D> '/library/music', branch =3D> '*' });
while ($rdr->iterate) {
my $small_ref =3D XMLin($rdr->rvalue);
my $topic =3D $rdr->rx =3D=3D 0 ? 'book' : 'music';
my $dat_ele =3D $topic eq 'book'
? $small_ref->{'publication_date'}
: $small_ref->{'release_date'};
my ($day, $month, $year) =3D $dat_ele =3D~
m{\A (\d+) / (\d+) / (\d+) \z}xms;
unless (defined $day) { $day =3D 0; }
unless (defined $month) { $month =3D 0; }
unless (defined $year) { $year =3D 0; }
my $date =3D sprintf('%04d-%02d-%02d', $year, $month, $day);
if ($topic eq 'book') {
if ($date ge '2002-01-01') {
push @{$selected->{book}}, $small_ref;
}
}
elsif ($topic eq 'music') {
if ($date ge '2002-01-01') {
push @{$selected->{music}}, $small_ref;
}
}
}
print Dumper($selected);
------------------------------
Date: Sun, 13 Nov 2011 16:46:26 -0800 (PST)
From: Martin Vechev <martin.vechev@gmail.com>
Subject: PhD and Postdoc positions at ETH Zurich
Message-Id: <3f33dd7c-e708-41f9-8995-00f15947d32f@k5g2000pre.googlegroups.com>
The newly formed Software Reliability Lab (SRL) at ETH Zurich is
recruiting PhD students and postdocs to do research in (one or more
of) the following areas:
- Static and dynamic program analysis
- Synthesis and verification of concurrent programs
- Programming languages
More information about our research can be found at:
http://www.srl.inf.ethz.ch/research.php
Key requirements for successful applicants:
- Strong interest and commitment to research
- Interest in combining theory and practice
- Competency in English
- For PhD: Excellent B.Sc. or M.Sc. degree in Computer Science (or
related)
For postdoc: PhD degree in Computer Science; publications in
international venues
Applications and questions should be sent to Prof. Dr. Martin Vechev
at: jobs-srl@inf.ethz.ch
The application should include a CV and description of research
interests.
More details about the positions:
- A PhD or a postdoc position is a regular job with attractive salary
and social benefits.
- A position is for a maximum of 6 years.
- One of the top computer science departments in the world.
- Zurich is consistently ranked among the top destinations in the
world for quality of life.
- General information on doctoral studies at ETH: http://www.ethz.ch/doctorate/index_EN
------------------------------
Date: Sat, 12 Nov 2011 05:44:00 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Unexplained delay Module::Build + ExtUtils::MakeMaker building pure perl modules
Message-Id: <50e9c7d8-90a7-49ac-a605-f490e695589e@c18g2000yqj.googlegroups.com>
I am having a problem when building pure perl modules on Windows 7,
ActiveState Perl 5.12.3.
The module build / test / install works correctly, but my issue is
that the build process for a very simple pure perl module
(Acme::SList::Utilities in this case) takes about 60 seconds on my
Windows machine. The Build test and Build install process work rapidly
in about 2 seconds each.
Well, I could just live with that and shut up, after all the whole
Build / Build test / Build install process runs to completion (after
64 seconds).
...hmm...
However, what bugs me is that if I re-Build the module a second time,
the Build process runs in 2 seconds extremely fast (down from 60
seconds in my first Build).
What is even more annoying is that the exact same odd behaviour exists
also with ExtUtils::MakeMaker, both nmake and dmake (first build takes
60 seconds, subsequent builds take only 2 seconds).
Finally, on my Linux Ubuntu box, everything works fast, run to
completion of Build / Build test / Build install in 2 seconds, even on
the first Build. --> This seems to be a Windows issue.
Does anybody share this experience (first build takes 60 seconds for a
pure Perl module) on a Windows box ?
******************************************************
For reference, here is my Build.PL
use strict;
use warnings;
use 5.008;
use Module::Build;
Module::Build->new(
module_name =3D> 'Acme::SList::Utilities',
license =3D> 'perl',
configure_requires =3D> { 'Module::Build' =3D> 0.30 },
requires =3D> { },
dist_abstract =3D> 'Various utilitiy-functions for the SList
suite of programs',
)->create_build_script;
******************************************************
and here is my Makefile.PL
use 5.008;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME =3D> 'Acme::SList::Utilities',
VERSION_FROM =3D> 'lib/Acme/SList/Utilities.pm', # finds
$VERSION
PREREQ_PM =3D> { }, # e.g., Module::Name =3D> 1.1
($] >=3D 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM =3D> 'lib/Acme/SList/Utilities.pm', # retrieve
abstract from module
AUTHOR =3D> 'Klaus Eichner <klaus03@gmail.com>') : ()),
);
******************************************************
And here is a logfile of my first and second Build / Build test /
Build install process:
Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits r=E9serv=E9s.
C:\Acme-SList-Utilities-0.01>perl Build.pl
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Acme-SList-Utilities' version '0.01'
** This takes 60 seconds to complete
C:\Acme-SList-Utilities-0.01>Build
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Building Acme-SList-Utilities
** This takes 2 seconds to complete
C:\Acme-SList-Utilities-0.01>Build test
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
t\0010_test.t .. ok
All tests successful.
Files=3D1, Tests=3D1, 1 wallclock secs ( 0.09 usr + 0.17 sys =3D 0.27
CPU)
Result: PASS
** This takes 2 seconds to complete
C:\Acme-SList-Utilities-0.01>Build install
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Building Acme-SList-Utilities
Building ActivePerl Table of Contents
For ActivePerl's PPM: touch 'C:\Perl\lib\perllocal.pod'
** This takes 2 seconds to complete
C:\Acme-SList-Utilities-0.01>Build
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Building Acme-SList-Utilities
** This now takes also only 2 seconds to complete
** (down from 60 seconds previously)
------------------------------
Date: Sat, 12 Nov 2011 08:52:14 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: Unexplained delay Module::Build + ExtUtils::MakeMaker building pure perl modules
Message-Id: <49cbe4df-1a85-4ae0-bf6d-ea67ac98514b@s7g2000yqa.googlegroups.com>
On 12 nov, 14:44, Klaus <klau...@gmail.com> wrote:
> C:\Acme-SList-Utilities-0.01>perl Build.pl
> [...]
> ** This takes 60 seconds to complete
>
> C:\Acme-SList-Utilities-0.01>Build
> [...]
> ** This takes 2 seconds to complete
whoops, I accidently swapped two lines, the time to completion is, of
course:
C:\Acme-SList-Utilities-0.01>perl Build.pl
[...]
** This takes 2 seconds to complete
C:\Acme-SList-Utilities-0.01>Build
[...]
** This takes 60 seconds to complete
The issue remains:
the build process for a very simple pure perl module
(Acme::SList::Utilities in this case) takes about 60 seconds on my
Windows machine.
Does anybody have the same experience ?
------------------------------
Date: Sat, 12 Nov 2011 12:11:59 -0600
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Unexplained delay Module::Build + ExtUtils::MakeMaker building pure perl modules
Message-Id: <ocCdndnXfZxyKyPTnZ2dnUVZ7vSdnZ2d@bt.com>
Quoth Klaus <klaus03@gmail.com>:
> On 12 nov, 14:44, Klaus <klau...@gmail.com> wrote:
> > C:\Acme-SList-Utilities-0.01>perl Build.pl
> > [...]
> > ** This takes 60 seconds to complete
> >
> > C:\Acme-SList-Utilities-0.01>Build
> > [...]
> > ** This takes 2 seconds to complete
>
> whoops, I accidently swapped two lines, the time to completion is, of
> course:
>
> C:\Acme-SList-Utilities-0.01>perl Build.pl
> [...]
> ** This takes 2 seconds to complete
>
> C:\Acme-SList-Utilities-0.01>Build
> [...]
> ** This takes 60 seconds to complete
>
> The issue remains:
> the build process for a very simple pure perl module
> (Acme::SList::Utilities in this case) takes about 60 seconds on my
> Windows machine.
>
> Does anybody have the same experience ?
IME building perl modules on Windows is always mind-numbingly slow. This
tends to apply more to EUMM modules than MB, since the usual cause is
that Win32 appears to be incapable of creating a process without taking
several seconds.
You say that if you re-run the build it doesn't take so long: what makes
it go back to taking a long time again? Build clean? Is the fact it
takes less time the second time simply because it isn't actually doing
anything? Try rerunning the build with --verbose, to see which steps of
the process are taking the time.
My first suspect for something like this would be some sort of
on-access virus scanner, that's catching every attempt by Build to write
a new file and wasting a whole lot of time scanning it. Do you have
anything like that installed, and can you turn it off?
Ben
------------------------------
Date: Sat, 12 Nov 2011 11:04:03 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: Unexplained delay Module::Build + ExtUtils::MakeMaker building pure perl modules
Message-Id: <b9ccfac1-1f66-439b-b4a2-b83c9afb8d65@q16g2000yqn.googlegroups.com>
On 12 nov, 19:11, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Klaus <klau...@gmail.com>:
> > On 12 nov, 14:44, Klaus <klau...@gmail.com> wrote:
> > > C:\Acme-SList-Utilities-0.01>perl Build.pl
> > > [...]
> > > ** This takes 60 seconds to complete
>
> > > C:\Acme-SList-Utilities-0.01>Build
> > > [...]
> > > ** This takes 2 seconds to complete
>
> > whoops, I accidently swapped two lines, the time to completion is, of
> > course:
>
> > C:\Acme-SList-Utilities-0.01>perl Build.pl
> > [...]
> > ** This takes 2 seconds to complete
>
> > C:\Acme-SList-Utilities-0.01>Build
> > [...]
> > ** This takes 60 seconds to complete
>
> > The issue remains:
> > the build process for a very simple pure perl module
> > (Acme::SList::Utilities in this case) takes about 60 seconds on my
> > Windows machine.
>
> > Does anybody have the same experience ?
>
> IME building perl modules on Windows is always mind-numbingly slow. This
> tends to apply more to EUMM modules than MB, since the usual cause is
> that Win32 appears to be incapable of creating a process without taking
> several seconds.
>
> You say that if you re-run the build it doesn't take so long: what makes
> it go back to taking a long time again? Build clean? Is the fact it
> takes less time the second time simply because it isn't actually doing
> anything? Try rerunning the build with --verbose, to see which steps of
> the process are taking the time.
>
> My first suspect for something like this would be some sort of
> on-access virus scanner, that's catching every attempt by Build to write
> a new file and wasting a whole lot of time scanning it. Do you have
> anything like that installed, and can you turn it off?
Thanks for your comments.
C:\Acme-SList-Utilities-0.01>Build clean
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Cleaning up build files
Yes, a Build clean actually makes it go back to taking a long time
again.
C:\Acme-SList-Utilities-0.01>Build --verbose
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Building Acme-SList-Utilities
Copying lib\Acme\SList\Utilities.pm -> blib\lib\Acme\SList
\Utilities.pm
Manifying blib\lib/Acme/SList/Utilities.pm -> blib\libdoc
\Acme.SList.Utilities.3
Converting Pod to HTML with ActiveState::DocTools::Pod
HTMLifying blib\lib\Acme\SList\Utilities.pm -> blib\libhtml\site\lib
\Acme\SList\Utilities.html
** It's actually the HTMLifying step which takes such a long time.
I suspect that the HTMLifying step of the Build actually crawls the
filesystem (or even worse, goes out on the net to verify external
links)
Anyway, I think I now have an explanation for why the Build takes such
a long time.
Thanks,
Klaus
------------------------------
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 3542
***************************************