Is there one CPAN module to do install/uninstall/locallist etc.?

2013-03-13 Thread chenlin rao
Hi all!
   I found some modules like App::CPANMinus, App::pmodinfo,
App::pmuninstall and so on. But why there aren't one CPAN module to do
these together?
   I'm writing a puppet provider for cpan, but now I found I need to
pre-install several modules for '--list', '--install', '--update',
'--uninstall' while rubygems can do these all.
   Any help?


CPAN and AI::Prolog

2013-03-13 Thread John Sampson

Hello -

I installed Strawberry Prolog on Windows 7 and tried to install 
AI::Prolog from the CPAN.
As far as I can see from the slew of messages this failed due to lack of 
software packages

on which it depends (or depended).
I have three questions:
Has anyone recently successfully installed AI::Prolog?
What is the percentage rate of successful installations from CPAN to 
unsuccessful ones?

Is CPAN a going concern?

Regards

John Sampson

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: CPAN and AI::Prolog

2013-03-13 Thread John SJ Anderson
On Wed, Mar 13, 2013 at 5:18 AM, John Sampson  wrote:
> Hello -
>
> I installed Strawberry Prolog on Windows 7 and tried to install AI::Prolog
> from the CPAN.

I assume you mean "Strawberry Perl".

> As far as I can see from the slew of messages this failed due to lack of
> software packages
> on which it depends (or depended).
> I have three questions:
> Has anyone recently successfully installed AI::Prolog?

Based on the CPAN testers information in the sidebar of
https://metacpan.org/module/AI::Prolog, it's been successfully
installed at least 154 times -- because it's passed tests that many
times.

> What is the percentage rate of successful installations from CPAN to
> unsuccessful ones?

Looks like 100% successful -- there are no test failurse.

> Is CPAN a going concern?

Yes, very much so.

Now, to return to your problem, what did you actually do, and what
error message(s) did you get?

thanks,
john.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: CPAN and AI::Prolog

2013-03-13 Thread Brian Fraser
On Wed, Mar 13, 2013 at 9:18 AM, John Sampson  wrote:
> Hello -
>
> I installed Strawberry Prolog on Windows 7 and tried to install AI::Prolog
> from the CPAN.
> As far as I can see from the slew of messages this failed due to lack of
> software packages
> on which it depends (or depended).
> I have three questions:
> Has anyone recently successfully installed AI::Prolog?

Just did. Like you mentioned, one of the dependencies, Text::Quote,
failed to install. I checked the build log and saw this:

#   Failed test 'Quote Regexp'
#   at t/quote.t line 80.
#  got: 'qr/(?^:ABCDEF)/'
# expected: 'qr/ABCDEF/'
# Looks like you failed 1 test of 52.
t/quote.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/52 subtests

That's broken because of a change in how regexen are serialized in
5.14+, but because not everyone might now that, I checked the module's
bug tracker, and there's a similar explanation there. So the failure
looks more like overzealous testing, rather than anything being
particularly broken in the module.
Going from that, it seemed pretty harmless to force the installation,
after which AI::Prolog installed without a hitch.

$ cpanm AI::Prolog
$ cpanm -f Text::Quote
$ cpanm AI::Prolog

> What is the percentage rate of successful installations from CPAN to
> unsuccessful ones?

Dunno. My experience has been pretty good -- generally used modules
are maintained an just work, and unless the module has C bindings,
they are generally pretty resistant to changes in Perl.

> Is CPAN a going concern?

Sure. IIRC half of it is actively maintained (i.e. commits within the
year), and all of it is routinely tested against several versions of
Perl & different environments.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




CPAN and AI::Prolog

2013-03-13 Thread John Sampson

On 13/03/2013 17:11, John SJ Anderson wrote:

On Wed, Mar 13, 2013 at 5:18 AM, John Sampson  wrote:

Hello -

I installed Strawberry Prolog on Windows 7 and tried to install AI::Prolog
from the CPAN.

I assume you mean "Strawberry Perl".


As far as I can see from the slew of messages this failed due to lack of
software packages
on which it depends (or depended).
I have three questions:
Has anyone recently successfully installed AI::Prolog?

Based on the CPAN testers information in the sidebar of
https://metacpan.org/module/AI::Prolog, it's been successfully
installed at least 154 times -- because it's passed tests that many
times.


What is the percentage rate of successful installations from CPAN to
unsuccessful ones?

Looks like 100% successful -- there are no test failurse.


Is CPAN a going concern?

Yes, very much so.

Now, to return to your problem, what did you actually do, and what
error message(s) did you get?

thanks,
john.



