Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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+++(*)

Comment on Customizing Makefile.PL
Download Code
Re: Customizing Makefile.PL
by tachyon (Chancellor) on Apr 16, 2002 at 15:27 UTC

    Manpage generation is handled by manifypods() in MM_Unix.pm. 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 MM_Unix.pm return join'', @m; # this returns the string }

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Hi,

      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.

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://159483]
Approved by IlyaM
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-09-18 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (102 votes), past polls