Telephone +44(0)1524 64544
Email: info(at)shadowcat.co.uk

Sat Dec 22 00:30:00 2012

Slides for the talk anatomy-of-eumm at gpw-2010

Anatomy of
ExtUtils::MakeMaker

-

Shadowcat
Systems

-

Lancaster
(NW England)

-

Catalyst
DBIx::Class
Moose

-

Thanks
GPW!

-

ExtUtils::MakeMaker

-

Build and
install perl
distributions

-

Makefile.PL

-

Makefile

-

  perl Makefile.PL
  make
  make test
  make install

-

Create perl
distributions

-

  make manifest
  make distdir
  make disttest
  make dist

-

Perl dists
are not just
for CPAN

-

Module::Build
Module::Install

-

Module::Build

-

Upsides

-

pure
perl

-

  perl Build.PL
  perl Build
  perl Build test
  perl Build install

-

Provides extra
author side
tooling

-

  ./Build testcover
  ./Build testpod
  ./Build testpodcoverage

-

  ./Build installdeps

-

Simple
subclassing

-

Downsides

-

Compat
history

-

--install_base
(2006)

-

Module::Build
upgrades before
Build (2010)

-

Ideal world
architecture

-

configure_requires

-

  cpan Catalyst
  && cpan Catalyst

-

Insufficiently
defensive

-

  use YAML;

-

Module::Build
failed to load

-

  use YAML::Node;

-

Opaque

-

"but it's
just perl"

-

Sysadmin
RAAAAAGE

-

Module::Install

-

Upsides

-

Self
bundling

-

inc/

-

Uses
MakeMaker

-

makemaker_args()

-

  make installdeps

-

  make installdeps
  make upload

-

  feature()
  recommends()

-

Lots of
extensions

-

Module::Install::

-

AuthorRequires
ExtraTests

-

CheckConflicts
AssertOS

-

AutoProvides
AutoProvidesFromClass
AutoProvidesFromCompilation

-

Catalyst

-

Downsides

-

Self
bundling

-

Written
by Audrey
*and* Ingy

-

feature()
requires
auto_install()

-

Under
documented

-

String based
Makefile
mangling

-

ExtUtils::MakeMaker

-

Upsides

-

Installed
everywhere

-

Well known
standard

-

Cross platform
Cross make
Cross compiler 

-

Surprisingly
powerful

-

Makefile
mangling

-

  perl -pi -e
    's/.../...'
    Makefile

-

  make -n
    | perl -pi -e
        's/.../.../'
    | sh

-

Downsides

-

Can't have
dependencies

-

Can't use
newer perl
features

-

Cross platform
make *hurts*

-

"Old"

-

Few new
features

-

No longer
widely
understood

-

That, I
can fix.

-

-

Schwern

-

Class::DBI

-

DBIx::Class::CDBICompat

-

Hair
off!

-

Beer
fail

-

ExtUtils::MakeMaker

-

No new
features

-

What?

-

META_ADD
META_MERGE
CONFIGURE_REQUIRES

-

  package NAME VERSION

-

5.12

-

"I'm done"

-

"hi"

-

(ohshitohshit
ohshitohshit)

-

-

  use ExtUtils::MakeMaker

-

  prompt()
  WriteMakefile()

-

prompt()

-

PERL_MM_USE_DEFAULT

-

WriteMakefile()

-

MY
ExtUtils::MakeMaker
ExtUtils::MM_${OS}
ExtUtils::MM_Unix
ExtUtils::MM_Any

-

Except
not quite

-

MY
ExtUtils::MY
ExtUtils::MM

-

PACK001
MM
ExtUtils::MM

-

ExtUtils::MM
ExtUtils::Liblist
ExtUtils::MakeMaker
ExtUtils::MM_${OS}

-

ExtUtils::MM_${OS}
ExtUtils::MM_Unix
ExtUtils::MM_Any

-

ExtUtils::MM_Win32
ExtUtils::MM_Any
ExtUtils::MM_Unix

-

WriteMakefile

-

MM->new

-

sub MY::postamble

-

PACK001

-

sdbm/Makefile.PL

-

PREREQ_PM

-

CONFIGURE

-

subdirs

-

@MM_Sections

-

post_initialize const_config constants platform_constants
tool_autosplit tool_xsubpp tools_other makemakerdflt
dist macro depend cflags const_loadlibs const_cccmd
post_constants pasthru special_targets c_o xs_c xs_o
top_targets blibdirs linkext dlsyms dynamic dynamic_bs
dynamic_lib static static_lib manifypods processPL
installbin subdirs clean_subdirs clean realclean_subdirs
realclean metafile signature dist_basics dist_core distdir
dist_test dist_ci distmeta distsignature install force
perldepend makefile staticmake test ppd

-

c_o (o)

-

  sub MY::const_cccmd {
    my $make_frag = shift->SUPER::const_ccmd(@_);
    $make_frag =~ s/-O/-O3/;
    $make_frag
  }

-

  OPTIMIZE
    => '-O3'

-

  sub MY::postamble {
    require DBI;
    require DBI::DBD;
    eval {
      DBI::DBD::dbd_postamble(@_);
    }
  }

-

$mm->flush

-

WriteMakefile()

-

  WriteMakefile(
    NAME => 'Foo::Bar',
    VERSION => '0.01'
  );

-

  WriteMakefile(
    NAME => 'Foo::Bar',
    VERSION => '0.1.1',
    XS_VERSION => '0.001001',
  );

-

  WriteMakefile(
    NAME => 'Foo::Bar',
    VERSION => '0.01',
    ABSTRACT => 'Metasyntactic frobulator',
    AUTHOR => 'Baz Quuz',
    LICENSE => 'perl'
  );

-

  WriteMakefile(
    NAME => 'Foo::Bar',
    VERSION_FROM => 'lib/Foo/Bar.pm',
    ABSTRACT_FROM => 'lib/Foo/Bar.pm',
    AUTHOR => 'Baz Quuz',
    LICENSE => 'perl'
  );

-

  WriteMakefile(
    ...,
    PREREQ_PM => {
      'Test::More' => '0.94'
    },

-

    PREREQ_PM => {
      'Test::More' => '0.94'
    },
    BUILD_REQUIRES => {
      'Test::More' => '0.94'
    },
    CONFIGURE_REQUIRES => {
      'DBI' => '1.51'
    }

-

    META_ADD =>
    META_MERGE =>

-

    EXE_FILES => [
      <bin/*>
    ],

-

  make
  make manifest
  make distdir

-

  make distdir
  make disttest
  make dist

-

  cpan-upload
    ./Foo-Bar-0.01.tar.gz

-

(Dist::Zilla
generates
Makefile.PLs)

-

ExtUtils::MakeMaker

-

Questions?

-

http://ironman.enlightenedperl.org/
http://shadowcat.co.uk/blog/matt-s-trout
http://twitter.com/shadowcat_mst
http://github.com/shadowcat-mst