Many thanks. I did mean Strawberry Perl rather than Strawberry Prolog, 
which exists but has no connection with Perl.

My apologies.

Something has come up which means I will have to shelve these efforts 
for a few weeks, but it is good to know from live
people that I am looking at a going concern. Thank you for the pointer 
to the testers' information.


Regards

John Sampson

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread G M

Hi all,

I'm making an attempt at my first screen scraping script.

For some reason the script doesn't continue after the invocation of the get 
method on the last line:

use strict;
use WWW::Mechanize;
use HTML::TokeParser;
use Data::Dumper;
print "Content-type: text/html\n\n";
print "setting up mech";
my $agent = WWW::Mechanize->new();
   $agent->agent_alias('Windows Mozilla');
   print "mech setup";
  $agent->get('http://www.easyjet.com/en/');


Can anyone see anything wrong with this?  I've tried double quotes and 
different urls but it doesn't attempt to "get" the page.


Thanks in advance for any advice on this.

G :)
  

Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Jim Gibson

On Mar 13, 2013, at 12:09 PM, G M wrote:

> 
> Hi all,
> 
> I'm making an attempt at my first screen scraping script.
> 
> For some reason the script doesn't continue after the invocation of the get 
> method on the last line:
> 
> use strict;
> use WWW::Mechanize;
> use HTML::TokeParser;
> use Data::Dumper;
> print "Content-type: text/html\n\n";
> print "setting up mech";
> my $agent = WWW::Mechanize->new();
>   $agent->agent_alias('Windows Mozilla');
>   print "mech setup";
>  $agent->get('http://www.easyjet.com/en/');
> 
> 
> Can anyone see anything wrong with this?  I've tried double quotes and 
> different urls but it doesn't attempt to "get" the page.

I can see that you are not saving the return result from $agent->get().

What do you mean by "the script doesn't continue"? Does the script hang or does 
it terminate? Is there any error message? 

Is there more to the script than you are showing? 

How do you know that it "doesn't attempt to 'get' the page"? Maybe it attempts 
to get the page and fails.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Andy Bach
On Wed, Mar 13, 2013 at 2:09 PM, G M  wrote:

>
> I'm making an attempt at my first screen scraping script.


Works here:
!/usr/bin/perl
use strict;
use WWW::Mechanize;
use HTML::TokeParser;
use Data::Dumper;
print "Content-type: text/html\n\n";
print "setting up mech";
my $agent = WWW::Mechanize->new();
   $agent->agent_alias('Windows Mozilla');
   print "mech setup";
  my $page = $agent->get('http://www.easyjet.com/en/');
   print "mech ran", ref $agent, "\n";
#   print "agent: ", Dumper(\$agent), "\n";
#   print "page: ", Dumper(\$page), "\n";
   print "page ran", ref $page, "\n";
   if ($page->is_success) {
   print "page content", "\n";
   print $page->decoded_content;
   }
   else {
 print STDERR $page->status_line, "\n";
   }


$page is an "HTTP::Response" object, I get decoded_content() but the
warning:
Wide character in print at /usr/local/bin/mech_test.pl line 18.

that's the print page.

-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Lawrence Statton

On 03/13/2013 01:46 PM, Andy Bach wrote:

Wide character in print at /usr/local/bin/mech_test.pl line 18.

that's the print page.


By the way -- you can eliminate the wide-char warniung by telling perl 
that your terminal can eat UTF-8 encoded unicode


binmode STDOUT, ":utf8";



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Charles DeRykus
On Wed, Mar 13, 2013 at 12:09 PM, G M  wrote:
>
> Hi all,
>
> I'm making an attempt at my first screen scraping script.
>
> For some reason the script doesn't continue after the invocation of the get 
> method on the last line:
>
> use strict;
> use WWW::Mechanize;
> use HTML::TokeParser;
> use Data::Dumper;
> print "Content-type: text/html\n\n";
> print "setting up mech";
> my $agent = WWW::Mechanize->new();
>$agent->agent_alias('Windows Mozilla');
>print "mech setup";
>   $agent->get('http://www.easyjet.com/en/');
>
>
> Can anyone see anything wrong with this?  I've tried double quotes and 
> different urls but it doesn't attempt to "get" the page.
>

Hm,  what code follows the "get"?

Always a good idea to  check for errors in case of site
outage for instance.  However this worked for me a few
moments ago when  I tried:

  $agent->get(...);
  die $agent->status unless $agent->success;  ";
  print "content:  $a->content";

-- 
Charles DeRykus

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread G M

Hi,

