Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Documenting executables

by joefission (Monk)
on Aug 17, 2001 at 17:38 UTC ( #105666=note: print w/replies, xml ) Need Help??


in reply to Documenting executables

You should be able to use options (--help) and/or a combination of Getopt and POD::Usage to provide documentation.

Replies are listed 'Best First'.
Re: Re: Documenting executables
by perl::scribe (Sexton) on Aug 17, 2001 at 18:02 UTC
    > You should be able to use options (--help) and/or a combination of Getopt and POD::Usage to provide documentation.

    Thanks for the tip, joefission. Indeed, I have used options (Getopt::Long) before, but not in combination with Pod::Usage.
    What I do now is: if there's an option or a lack of arguments, I run a sub usage() that prints or dies up to a certain terminating string, e.g. EOT.
    What I'm missing, though, is the ability to markup your documentation, like you can with POD.
    Any other ideas?

    Thanks
    May Larry be with you

    my $name = Perl::scribe->new();

      Did you really take a close look at POD::Usage as suggested by joefission?? I think this module does what you want, namely extract (part of) the pod of your script and print it out. This can be used instead of a usage sub. Take especially a look at the example at the end of the documentation - I think that does exactly what you were looking for.

      Please correct me if I misunderstood what you are trying to do ...

      -- Hofmator

        I've been fiddling about with POD::Usage again and I have noticed that this approach only seems to work if the original perl script is in the same directory as the executable.
        POD::Usage keeps looking for the original .pl file which can't be found.
        Anybody know of a way to remedy this?

        UPDATE
        I just read in the documentation that you can set the path to the pod input file, but I still think that's mighty inconvenient.
        I'm afraid there's no other way though, right?
        sigh

        Thanks!
        May Larry be with you
        I did take a look at POD::Usage, but apparently I did not look hard enough.
        Thank you, Hofmator, for pointing out my ignorance!
        I converted the example script into an executable, ran it and what do you know...it worked.

        Thanks again to both of you.

        BTW, is that the way most of you do it?

        Greetings
        May Larry be with you!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-06-02 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (12 votes). Check out past polls.

    Notices?