Thread: [Module::Build] How to require an MB subclass in a CPAN friendly way?
Status: Beta
Brought to you by:
kwilliams
|
From: Tyler M. <ty...@yi...> - 2006-02-17 19:16:20
|
Here's what I've got so far: http://search.cpan.org/src/CRAKRJACK/Schema-RDBMS-AUS-0.01/Build.PL I'm forcing the "install" action to fail without the Module::Build subclass in DBIx::Migration::Directories (which I've noticed lately has a few similarities with App::Build), because without this subclass, the install will be useless to a user. The problem is that if somebody doesn't have DBIx::Migration::Directories installed already, they'll have to go through CPAN twice, since CPAN won't re-run Build.PL after downloading the dependancies. I see this being a problem in the mod_perl world as well, with the Apache::TestMB Module::Build subclass. I know this has been discussed a little bit before, if there's a mailing list archive message with a definate solution or something just point me there and I'll shut up. :)=20 Is there a solution that will make sure that a package using a MB subclass =66rom another package installs cleanly out of CPAN, whether or not that subclass is already installed on a system? Thanks, Tyler |
|
From: Stephen A. <spa...@gm...> - 2006-02-17 19:46:44
|
Hi,
If I understand the problem right, it is that you wish to use a module in t=
he
current distribution (a subclass of Module::Build) to do the installing.
If this is correct, you only need to put a 'use lib "lib";' in your Build.P=
L
for it to be picked up properly. (It does not need to be installed in the
standard places before you use it.)
--------------------------------------------
use lib "lib"; # so we can find Module::Build::Foo before it is installed
use Module::Build::Foo;
my $build =3D Module::Build::Foo->new (
dist_name =3D> "Foo",
dist_version =3D> "0.50",
dist_author =3D> "spa...@gm...",
license =3D> "perl",
requires =3D> {
"Module::Build" =3D> 0, # needed for installing the software
},
);
$build->create_build_script;
--------------------------------------------
Then your install module is in your distribution as
"lib/App/Build/Foo.pm".
Does this solve the problem?
Stephen
Note: On replying, I replied to mod...@li... =
and
did *not* cross-post to cpa...@pe... and mo...@pe....
On 2/17/06, Tyler MacDonald <ty...@yi...> wrote:
> Here's what I've got so far:
>
> http://search.cpan.org/src/CRAKRJACK/Schema-RDBMS-AUS-0.01/Build.=
PL
>
> I'm forcing the "install" action to fail without the Module::Build subcla=
ss
> in DBIx::Migration::Directories (which I've noticed lately has a few
> similarities with App::Build), because without this subclass, the install
> will be useless to a user.
>
> The problem is that if somebody doesn't have DBIx::Migration::Directories
> installed already, they'll have to go through CPAN twice, since CPAN won'=
t
> re-run Build.PL after downloading the dependancies.
>
> I see this being a problem in the mod_perl world as well, with the
> Apache::TestMB Module::Build subclass.
>
> I know this has been discussed a little bit before, if there's a mailing
> list archive message with a definate solution or something just point me
> there and I'll shut up. :)
>
> Is there a solution that will make sure that a package using a MB subclas=
s
> from another package installs cleanly out of CPAN, whether or not that
> subclass is already installed on a system?
>
> Thanks,
> Tyler
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmdlnk&kid=103432&bid#0486&dat=121642
> _______________________________________________
> Module-build-general mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/module-build-general
>
|
|
From: Tyler M. <ty...@yi...> - 2006-02-17 19:54:05
|
Stephen Adkins <spa...@gm...> wrote:
> Hi,
>=20
> If I understand the problem right, it is that you wish to use a module in=
the
> current distribution (a subclass of Module::Build) to do the installing.
> If this is correct, you only need to put a 'use lib "lib";' in your Build=
=2EPL
> for it to be picked up properly. (It does not need to be installed in the
> standard places before you use it.)
Nope, that problem is handled already in
DBIx::Migration::Directories.
I now have a Schema::RDBMS::AUS package, which needs the subclass
that DBIx::Migration::Directories supplies.
DBIx::Migration::Directories::Build needs to be available at the time
Build.PL is run so that it can alter Module::Build's config and supply extra
actions.
Similar case with mod_perl2: If you install an apache2 module that
uses Apache::TestMB, you can't run the tests properly unless mod_perl2 was
installed *before* the Build.PL was run.
I suspect this is also the case with App::Build.
Thanks,
Tyler
> --------------------------------------------
> use lib "lib"; # so we can find Module::Build::Foo before it is install=
ed
> use Module::Build::Foo;
> my $build =3D Module::Build::Foo->new (
> dist_name =3D> "Foo",
> dist_version =3D> "0.50",
> dist_author =3D> "spa...@gm...",
> license =3D> "perl",
> requires =3D> {
> "Module::Build" =3D> 0, # needed for installing the software
> },
> );
> $build->create_build_script;
> --------------------------------------------
> Then your install module is in your distribution as
> "lib/App/Build/Foo.pm".
> Does this solve the problem?
>=20
> Stephen
>=20
> Note: On replying, I replied to mod...@li...=
t and
> did *not* cross-post to cpa...@pe... and mo...@pe....
>=20
> On 2/17/06, Tyler MacDonald <ty...@yi...> wrote:
> > Here's what I've got so far:
> >
> > http://search.cpan.org/src/CRAKRJACK/Schema-RDBMS-AUS-0.01/Buil=
d.PL
> >
> > I'm forcing the "install" action to fail without the Module::Build subc=
lass
> > in DBIx::Migration::Directories (which I've noticed lately has a few
> > similarities with App::Build), because without this subclass, the insta=
ll
> > will be useless to a user.
> >
> > The problem is that if somebody doesn't have DBIx::Migration::Directori=
es
> > installed already, they'll have to go through CPAN twice, since CPAN wo=
n't
> > re-run Build.PL after downloading the dependancies.
> >
> > I see this being a problem in the mod_perl world as well, with the
> > Apache::TestMB Module::Build subclass.
> >
> > I know this has been discussed a little bit before, if there's a mailing
> > list archive message with a definate solution or something just point me
> > there and I'll shut up. :)
> >
> > Is there a solution that will make sure that a package using a MB subcl=
ass
> > from another package installs cleanly out of CPAN, whether or not that
> > subclass is already installed on a system?
> >
> > Thanks,
> > Tyler
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log =
files
> > for problems? Stop! Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > http://sel.as-us.falkag.net/sel?cmdlnk&kid=103432&bid#0486&dat=121642
> > _______________________________________________
> > Module-build-general mailing list
> > Mod...@li...
> > https://lists.sourceforge.net/lists/listinfo/module-build-general
> >
>=20
--=20
Tank will apprehensively negotiate virtual information.
|
|
From: <and...@fr...> - 2006-02-18 11:26:37
|
>>>>> On Fri, 17 Feb 2006 11:53:50 -0800, Tyler MacDonald <ty...@yi...> said: > Stephen Adkins <spa...@gm...> wrote: >> Hi, >> >> If I understand the problem right, it is that you wish to use a module in the >> current distribution (a subclass of Module::Build) to do the installing. >> If this is correct, you only need to put a 'use lib "lib";' in your Build.PL >> for it to be picked up properly. (It does not need to be installed in the >> standard places before you use it.) > Nope, that problem is handled already in > DBIx::Migration::Directories. > I now have a Schema::RDBMS::AUS package, which needs the subclass > that DBIx::Migration::Directories supplies. > DBIx::Migration::Directories::Build needs to be available at the time > Build.PL is run so that it can alter Module::Build's config and supply extra > actions. Add it to your "requires" hash, that way it will end up in META.yml and if people have YAML installed, they can read it and everything should work as you want. If people have YAML not installed they will call either the Makefile.PL or the Build.PL to hopefully find out what the prerequisites are. That way you get the prerequisites but as you have noticed, it is too late for your build process. I don't know how I will fix that. Suggestions welcome. I put it into my Todo file. -- andreas |