[sf-perl] Mason applications and Module::Build

Keefer, Tim tkeefer at ebay.com
Sun Mar 7 09:45:55 PST 2010


I used the word bundle, but now realize a better word may have been package -- subtle difference i guess. 

The way my code is working is, using ExtUtils::Install, I install the files into a versioned directory and then during the install process I do some other things, i.e. create a symlink for the versioned directory, build application conf , symlink the apache virtual host file, and localize any html. 

The only code my subclass installs is the web application code located in the lib directory. Any external dependencies need to be defined in the Module::Build requires hash which would get installed in the typical CPAN install fashion. Thinking more about this now, it might be useful to have a "./Build install_deps" method that pulls down this code so can also be versioned along with the web application. I can see this becoming unwieldy if the app has a lot of dependencies though.

Thanks for the namespace suggestions - I'm also thinking Module::Build::VirtualHost since technically this a packaging process for the complete set of content for an Apache virtualhost. 

Thanks again,
-Tim

_______________________________________
From: sanfrancisco-pm-bounces+tkeefer=ebay.com at pm.org [sanfrancisco-pm-bounces+tkeefer=ebay.com at pm.org] On Behalf Of Joe Brenner [doom at kzsu.stanford.edu]
Sent: Saturday, March 06, 2010 2:23 PM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Mason applications and Module::Build

I believe there's a Module::Install::Bundle that does something
like this, but then, that's MakeMaker based.

What does this system do in the event that the bundled module
is already installed?  (Over-writing a newer version with an
older one is a recipe for disaster.)

I don't see any place in the Build.PL where you tell it what you
want to bundle, so I gather it traces dependencies automatically.
Is that right?

Perhaps unfortunately, it looks like someone has just grabbed the
name "Module::Build::Bundle", for a minor piece of work that
probably should never have been put on CPAN:

  http://search.cpan.org/~jonasbn/Bundle-JONASBN-0.04/

"Module::Build::Bundling" contains some discussion of the subject
by dagolden:

  http://search.cpan.org/~dagolden/Module-Build-0.3603/lib/Module/Build/Bundling.pod

Hm... there's a "Module::Build::Functions" that contains this hint:

   Deprecated directives

   auto_bundle
   auto_bundle_deps
   bundle
   bundle_deps

   This directives comes from Module::Install::Bundle. The
   author has deliberately chosen to drop support for bundling
   at this point, since Module::Build quite probably will have
   native bundling capabilities soon.

Anyway, I'd suggest bugging people like David Golden about
this... it could be they'd be interested in merging what you've
got into Module::Build itself.

Off the top of my head, if you needed a name for it now:

  Module::Build::Bundler
  Module::Build::AutoBundle


Jonathan Swartz <swartz at pobox.com> wrote:

> I've heard that Catalyst web apps are designed to be easily packaged
> up in this way, you could take a look at what they've done.
>
> You might also ask this question on the Mason user's list.
>
> Jon
>
> On Mar 6, 2010, at 10:32 AM, Keefer, Tim wrote:
>
> > Hi,
> >
> > Does anyone know if there's already some code that supports bundling
> > HTML::Mason or other perl web applications into a CPAN distribution?
> > I've written a Module::Build subclass that works really well for me
> > and I'm wondering if it would be useful for others. I'm also looking
> > for advice about what CPAN namespace it could go under. However, I
> > don't want to go through the trouble of putting this on CPAN if
> > there's already something that does this. Below is a section of the
> > docs that should give you a better idea of what I'm talking about.
> >
> > I realize you guys had a meetup a few weeks ago which would have
> > been a great place to bring this up. I tried to travel up for it,
> > but I'm all the way down in the south part of the bay area and
> > couldn't make it.
> >
> > Cheers,
> > -Tim
> >
> > =head1 Name
> >
> > {some name} - a subclass of Module::Build to perform custom installs
> >
> > =head1 Description
> >
> > Use this module instead of Module::Build (which it subclasses).  Use
> > any or all of the Module::Build constructor keys as needed.
> >
> > =head1 Setting Up Your Application
> >
> > =head2 Application Layout
> >
> > This the typical directory structure for an application
> >
> >    Apps-MyApp/
> >     Build.PL
> >     Changes
> >     MANIFEST
> >     MANIFEST.SKIP
> >     INSTALL.SKIP
> >     conf/
> >             _app.conf
> >             _myapachevhost.conf
> >             app.rules
> >     html/
> >             autohandler.mpl
> >             css/
> >             img/
> >             inc/
> >                     footer.html
> >                     header.html
> >             index.html
> >     lib/
> >             Apps/
> >                        MyApp.pm
> >                     MyApp/
> >                        Foo.pm
> >     t/
> >             01use.t
> >             02myapp.t
> >
> > =head2 Build and Deploy
> >
> >    perl Build.PL
> >    ./Build test     # runs the application tests
> >    ./Build install  # install the application
> >    ./Build dist     # build the application tarbal
> >
> > =over 4
> >
> > =head1 Setting up the application's Aeon Build.PL script
> >
> > =over 4
> >
> > =item Sample Build.PL
> >
> >    use strict;
> >    use File::HomeDir;
> >
> >    my $build = {some name}->new(
> >        install_base_default => ( File::HomeDir->my_home . "/
> > releases" ),
> >        get_options => {
> >            env   =>  { type => '=s' },
> >            rules =>  { type => '=s' },
> >            install_base  => { type => '=s' },
> >        },
> >        apache_conf        => 'conf/myapachevhost.conf',
> >        license                => 'perl',
> >        module_name        => 'Apps::MyApp',
> >        requires           => {
> >            'perl'         => '5.8.1',
> >        },
> >        create_makefile_pl  => 'passthrough',
> >        dist_abstract => 'Mason site for Apps Foo',
> >        script_files        => [ glob('bin/*') ],
> >        'recursive_test_files' => 1,
> >    );
> >
> >    $build->create_build_script;
> > _______________________________________________
> > SanFrancisco-pm mailing list
> > SanFrancisco-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm


More information about the SanFrancisco-pm mailing list