Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Customizing Makefile.PL

by TheHobbit (Pilgrim)
on Apr 16, 2002 at 13:53 UTC ( #159483=perlquestion: print w/replies, xml ) Need Help??
TheHobbit has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I would like to modify the Makefile.PL generated by h2xs in order to do the following:

When 'make' run pod2man, it should use the -d and -r flags whit arguments deduced from the source of the module and/or by executing some command.

Reading the documentation, it appears that I must add to Makefile.PL something like

{ package My; sub manifypods { #something here } }

But I don't know what to put into the manifypods subroutine. Any monk could help me? 10q

Leo TheHobbit
GED/CS d? s-:++ a+ C++ UL+++ P+++>+++++ E+ W++ N+ o K? !w O? M V PS+++
PE-- Y+ PPG+ t++ 5? X-- R+ tv+ b+++ DI? D G++ e*(++++) h r++ y+++(*)

Replies are listed 'Best First'.
Re: Customizing Makefile.PL
by tachyon (Chancellor) on Apr 16, 2002 at 15:27 UTC

    Manpage generation is handled by manifypods() in This method *simply* returns string. You want to return a different text string however you probably don't want to try a manual edit. Implicit to the docs is that a method called MY::manifypods will be called instead of MM_Unix::manifypods with the same argument list as the original. As a result the easiest way to do this is:

    sub MY::manifypods { # cut and paste the manifypods code from MM_Unix here # in its entirity # pod2man is being called in the ugly looking lines that start $pod2man_exe = "-S pod2man"; # <<-- edit this } push @m, qq[POD2MAN_EXE = pod2man_exe\n], qq[POD2MAN = \${PERL} -we '..... # what this horrid looking code is doing is building # up a series of command line perl scripts which then # get executed, so by changing the value of $pod2man_exe # you call pod2man with the appropriate flags which # should do the trick (I think :-) # finish with the join just like in return join'', @m; # this returns the string }





      using your hint, I was hable to get the following solutions, which looks better to me (it should work on other systems than Unix)

      { package MY; sub manifypods { my ($self,%attribs) = @_; my $result = $self->SUPER::manifypods(%attribs); $result =~ s/^(POD2MAN_EXE\s*=\s*)(.+)$/$1$2 -r "v. $self->{VERSIO +N}" -d "\$(REVISION_DATE)"/m; return $result; } }
      I simply call the original manifypods sub, then change the
      POD2MAN_EXE = something
      in the result.

      10q again for your reply.

      Leo TheHobbit
      GED/CS d? s-:++ a+ C++ UL+++ P+++>+++++ E+ W++ N+ o K? !w O? M V PS+++
      PE-- Y+ PPG+ t++ 5? X-- R+ tv+ b+++ DI? D G++ e*(++++) h r++ y+++(*)

        Well done. I was too lazy to cook up a regex.




Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://159483]
Approved by IlyaM
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2017-03-26 09:15 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.