Using CPAN "lightweight"
am 08.01.2008 23:01:03 von Bernie Cosell
Is there a way to use the CPAN module *without* its creating a directory
and doing all sorts of fancy initialization and such? I want to set up a
program that I'd intended to "use CPAN" and do some mucking about with
modules and such, but when I try to run it I get barraged with dialogs and
it stashes away config stuff and who knows what... I'd like to run it
"self contained", no readline, no ".cpan" directories... just run?
I just tried and when it can't find a $HOME/.cpan dir with its config info
it launches into config-mode again... not so nice for a background task.
Can I somehow predefine all of the vbls that CPAN is looking for so it'll
just find 'em and be happy and not go poking around in the filesystem?
[also, is there a 'quiet' mode -- even when it finds what it wants I get
"Loading LWP...OK.. Fetching with LWP" and all of that stuff].
Thanks!
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
Re: Using CPAN "lightweight"
am 09.01.2008 03:04:15 von Ben Morrow
Quoth Bernie Cosell :
> Is there a way to use the CPAN module *without* its creating a directory
> and doing all sorts of fancy initialization and such? I want to set up a
> program that I'd intended to "use CPAN" and do some mucking about with
> modules and such, but when I try to run it I get barraged with dialogs and
> it stashes away config stuff and who knows what... I'd like to run it
> "self contained", no readline, no ".cpan" directories... just run?
Have you looked at CPANPLUS? It is core as of 5.10, and it was designed
to be a more programmer-friendly replacement for CPAN.
Ben
Re: Using CPAN "lightweight"
am 09.01.2008 13:14:54 von Bernie Cosell
Ben Morrow wrote:
} Quoth Bernie Cosell :
} > Is there a way to use the CPAN module *without* its creating a directory
} > and doing all sorts of fancy initialization and such?
} Have you looked at CPANPLUS? It is core as of 5.10, and it was designed
} to be a more programmer-friendly replacement for CPAN.
Ah, no. Didn't know there was such a thing... We're just in the midst of
installing 5.10 so it is probably here on the server *someplace* ...
THANKS!
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
Re: Using CPAN "lightweight"
am 09.01.2008 20:07:28 von brian d foy
In article <96s7o312i1lcro9a1aar7a9aih3avu5oer@library.airnews.net>,
Bernie Cosell wrote:
> Is there a way to use the CPAN module *without* its creating a directory
> and doing all sorts of fancy initialization and such?
Well, at some point you need to store the files somewhere.
Are you trying to run CPAN.pm within a script? If you say more about
what you are trying to accomplish I may be able to help. It's easy to
configure CPAN.pm from within a program. You just have to do it (and
then it won't go looking for CPAN/MyConfig.pm. Your best bet is to do
the manual configuration, adjust it as you need it, then load that
configuration programmatically.
However, CPAN.pm (or CPANPLUS), are going to need to store files
somewhere.
Re: Using CPAN "lightweight"
am 09.01.2008 20:26:00 von Bernie Cosell
Ben Morrow wrote:
} Have you looked at CPANPLUS? It is core as of 5.10, and it was designed
} to be a more programmer-friendly replacement for CPAN.
Works wonderfully!! Only one little thing I can't quite sort out from the
various CPANPLUS::* manpages: it is possible to *turn*off* the custom
sources machinery?
This little program:
my $cb = CPANPLUS::Backend->new ;
my $mod = $cb->module_tree('File::Find') ;
print "File::Find -> ".$mod->description."\n" ;
print "CPAN version: ".$mod->version."\n" ;
got me almost *exactly* what I wanted:
[MSG] No '/staff/bernie/.cpanplus/custom-sources' dir, skipping custom
sources
File::Find -> Call func for every item in a directory tree
CPAN version: 1.12
except for the '[MSG]' -- I see that that's listed [in ::Backend] as being
a feature, and a nice one, too!! But it'd be nicer if I could tell it
either to quietly ignore the error or even very much better, since I don't
know anything about the $HOME configs of the people that'll be using this
app, simply to disable the custom-sources machinery. I did a check of
'conf' options in the configure_object but I didn't see one that looked
like it might affect the custom-sources stuff... ??
Thanks! /bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
Re: Using CPAN "lightweight"
am 09.01.2008 21:19:10 von brian d foy
In article ,
Bernie Cosell wrote:
> Ben Morrow wrote:
>
> } Have you looked at CPANPLUS? It is core as of 5.10, and it was designed
> } to be a more programmer-friendly replacement for CPAN.
>
> Works wonderfully!! Only one little thing I can't quite sort out from the
> various CPANPLUS::* manpages: it is possible to *turn*off* the custom
> sources machinery?
>
> This little program:
>
> my $cb = CPANPLUS::Backend->new ;
> my $mod = $cb->module_tree('File::Find') ;
> print "File::Find -> ".$mod->description."\n" ;
> print "CPAN version: ".$mod->version."\n" ;
Here's the _show_Details that implements the -D switch in the cpan(1)
program that comes with Perl. It's as easy as CPANPLUS:
sub _show_Details
{
my $args = shift;
foreach my $arg ( @$args )
{
my $module = CPAN::Shell->expand( "Module", $arg );
my $author = CPAN::Shell->expand( "Author",
$module->userid );
next unless $module->userid;
print "$arg\n", "-" x 73, "\n\t";
print join "\n\t",
$module->description ? $module->description :
"(no description)",
$module->cpan_file,
$module->inst_file,
'Installed: ' . $module->inst_version,
'CPAN: ' . $module->cpan_version . ' ' .
($module->uptodate ? "" : "Not ") . "up
to date",
$author->fullname . " (" . $module->userid .
")",
$author->email;
print "\n\n";
}
}
Re: Using CPAN "lightweight"
am 10.01.2008 13:50:44 von Bernie Cosell
brian d foy wrote:
} In article <96s7o312i1lcro9a1aar7a9aih3avu5oer@library.airnews.net>,
} Bernie Cosell wrote:
}
} > Is there a way to use the CPAN module *without* its creating a directory
} > and doing all sorts of fancy initialization and such?
}
} Well, at some point you need to store the files somewhere.
}
} Are you trying to run CPAN.pm within a script? If you say more about
} what you are trying to accomplish I may be able to help.
At the moment, the program's only purpose is to generate an email [to the
sysadmin] about available new versions of installed modules. Except for
the [MSG] thing, I mostly have it working [and it is only something like 20
lines of actual code, ignoring 'use's and comments and such -- I'll post it
later when I get it fully working].
As for the download, I'm guessing that what they'll want is the equivalent
of "wget" -- once again, no big-deal directories of config and memory of
past downloads or history any such, just a simple "fetch me the latest
version of File::Find and store it in the current directory"
} ... It's easy to
} configure CPAN.pm from within a program. You just have to do it (and
} then it won't go looking for CPAN/MyConfig.pm. Your best bet is to do
} the manual configuration, adjust it as you need it, then load that
} configuration programmatically.
I'm not sure "easy" is quite fair... There's a very long list of config
vbls with not much said about them, and not much said overall about making
CPAN quiet and not mess with homedirectories or any similar stuff. As for
the "when you run it the first time" configuration, I wonder what'll happen
with that. The docs just say:
When the CPAN module is used for the first time, a
configuration dialog tries to determine a couple of site
specific options. The result of the dialog is stored in a
hash reference $CPAN::Config in a file CPAN/Config.pm.
But the "CPAN" directory is *read*only* so it ain't gonna store anything
there [it is mounted from a read-only filesystem, so even *root* can't
write anything to it!]. And I see the 'interactive' stuff talking about 'o
conf' command but virtually nothing about doing it programatically.
Will CPAN be better behaved [and less noisy] if I run it just once from
someplace where it *can* write to the CPAN install directory? Although
that's going a bit of a problem because the environment of that system is
quite different from the environment on the system on which we're actually
going to be *using* CPAN [e.g., paths to utilities are different, directory
structure is [very] different, etc].
Basically, CPAN seems to be trying to do a LOT more than I really want and
it doesn't seem easy to trim it down, which is why CPANPLUS seemed to wor
out better, but even *IT* is trying to do some fancier-than-I-need
stuff...:o)
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
Re: Using CPAN "lightweight"
am 11.01.2008 22:23:32 von brian d foy
In article ,
Bernie Cosell wrote:
> brian d foy wrote:
>
> } ... It's easy to
> } configure CPAN.pm from within a program. You just have to do it (and
> } then it won't go looking for CPAN/MyConfig.pm. Your best bet is to do
> } the manual configuration, adjust it as you need it, then load that
> } configuration programmatically.
>
> I'm not sure "easy" is quite fair... There's a very long list of config
> vbls with not much said about them,
The docs for CPAN::FirstTime explains all of them, including how to
disable certain messages.
> and not much said overall about making
> CPAN quiet
When you use the programmers interface, you just don't output anything
you don't wnat to output. It's up to you.
> But the "CPAN" directory is *read*only*
No, that's a relative path, and it's relative to where you tell CPAN.pm
to put it. You could, but don't hve to, make the config file
interactively using this methong.
> Basically, CPAN seems to be trying to do a LOT more than I really want and
> it doesn't seem easy to trim it down, which is why CPANPLUS seemed to wor
> out better, but even *IT* is trying to do some fancier-than-I-need
> stuff...:o)
Both of them can do quite a bit, and fi either works for you that's
great. Just be careful that what you say about either of them is true.
:)