Thread: [Module-build-general] Warning on shebang/extending M::B
Status: Beta
Brought to you by:
kwilliams
|
From: Ken Y. C. <kc...@lo...> - 2003-09-10 20:33:49
|
I've been trying to convert a distribution of mine over to use
Module::Build, and I've got a couple of questions
1. This is mostly just annoying and isn't really stopping anything,
but, after I run "perl Build.PL," I get this warning:
* WARNING: Configuration was initially created with '/usr/bin/perl',
but we are now using '/usr/local/bin/perl'.
Both perl's are the same, so it's not a version problem, but see:
$ which perl
/usr/bin/perl
$ perl -MConfig -e 'print "$Config::Config{startperl}\n"'
#!/usr/local/bin/perl
And the latter is what Module::Build::Base::print_build_script uses.
Is there a way to fix this so that it uses whatever is the path for
the binary used to execute "Build.PL" instead?
2. The main reason I want to move away from MakeMaker is because I have
a number of files (HTML templates, configuration files, stylesheet)
that I want to install into directories that the user defines as
arguments to Build.PL. In MM, I'd create extra targets for the
"make install," but with Module::Build the docs say I ought to be
able to just add some code to "ACTION_install" to get this to
happen, but I'm not having any luck. Even something simple like
this doesn't work:
my $builder = Module::Build->subclass(
class => 'My::Builder',
code => q[
sub ACTION_install {
my $self = shift;
print "Yo!\n";
}
]
)->new(
module_name => 'Bio::GMOD::CMap',
dist_author => 'Ken Y. Clark <kc...@cs...>',
dist_name => 'cmap',
dist_version_from => 'lib/Bio/GMOD/CMap.pm',
license => 'gpl',
);
$builder->create_build_script;
When I run "./Build fakeinstall" (because I don't want to actually
install on this machine), I don't see "Yo" but I do see lots of
"Installing..." statements. I've scoured the docs, looked at the
Cookbook, read the perl.com article, and searched the list archives,
but I don't really see how I can add some actions like this. I'd
really appreciate a point to the right docs if they exist, or some
help in making them if they don't.
Also, FWIW, some of the pmtools complain about
Module::Build::Cookbook, e.g.:
$ pmpath Module::Build::Cookbook
/usr/local/bin/pmpath: Module/Build/Cookbook.pm did not return a true value
ky
|
|
From: Dave R. <au...@ur...> - 2003-09-10 20:44:32
|
On Wed, 10 Sep 2003, Ken Y. Clark wrote:
> 2. The main reason I want to move away from MakeMaker is because I have
> a number of files (HTML templates, configuration files, stylesheet)
> that I want to install into directories that the user defines as
> arguments to Build.PL. In MM, I'd create extra targets for the
> "make install," but with Module::Build the docs say I ought to be
> able to just add some code to "ACTION_install" to get this to
> happen, but I'm not having any luck. Even something simple like
> this doesn't work:
>
> my $builder = Module::Build->subclass(
> class => 'My::Builder',
> code => q[
> sub ACTION_install {
> my $self = shift;
> print "Yo!\n";
> }
> ]
> )->new(
> module_name => 'Bio::GMOD::CMap',
> dist_author => 'Ken Y. Clark <kc...@cs...>',
> dist_name => 'cmap',
> dist_version_from => 'lib/Bio/GMOD/CMap.pm',
> license => 'gpl',
> );
> $builder->create_build_script;
>
> When I run "./Build fakeinstall" (because I don't want to actually
> install on this machine), I don't see "Yo" but I do see lots of
> "Installing..." statements. I've scoured the docs, looked at the
> Cookbook, read the perl.com article, and searched the list archives,
> but I don't really see how I can add some actions like this. I'd
> really appreciate a point to the right docs if they exist, or some
> help in making them if they don't.
fakeinstall is a separate action, implemented by a separate method. This
should probably be stated explicitly in the docs, because your expectation
seems reasonable.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/
|
|
From: Dave R. <au...@ur...> - 2003-09-10 21:50:52
|
On Wed, 10 Sep 2003, Ken Y. Clark wrote:
> practices when it comes to what I want to do. Specifically, I want to
> copy HTML templates, an HTML stylesheet, and a configuration file to
> the directories the user has set (or the defaults I have in my
> script). Then I just want to let M::B do it's thing. Something like:
>
> sub ACTION_install {
> my $self = shift;
> copy_files('templates', $template_dir);
> copy_files('conf/cmap.conf', $conf_dir);
> copy_files('conf/cmap.css', $ss_dir);
> $self->SUPER::ACTION_install;
> }
>
> Does that look reasonable? Any suggestions on the best way to write
> the "copy_files" part?
Check out the 'copy_if_modified' method. That's what it is there for.
But use File::Spec in to get 'conf/cmap.conf' for portability!.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/
|
|
From: Ken Y. C. <kc...@lo...> - 2003-09-11 20:48:52
|
On Wed, 10 Sep 2003, Dave Rolsky wrote:
> Date: Wed, 10 Sep 2003 16:50:48 -0500 (CDT)
> From: Dave Rolsky <au...@ur...>
> To: mod...@li...
> Subject: Re: [Module-build-general] Warning on shebang/extending M::B
>
> On Wed, 10 Sep 2003, Ken Y. Clark wrote:
>
> > practices when it comes to what I want to do. Specifically, I want to
> > copy HTML templates, an HTML stylesheet, and a configuration file to
> > the directories the user has set (or the defaults I have in my
> > script). Then I just want to let M::B do it's thing. Something like:
> >
> > sub ACTION_install {
> > my $self = shift;
> > copy_files('templates', $template_dir);
> > copy_files('conf/cmap.conf', $conf_dir);
> > copy_files('conf/cmap.css', $ss_dir);
> > $self->SUPER::ACTION_install;
> > }
> >
> > Does that look reasonable? Any suggestions on the best way to write
> > the "copy_files" part?
>
> Check out the 'copy_if_modified' method. That's what it is there for.
Ah, thanks for that pointer. I glossed over that method.
Any chance to get "copy_if_modified" to also take a "from_dir"
argument and have it glob everything in there (perhaps recursively
grabbing sub-dirs)?
> But use File::Spec in to get 'conf/cmap.conf' for portability!.
Another great tip. Thanks!
ky
|