Yeah I tried putting a die line in after doing a bit of googling, I've got a 
print "mech ran" line where you've got "die", doesn't print anything out though 
:(



Cheers,

G 
> Date: Wed, 13 Mar 2013 13:04:39 -0700
> Subject: Re: Mechanize: first attempt at scraping (should be something 
> trivial)
> From: dery...@gmail.com
> To: iamnotregiste...@hotmail.com
> CC: beginners@perl.org
> 
> On Wed, Mar 13, 2013 at 12:09 PM, G M  wrote:
> >
> > Hi all,
> >
> > I'm making an attempt at my first screen scraping script.
> >
> > For some reason the script doesn't continue after the invocation of the get 
> > method on the last line:
> >
> > use strict;
> > use WWW::Mechanize;
> > use HTML::TokeParser;
> > use Data::Dumper;
> > print "Content-type: text/html\n\n";
> > print "setting up mech";
> > my $agent = WWW::Mechanize->new();
> >$agent->agent_alias('Windows Mozilla');
> >print "mech setup";
> >   $agent->get('http://www.easyjet.com/en/');
> >
> >
> > Can anyone see anything wrong with this?  I've tried double quotes and 
> > different urls but it doesn't attempt to "get" the page.
> >
> 
> Hm,  what code follows the "get"?
> 
> Always a good idea to  check for errors in case of site
> outage for instance.  However this worked for me a few
> moments ago when  I tried:
> 
>   $agent->get(...);
>   die $agent->status unless $agent->success;  ";
>   print "content:  $a->content";
> 
> -- 
> Charles DeRykus
  

Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Charles DeRykus
On Wed, Mar 13, 2013 at 1:08 PM, G M  wrote:
> Hi,
>
> Yeah I tried putting a die line in after doing a bit of googling, I've got a
> print "mech ran" line where you've got "die", doesn't print anything out
> though :(
>
>
>

Hm, the problem is that Mech by default throws fatal errors so if
it couldn't fetch content, your program dies before "mech ran"
occurs. Only if you said $agent->new(autocheck=>0), would you
see it.

You can see the differing output in these:

$agent->new(autocheck=>0);  # toggle 0/1
$agent->get("http://nowhere.com/nono";);
print "mech ran";

-- 
Charles DeRykus

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread G M

Definitely appears to be network related as I'm getting this when using 
warnings/fatalsToBrowser:

Error GETing http://www.easyjet.com/en/: Can't connect to www.easyjet.com:80 
(connect: Connection refused)


> Date: Wed, 13 Mar 2013 14:19:00 -0700
> Subject: Re: Mechanize: first attempt at scraping (should be something 
> trivial)
> From: dery...@gmail.com
> To: iamnotregiste...@hotmail.com
> CC: beginners@perl.org
> 
> On Wed, Mar 13, 2013 at 1:08 PM, G M  wrote:
> > Hi,
> >
> > Yeah I tried putting a die line in after doing a bit of googling, I've got a
> > print "mech ran" line where you've got "die", doesn't print anything out
> > though :(
> >
> >
> >
> 
> Hm, the problem is that Mech by default throws fatal errors so if
> it couldn't fetch content, your program dies before "mech ran"
> occurs. Only if you said $agent->new(autocheck=>0), would you
> see it.
> 
> You can see the differing output in these:
> 
> $agent->new(autocheck=>0);  # toggle 0/1
> $agent->get("http://nowhere.com/nono";);
> print "mech ran";
> 
> -- 
> Charles DeRykus
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
> 
> 
  

Re: Is there one CPAN module to do install/uninstall/locallist etc.?

2013-03-13 Thread Brad Lhotsky
You can do all these things via CPAN.pm using the cpan binary.  cpanm is
very nice as well, here's some work I did with an off-system perl that
provides stubs for automated testing and such:

https://github.com/reyjrar/optperl/tree/master/optperl.puppet

This repo has a lot more stuff, like the RPM specfile for building the
off-system perl without ridiculous dependency injection into your RPMDB.
 Generally speaking, you should manage CPAN Modules either *completely*
with CPAN/CPANM/CPANPLUS or with a .rpm / .deb, never with both.  The
reason I mention this, is if you're mucking about with the included Perl on
RedHat-based distributions you will introduce all sorts of pain upon
yourself by installing *anything* with CPAN.




On Wed, Mar 13, 2013 at 11:59 AM, chenlin rao  wrote:

> Hi all!
>I found some modules like App::CPANMinus, App::pmodinfo,
> App::pmuninstall and so on. But why there aren't one CPAN module to do
> these together?
>I'm writing a puppet provider for cpan, but now I found I need to
> pre-install several modules for '--list', '--install', '--update',
> '--uninstall' while rubygems can do these all.
>Any help?
>



-- 
Brad Lhotsky