ASPEER-MakeMaker

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

                            Preamble

  The license agreements of most software companies try to keep users
at the mercy of those companies.  By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

LICENSE  view on Meta::CPAN

Program or a portion of it, either verbatim or with modifications.  Each
licensee is addressed as "you".

  1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program.  You may charge a fee for the physical act of
transferring a copy.

  2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:

    a) cause the modified files to carry prominent notices stating that
    you changed the files and the date of any change; and

    b) cause the whole of any work that you distribute or publish, that
    in whole or in part contains the Program or any part thereof, either

LICENSE  view on Meta::CPAN


    c) If the modified program normally reads commands interactively when
    run, you must cause it, when started running for such interactive use
    in the simplest and most usual way, to print or display an
    announcement including an appropriate copyright notice and a notice
    that there is no warranty (or else, saying that you provide a
    warranty) and that users may redistribute the program under these
    conditions, and telling the user how to view a copy of this General
    Public License.

    d) You may charge a fee for the physical act of transferring a
    copy, and you may at your option offer warranty protection in
    exchange for a fee.

Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.

  3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:

LICENSE  view on Meta::CPAN

    years, to give any third party free (except for a nominal charge
    for the cost of distribution) a complete machine-readable copy of the
    corresponding source code, to be distributed under the terms of
    Paragraphs 1 and 2 above; or,

    c) accompany it with the information you received as to where the
    corresponding source code may be obtained.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form alone.)

Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer

README  view on Meta::CPAN

- once for Import.pm

After each copy, the target rewrites occurrences of ASPEER::MakeMaker in
the destination file to the consuming distribution's $(NAME).

The destination is derived from the consuming distribution's TO_INST_PM
install map. Current child plugins inherit these modules directly and do
not run util_sync; the target remains available for a future vendoring
or standalone maintenance use case.

Local Overrides

ASPEER::MakeMaker::MM::Constant loads default constants from the module
and then applies optional local overrides from:

- a .local file next to Constant.pm
- ~/.ASPEER::MakeMaker::MM::Constant.local

Each override file is expected to evaluate to a hash reference.

Documentation Map

The module-level sidecar documents describe the individual pieces:

- lib/ASPEER/MakeMaker.pm.md
- lib/ASPEER/MakeMaker/MM/Import.pm.md
- lib/ASPEER/MakeMaker/MM.pm.md
- lib/ASPEER/MakeMaker/MM/Util.pm.md
- lib/ASPEER/MakeMaker/MM/Constant.pm.md

README.md  view on Meta::CPAN

- once for `Import.pm`

After each copy, the target rewrites occurrences of `ASPEER::MakeMaker`
in the destination file to the consuming distribution's `$(NAME)`.

The destination is derived from the consuming distribution's `TO_INST_PM`
install map. Current child plugins inherit these modules directly and do not
run `util_sync`; the target remains available for a future vendoring or
standalone maintenance use case.

## Local Overrides

`ASPEER::MakeMaker::MM::Constant` loads default constants from the module and
then applies optional local overrides from:

- a `.local` file next to `Constant.pm`
- `~/.ASPEER::MakeMaker::MM::Constant.local`

Each override file is expected to evaluate to a hash reference.

## Documentation Map

The module-level sidecar documents describe the individual pieces:

- `lib/ASPEER/MakeMaker.pm.md`
- `lib/ASPEER/MakeMaker/MM/Import.pm.md`
- `lib/ASPEER/MakeMaker/MM.pm.md`
- `lib/ASPEER/MakeMaker/MM/Util.pm.md`
- `lib/ASPEER/MakeMaker/MM/Constant.pm.md`

SECURITY.md  view on Meta::CPAN

This policy was updated on 2026-09-26.

## Reporting a Security Vulnerability

Please report security vulnerabilities via GitHub private vulnerability
reporting for this repository:

https://github.com/aspeer/pm-ASPEER-MakeMaker/security/advisories/new

GitHub private vulnerability reporting is enabled for this repository and is
the preferred reporting point.

If you cannot use GitHub, report the issue privately by email to the current
project maintainer:

Andrew Speer <andrew.speer@isolutions.com.au>

Please do not report security vulnerabilities through public GitHub issues,
public pull requests, RT, mailing lists, social media, chat channels, or other
public forums.

