ASPEER-MakeMaker

 view release on metacpan or  search on metacpan

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

#
#  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/>
#
package ASPEER::MakeMaker;


#  Pragma
#
use strict;
use warnings;
use vars qw($VERSION $VERSION_GIT_SHA $AUTHORITY);


#  Base packages
#
use ASPEER::MakeMaker::MM::Util;


#  Other modules
#
use File::Basename qw(dirname basename);
use File::Spec;
use File::Temp qw(tempfile);
local $Data::Dumper::Sortkeys=1;


#  Version information
#
$AUTHORITY='cpan:ASPEER';
$VERSION='1.012';
$VERSION_GIT_SHA=do { local(@ARGV, $/, $_); @ARGV=($_=__FILE__.'.sha'); <> if -f $_ };
chomp($VERSION_GIT_SHA) if defined($VERSION_GIT_SHA);


#  Init Done
#
1;
#==============================================================================
#
#  Forward import on to dedicated module
#
sub import {

    push (@_, qw(const_config postamble)) unless $_[1];
    require ASPEER::MakeMaker::MM::Import;
    goto &ASPEER::MakeMaker::MM::Import::import;

}



#==============================================================================
#
#  Methods to support Makefile targets from here on
#
sub dump_param {

    my ($self, $param_hr)=(shift(), arg(@_));
    print Dumper($param_hr);

}



#  Copy template files from this module to target
#
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 _;



( run in 0.614 second using v1.01-cache-2.11-cpan-64eb572602a )