ASPEER-MakeMaker
view release on metacpan or search on metacpan
lib/ASPEER/MakeMaker.pm view on Meta::CPAN
die "target module name unavailable for $dest_pn\n";
my $version=$param_hr->{'VERSION'};
my $version_from_fn=$param_hr->{'VERSION_FROM'};
if ($version_from_fn && -f $version_from_fn) {
require ExtUtils::MakeMaker;
my $version_from=MM->parse_version($version_from_fn);
$version=$version_from
if defined($version_from) && length($version_from) && $version_from ne 'undef';
}
$text=~s/\Q$self\E/$name/g;
$text=~s/(\$VERSION\s*=\s*')[^']*(';)/$1$version$2/
if defined($version) && length($version);
blurp($tmp_fn, $text);
chmod($srce_stat[2] & 07777, $tmp_fn)
or die "chmod failed for temporary file $tmp_fn: $!\n";
utime($srce_stat[8], $srce_stat[9], $tmp_fn)
or die "utime failed for temporary file $tmp_fn: $!\n";
rename($tmp_fn, $dest_pn)
or die "rename failed from $tmp_fn to $dest_pn: $!\n";
1;
} or do {
my $err=$@ || 'unknown error';
unlink($tmp_fn) if -e $tmp_fn;
die $err;
};
msg("updated $dest_pn");
return 1;
}
__END__
=begin markdown
# ASPEER::MakeMaker
## Name
ASPEER::MakeMaker - parent entry point and shared make-target methods for MakeMaker plugins
## Synopsis
```perl
use ASPEER::MakeMaker;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Some::Module',
VERSION_FROM => 'lib/Some/Module.pm',
);
```
```perl
use ASPEER::MakeMaker qw(const_config postamble);
```
## Description
`ASPEER::MakeMaker` is the public parent entry point for the distribution. It
sets version metadata, imports shared utility functions from
`ASPEER::MakeMaker::MM::Util`, and forwards import handling to
`ASPEER::MakeMaker::MM::Import`.
When imported without arguments, it requests the `const_config` and `postamble`
MakeMaker sections. The hook installer also enables `depend` and
`post_initialize`, which provide the standard dependency, install-map, and
Git-provenance behavior. Import handling is lazy-loaded and then delegated to
`ASPEER::MakeMaker::MM::Import`.
Child plugins inherit this class and provide a matching `<plugin>::MM` class
and `<plugin>::MM::Constant` package. The shared import layer then dispatches
the plugin's own targets while retaining the common lifecycle behavior. The
module also contains methods intended to be invoked by generated make targets.
## Methods
### import
```perl
use ASPEER::MakeMaker;
use ASPEER::MakeMaker qw(const_config postamble);
```
Enables MakeMaker section hooks. If no sections are supplied, `const_config`
and `postamble` are requested; `depend` and `post_initialize` are installed by
the hook manager as common defaults.
The implementation loads `ASPEER::MakeMaker::MM::Import` and forwards to
its `import` method.
### dump_param
```perl
ASPEER::MakeMaker->dump_param(@makemaker_args, @args);
```
Debugging method. It parses the MakeMaker-style argument list with `arg` and
prints the resulting hash using `Dumper`.
### util_sync
```perl
ASPEER::MakeMaker->util_sync(
@makemaker_args,
$source_file,
);
```
Copies one of this distribution's helper files into a consuming
distribution. The method expects the fixed MakeMaker argument block first,
followed by the source file path. The destination is not passed directly.
Instead, `util_sync` derives it from the parsed `TO_INST_PM` MakeMaker value.
The destination lookup uses the source basename and selects an installed module
path ending in:
```text
MM/<source basename>
```
lib/ASPEER/MakeMaker.pm view on Meta::CPAN
runtime behavior.
Target methods should accept the fixed MakeMaker argument block first and use
`ASPEER::MakeMaker::MM::Util::arg` to separate MakeMaker fields from
target-specific arguments.
The module supports Perl 5.8 and later.
## See Also
- `ASPEER::MakeMaker::MM`
- `ASPEER::MakeMaker::MM::Import`
- `ASPEER::MakeMaker::MM::Util`
- `ASPEER::MakeMaker::MM::Constant`
# AUTHOR
Andrew Speer <andrew.speer@isolutions.com.au>
# LICENSE and COPYRIGHT
This file is part of ASPEER::MakeMaker.
This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Full license text is available at:
<http://dev.perl.org/licenses/>
=end markdown
=head1 ASPEER::MakeMaker
=head2 Name
ASPEER::MakeMaker - parent entry point and shared make-target methods for MakeMaker plugins
=head2 Synopsis
use ASPEER::MakeMaker;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Some::Module',
VERSION_FROM => 'lib/Some/Module.pm',
);
use ASPEER::MakeMaker qw(const_config postamble);
=head2 Description
C<ASPEER::MakeMaker> is the public parent entry point for the distribution. It
sets version metadata, imports shared utility functions from
C<ASPEER::MakeMaker::MM::Util>, and forwards import handling to
C<ASPEER::MakeMaker::MM::Import>.
When imported without arguments, it requests the C<const_config> and C<postamble>
MakeMaker sections. The hook installer also enables C<depend> and
C<post_initialize>, which provide the standard dependency, install-map, and
Git-provenance behavior. Import handling is lazy-loaded and then delegated to
C<ASPEER::MakeMaker::MM::Import>.
Child plugins inherit this class and provide a matching C<<< <plugin>::MM >>> class
and C<<< <plugin>::MM::Constant >>> package. The shared import layer then dispatches
the plugin's own targets while retaining the common lifecycle behavior. The
module also contains methods intended to be invoked by generated make targets.
=head2 Methods
=head3 import
use ASPEER::MakeMaker;
use ASPEER::MakeMaker qw(const_config postamble);
Enables MakeMaker section hooks. If no sections are supplied, C<const_config>
and C<postamble> are requested; C<depend> and C<post_initialize> are installed by
the hook manager as common defaults.
The implementation loads C<ASPEER::MakeMaker::MM::Import> and forwards to
its C<import> method.
=head3 dump_param
ASPEER::MakeMaker->dump_param(@makemaker_args, @args);
Debugging method. It parses the MakeMaker-style argument list with C<arg> and
prints the resulting hash using C<Dumper>.
=head3 util_sync
ASPEER::MakeMaker->util_sync(
@makemaker_args,
$source_file,
);
Copies one of this distribution's helper files into a consuming
distribution. The method expects the fixed MakeMaker argument block first,
followed by the source file path. The destination is not passed directly.
Instead, C<util_sync> derives it from the parsed C<TO_INST_PM> MakeMaker value.
The destination lookup uses the source basename and selects an installed module
path ending in:
MM/<source basename>
For example, a source named C<Util.pm> is matched against a target path ending
in C<MM/Util.pm>.
The method validates that:
( run in 1.690 second using v1.01-cache-2.11-cpan-234fa220139 )