lib/ASPEER/MakeMaker.pm  view on Meta::CPAN

sub util_sync {

    my ($self, $param_hr)=(shift(), arg(@_));
    my ($srce_pn)=@{$param_hr->{'ARGV_AR'}};


    #  Get dest
    #
    msg('util_sync start');
    my $srce_fn=basename($srce_pn) ||
        return err("unable to get basebane from path: $srce_pn");
    my $to_inst_pm_ar=$param_hr->{'TO_INST_PM_AR'} ||
        return err('unable to get TO_INST_PM_AR Makefile param');
    my ($dest_pn)=(grep { /MM\/${srce_fn}$/ } @{$to_inst_pm_ar});
    $dest_pn ||
        return err("unable to get destination for $srce_fn from TO_INST_PM_AR: %s, dest file must exist !", Dumper($to_inst_pm_ar));


    die "usage: $self->util_sync(..., source_filename)\n"
        unless $srce_pn && $dest_pn;

    die "source file not found: $srce_pn\n"
        unless -e $srce_pn;
    die "source is not a regular file: $srce_pn\n"
        unless -f _;
    die "source is not readable: $srce_pn\n"

lib/ASPEER/MakeMaker.pm  view on Meta::CPAN

            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

lib/ASPEER/MakeMaker/MM/Constant.pm  view on Meta::CPAN

        "$(LICENSE)"
        "$(AUTHOR)"
        "$(TO_INST_PM)"
        "$(EXE_FILES)"
        "$(DIST_DEFAULT_TARGET)"
        "$(SUFFIX)"
        "$(ABSTRACT_FROM)"
    ]),


    #  Local constants override anything above
    #
    %{do($local_fn) || {}},
    %{do(my($fn)=glob(sprintf('~/.%s.local', __PACKAGE__))) || {}}    # || {} avoids warning

);


#  Export constants to namespace, place in export tags
#
require Exporter;

lib/ASPEER/MakeMaker/MM/Constant.pm  view on Meta::CPAN

- `$(VERSION_SYM)`
- `$(VERSION_FROM)`
- `$(LICENSE)`
- `$(AUTHOR)`
- `$(TO_INST_PM)`
- `$(EXE_FILES)`
- `$(DIST_DEFAULT_TARGET)`
- `$(SUFFIX)`
- `$(ABSTRACT_FROM)`

## Local Overrides

After defining built-in defaults, the module applies optional local overrides.
The override files must evaluate to a hash reference.

The files are loaded in this order:

1. A `.local` file beside `MM/Constant.pm`.
2. `~/.ASPEER::MakeMaker::MM::Constant.local`.

Later values override earlier values.

## Export Behavior

All constants are exported by default as scalar variables. They are also
available through the `:all` export tag. Loading the module does not alter the
caller's `$_` value.

## See Also

- `ASPEER::MakeMaker`

lib/ASPEER/MakeMaker/MM/Constant.pm  view on Meta::CPAN



=item -

C<$(ABSTRACT_FROM)>


=back


=head2 Local Overrides

After defining built-in defaults, the module applies optional local overrides.
The override files must evaluate to a hash reference.

The files are loaded in this order:

=over

=item 1.

A C<.local> file beside C<MM/Constant.pm>.


=item 2.

C<~/.ASPEER::MakeMaker::MM::Constant.local>.


=back

Later values override earlier values.


=head2 Export Behavior

All constants are exported by default as scalar variables. They are also
available through the C<:all> export tag. Loading the module does not alter the
caller's C<$_> value.


=head2 See Also

lib/ASPEER/MakeMaker/MM/Constant.pm.md  view on Meta::CPAN

- `$(VERSION_SYM)`
- `$(VERSION_FROM)`
- `$(LICENSE)`
- `$(AUTHOR)`
- `$(TO_INST_PM)`
- `$(EXE_FILES)`
- `$(DIST_DEFAULT_TARGET)`
- `$(SUFFIX)`
- `$(ABSTRACT_FROM)`

## Local Overrides

After defining built-in defaults, the module applies optional local overrides.
The override files must evaluate to a hash reference.

The files are loaded in this order:

1. A `.local` file beside `MM/Constant.pm`.
2. `~/.ASPEER::MakeMaker::MM::Constant.local`.

Later values override earlier values.

## Export Behavior

All constants are exported by default as scalar variables. They are also
available through the `:all` export tag. Loading the module does not alter the
caller's `$_` value.

## See Also

- `ASPEER::MakeMaker`

lib/ASPEER/MakeMaker/MM/Import.pm  view on Meta::CPAN

    my $author=shift(@author);


    #  Publish supplied values and enrich complete license metadata
    #
    $mm_or->{'macro'}{'LICENSE'}=$license if defined($license) && length($license);
    $mm_or->{'macro'}{'AUTHOR'}=$author if defined($author) && length($author);
    if ($license && $author) {
        my @license_module=Software::LicenseUtils->guess_license_from_meta_key($license);
        @license_module ||
            return err("unable to determine correct license module from string: $license");
        (@license_module > 1) &&
            return err("ambiguous license string: $license, resolves to %s", join(',', @license_module));
        my $license_or=(shift @license_module)->new({holder => $author});
        $mm_or->{'META_MERGE'}{'resources'}{'license'}=$license_or->url();
    }


    #  Now construct final PERLRUN string
    #
    my $perlrun=&perlrun($self, $mm_or);
    $mm_or->{'PERLRUN'}=$perlrun;

