Skip Menu |

This queue is for tickets about the CPAN CPAN distribution.

Report information
The Basics
Id: 30567
Status: open
Priority: 0/
Queue: CPAN

People
Owner: Nobody in particular
Requestors: imacat [...] mail.imacat.idv.tw
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.9204
Fixed in: (no value)



Subject: Machine-readable Module Update Report (r)
Dear Andreas J. König, Hi. This is imacat from Taiwan. I wonder if the "module update report" (r) command can output in a machine-readable format. I was trying to write a weekly checker on the updated modules. It would help a lot if the "r" command can report in a machine-readable format, since I do not want to report if everything is up-to-date, and I want to skip some modules that are not to be updated (discontinued module or version number known to be wrong). It would be better if CPAN can do it itself, of course. If not, I can write a simple wrapper if cpan "r" command can output in a machine-readable format. Please tell me if I could be of any help. Thank you.
Subject: Re: [rt.cpan.org #30567] Machine-readable Module Update Report (r)
Date: Wed, 07 Nov 2007 23:00:24 -0800
To: bug-CPAN [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
via RT wrote: Show quoted text
> Hi. This is imacat from Taiwan. I wonder if the "module update > report" (r) command can output in a machine-readable format. I was > trying to write a weekly checker on the updated modules. It would help > a lot if the "r" command can report in a machine-readable format, since > I do not want to report if everything is up-to-date, and I want to skip > some modules that are not to be updated (discontinued module or version > number known to be wrong). > > It would be better if CPAN can do it itself, of course. If not, I > can write a simple wrapper if cpan "r" command can output in a > machine-readable format. > > Please tell me if I could be of any help. Thank you.
Rather than trying to screen-scrape the results from the shell, you can use the CPAN.pm module itself to write a little program like this: use CPAN; for my $mod ( CPAN::Shell->expand("Module", "/\./") ) { next unless $mod->inst_file; # not installed next if $mod->uptodate; # up to date printf "%s\n", $mod->id; } -- You are wicked and wrong to have broken inside and peeked at the implementation and then relied upon it. -- tchrist in <31832.969261130@chthon>
Subject: Re: [rt.cpan.org #30567] Machine-readable Module Update Report (r)
Date: Thu, 08 Nov 2007 16:18:50 +0800
To: bug-CPAN [...] rt.cpan.org
From: imacat <imacat [...] mail.imacat.idv.tw>
On Thu, 08 Nov 2007 02:01:04 -0500 "Michael G Schwern via RT" <bug-CPAN@rt.cpan.org> wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=30567 > > via RT wrote:
> > trying to write a weekly checker on the updated modules. It would help > > a lot if the "r" command can report in a machine-readable format, since
> Rather than trying to screen-scrape the results from the shell, you can use > the CPAN.pm module itself to write a little program like this:
Oh. I'll try. Thank you very much. -- imacat ^_*' imacat@mail.imacat.idv.tw PGP Key: http://www.imacat.idv.tw/me/pgpkey.asc Tavern IMACAT's http://www.imacat.idv.tw/ Woman's Voice http://www.wov.idv.tw/ TLUG List Manager http://www.linux.org.tw/mailman/listinfo/tlug
Subject: Re: [rt.cpan.org #30567] Machine-readable Module Update Report (r)
Date: Thu, 08 Nov 2007 17:51:48 +0800
To: bug-CPAN [...] rt.cpan.org
From: imacat <imacat [...] mail.imacat.idv.tw>
On Thu, 08 Nov 2007 02:01:04 -0500 "Michael G Schwern via RT" <bug-CPAN@rt.cpan.org> wrote: Show quoted text
> Rather than trying to screen-scrape the results from the shell, you can use > the CPAN.pm module itself to write a little program like this: > use CPAN; > for my $mod ( CPAN::Shell->expand("Module", "/\./") ) { > next unless $mod->inst_file; # not installed > next if $mod->uptodate; # up to date > > printf "%s\n", $mod->id; > }
Well, I have a problem here: How to avoid this message: CPAN: Storable loaded ok (v2.16) Going to read /root/.cpan/Metadata Database was generated on Wed, 07 Nov 2007 03:36:46 GMT I was running from crontab. This message will generate annoying crontab message mails for me. I have searched the document. Maybe I missed something, but I did not found a clue. Should I set $CPAN::Be_Silent = 1? $CPAN::Be_Silent does not seem to be public API. -- imacat ^_*' imacat@mail.imacat.idv.tw PGP Key: http://www.imacat.idv.tw/me/pgpkey.asc Tavern IMACAT's http://www.imacat.idv.tw/ Woman's Voice http://www.wov.idv.tw/ TLUG List Manager http://www.linux.org.tw/mailman/listinfo/tlug
Download (untitled)
application/pgp-signature 195b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #30567] Machine-readable Module Update Report (r)
Date: Thu, 08 Nov 2007 13:57:58 -0800
To: bug-CPAN [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
imacat@mail.imacat.idv.tw via RT wrote: Show quoted text
> Well, I have a problem here: How to avoid this message: > > CPAN: Storable loaded ok (v2.16) > Going to read /root/.cpan/Metadata > Database was generated on Wed, 07 Nov 2007 03:36:46 GMT > > I was running from crontab. This message will generate annoying > crontab message mails for me. > > I have searched the document. Maybe I missed something, but I did > not found a clue. > > Should I set $CPAN::Be_Silent = 1? $CPAN::Be_Silent does not seem > to be public API.
A simple way to work around that would be to dup and then close STDOUT while CPAN starts up and then print your own stuff to the dup'd handle. Making a public way to shut up the CPAN shell would be handy. -- On error resume stupid
Subject: Re: [rt.cpan.org #30567] Machine-readable Module Update Report (r)
Date: Sun, 11 Nov 2007 14:49:55 +0800
To: bug-CPAN [...] rt.cpan.org
From: imacat <imacat [...] mail.imacat.idv.tw>
On Thu, 08 Nov 2007 16:58:34 -0500 "Michael G Schwern via RT" <bug-CPAN@rt.cpan.org> wrote: Show quoted text
> A simple way to work around that would be to dup and then close STDOUT while > CPAN starts up and then print your own stuff to the dup'd handle.
This is not simple. ^^; The simple way is $CPAN::Be_Silent = 1. Duping and closing STDOUT affects all other modules and subroutines that are printing to STDOUT, including my own and the very same script. I was planning like this in a shell script: perl -mCPAN -e'$CPAN::Be_Silent = 1; print join "", map $_->id."\n", grep $_->inst_file && !$_->uptodate && $_->id !~ /^(Test::Harness::Straps|Encode::HanExtra)$/, CPAN::Shell->expand("Module","/./");' Or echo r | cpan | grep \.tar\.gz$ | \ grep -v -E '^(Encode::HanExtra|Test::Harness::Straps)' As you can see, I cannot possibly make it simpler. Show quoted text
> Making a public way to shut up the CPAN shell would be handy.
Yes. Should I file this as a new wishlist on rt.cpan.org? -- Best regards, imacat ^_*' <imacat@mail.imacat.idv.tw> PGP Key: http://www.imacat.idv.tw/me/pgpkey.asc <<Woman's Voice>> News: http://www.wov.idv.tw/ Tavern IMACAT's: http://www.imacat.idv.tw/ TLUG List Manager: http://lists.linux.org.tw/cgi-bin/mailman/listinfo/tlug
Subject: Re: [rt.cpan.org #30567] Machine-readable Module Update Report (r)
Date: Mon, 12 Nov 2007 23:07:27 +0100
To: bug-CPAN [...] rt.cpan.org
From: andreas.koenig.7os6VVqR [...] franz.ak.mind.de (Andreas J. Koenig)
Show quoted text
>>>>> On Sun, 11 Nov 2007 01:50:27 -0500, "imacat@mail.imacat.idv.tw via RT" <bug-CPAN@rt.cpan.org> said:
Show quoted text
>> Making a public way to shut up the CPAN shell would be handy.
Show quoted text
> Yes. Should I file this as a new wishlist on rt.cpan.org?
Yes please. Thanks for bringing it up, you're not the first to ask. I always had the idea that the frontend is managed by a class and the user can configure the name of the class. I was not even aware of $Be_silent. Your new ticket will hopefully lead us somewhere. -- andreas