Hi Perl Monks,

I have a Makefile.PL which creates a module say 'My_Config.pm' (Makefile.PL prompts for user password and stores it in 'My_Config.pm)' under the lib directory using some predefined template.

Upon perl Makefile.PL && make the file 'My_Config.pm' is created under lib/ When performing make install the 'My_Config.pm' is not always installed. Even if the file contains changes, the file is not always installed.

I am using File::ShareDir::Install 'postamble';

Any hints on what may be the problem here?

TIA

Edit 1:

My_Config.tmpl

package My::Module::Name::My_Config; use strict; use warnings; use Exporter; our @ISA = 'Exporter'; our @EXPORT_OK = 'MY_PASSWORD'; our %EXPORT_TAGS =(CONSTANTS => ['MY_PASSWORD']);
Makefile.PL
use strict; use warnings; use ExtUtils::MakeMaker; WriteMakeFile( NAME => 'My::Module::Name', AUTHOR => 'XYZ', VERSION_FROM => 'lib/My/Module/Name.pm' ); package MY; sub xs_o { my $pass = MM->prompt('Enter password'); chomp($pass); my $tmpl = 'My_Config.tmpl'; my $config = 'lib/My/Module/Name/My_Config.pm'; return <<END; all: myconfig myconfig: \tperl -e 'open(IN, "<" , "$tmpl"); open(OUT, ">", "$config"); while(< +IN>) { print OUT $_; } close(IN); close(OUT);' \tperl -e 'open(OUT, ">>", "$config"); print OUT "use constant MY_PASS +WORD => qq($pass);\\n1;"; close(OUT);' END } use File::ShareDir::Install 'postamble';

In reply to Makefile.PL does not always install changed file by williamcharles

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.