lib/ASPEER/MakeMaker/MM/Import.pm  view on Meta::CPAN


    #  Update and install Git ref if needed/available
    #
    my $devnull=File::Spec->devnull();
    my $version_from_fn=$mm_or->{'VERSION_FROM'};
    my $git_ref_fn=$version_from_fn && "${version_from_fn}.sha";
    if ($version_from_fn && -f $version_from_fn &&
        (my $git_version=qx(git rev-parse --short HEAD 2>$devnull)) && !$?) {
        chomp($git_version);
        tie(my @lines, 'Tie::File', $git_ref_fn) ||
            die("error on Tie::File, $!");
        @lines=($git_version)
            unless @lines==1 && $lines[0] eq $git_version;
    }
    if ($git_ref_fn && -f $git_ref_fn) {
        if ($mm_or->{'PM'}{$version_from_fn}) {
            $mm_or->{'PM'}{$git_ref_fn}=$mm_or->{'PM'}{$version_from_fn}.'.sha';
        }
        elsif (grep {$version_from_fn eq $_} @{$mm_or->{'EXE_FILES'}}) {
            (my $git_ref_base_fn=$git_ref_fn)=~s{^.*[/\\]}{};
            $mm_or->{'PM'}{$git_ref_fn}='$(INST_SCRIPT)/'.$git_ref_base_fn;

lib/ASPEER/MakeMaker/MM/Util.pm  view on Meta::CPAN

use File::Spec;
use IO::File;
local $Data::Dumper::Indent=1;
local $Data::Dumper::Terse=1;
local $Data::Dumper::Sortkeys=1;


#  Export functions
#
use base 'Exporter';
@EXPORT=qw(err msg verbose debug quiet_enable verbose_enable debug_enable Dumper slurp blurp touch arg perlrun);


#  Version information in a format suitable for CPAN etc. Must be
#  all on one line
#
$VERSION='1.012';


#  Debugging on ?
#

lib/ASPEER/MakeMaker/MM/Util.pm  view on Meta::CPAN

    my ($package, undef, $line, $method) = caller(1);  # '1' for caller of the function
    print STDERR sprintf("[%s:%d] %s$/",
        join('::', grep {$_} ($package, $method)),
        $line,
        $debug
    );

}


sub err {

    #  Quit on errors
    #
    my $msg=&fmt('error: %s', @_);
    CORE::print STDERR $msg, "\n";
    eval {require Carp; 1};
    Carp::croak;

}


sub fmt {


    #  Format message nicely. Always called by err or msg so caller=2
    #
    my $message=sprintf(shift(), @_);
    chomp($message);
    my @caller=(caller(2));
    my $caller=$caller[3] || $caller[0];
    my ($class, $method)=($caller=~/^(.*)::([^:]+)$/);
    $method ||=$caller[0];
    $caller=~s/^_?!(_)//;
    my $format=' @<<<<<<<<<<<<<<<<<< @*';
    local $^A='';

lib/ASPEER/MakeMaker/MM/Util.pm  view on Meta::CPAN


}


sub slurp {

    #  Slurp in file content
    #
    my ($fn)=@_;
    my $fh=IO::File->new($fn, 'r') ||
        return err("unable to open file $fn, $!");
    local $/=undef;
    my $text=<$fh>;
    $fh->close();
    return $text || '';

}


sub blurp {

    #  Save file content
    #
    my ($fn, $text)=@_;
    my $fh=IO::File->new($fn, 'w') ||
        return err("unable to open $fn for write, $!");
    $fh->print($text) ||
        return err("unable to write file $fn, $!");
    $fh->close() ||
        return err("unable to close file $fn, $!");
    return 1;

}


sub touch {

    my ($fn)=@_;
    return 1 if -e $fn;
    return blurp($fn, '');

lib/ASPEER/MakeMaker/MM/Util.pm  view on Meta::CPAN


The module also enables debug mode at load time if an environment variable
named after the current script plus `_DEBUG` is set.

### msg

```perl
msg('message %s', $value);
```

Prints a formatted message to standard error unless quiet mode is enabled.

### verbose

```perl
verbose('message %s', $value);
```

Prints a formatted message to standard error only when verbose mode is enabled
and quiet mode is not enabled.

### debug

```perl
debug('message %s', $value);
```

Prints a debug message to standard error when debug mode is enabled. The output
includes caller package, method, and line information.

### err

```perl
err('unable to process %s', $file);
```

Prints a formatted error message and croaks.

### slurp

```perl
my $text = slurp($file);
```

Reads and returns the full contents of a file using `IO::File`. On failure,
calls `err`.

### blurp

```perl
blurp($file, $text);
```

Writes text to a file, replacing any existing content. Open, write, and close
failures call `err`.

### touch

```perl
touch($file);
```

Ensures a file exists. If the file is missing, creates it as an empty file.

### arg

lib/ASPEER/MakeMaker/MM/Util.pm  view on Meta::CPAN

Sets the debug flag used by C<debug>.

The module also enables debug mode at load time if an environment variable
named after the current script plus C<_DEBUG> is set.


=head3 msg


 msg('message %s', $value);
Prints a formatted message to standard error unless quiet mode is enabled.


=head3 verbose


 verbose('message %s', $value);
Prints a formatted message to standard error only when verbose mode is enabled
and quiet mode is not enabled.


=head3 debug


 debug('message %s', $value);
Prints a debug message to standard error when debug mode is enabled. The output
includes caller package, method, and line information.


=head3 err


 err('unable to process %s', $file);
Prints a formatted error message and croaks.


=head3 slurp


 my $text = slurp($file);
Reads and returns the full contents of a file using C<IO::File>. On failure,
calls C<err>.


=head3 blurp


 blurp($file, $text);
Writes text to a file, replacing any existing content. Open, write, and close
failures call C<err>.


=head3 touch


 touch($file);
Ensures a file exists. If the file is missing, creates it as an empty file.


=head3 arg

lib/ASPEER/MakeMaker/MM/Util.pm.md  view on Meta::CPAN


The module also enables debug mode at load time if an environment variable
named after the current script plus `_DEBUG` is set.

### msg

```perl
msg('message %s', $value);
```

Prints a formatted message to standard error unless quiet mode is enabled.

### verbose

```perl
verbose('message %s', $value);
```

Prints a formatted message to standard error only when verbose mode is enabled
and quiet mode is not enabled.

### debug

```perl
debug('message %s', $value);
```

Prints a debug message to standard error when debug mode is enabled. The output
includes caller package, method, and line information.

### err

```perl
err('unable to process %s', $file);
```

Prints a formatted error message and croaks.

### slurp

```perl
my $text = slurp($file);
```

Reads and returns the full contents of a file using `IO::File`. On failure,
calls `err`.

### blurp

```perl
blurp($file, $text);
```

Writes text to a file, replacing any existing content. Open, write, and close
failures call `err`.

### touch

```perl
touch($file);
```

Ensures a file exists. If the file is missing, creates it as an empty file.

### arg



( run in 3.007 seconds using v1.01-cache-2.11-cpan-10df4c37326 )