Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Pod in other languages?

by pileofrogs (Priest)
on Nov 20, 2009 at 17:58 UTC ( [id://808490]=perlquestion: print w/replies, xml ) Need Help??

pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

Hello ye Monks!

This isn't strictly a perl question, but it's a pod question so be merciful..

I like writing my docs in pod and I write bash scripts from time to time. I want to keep the pod in the same file as the script 'cause bad things happen when they get separated (at least in my hands bad things happen...) I figured I could put my pod after an exit call in bash and I'd be fine, but it didn't work.

Anyway, the real question isn't a bash question it is: does pod have any magic syntax to fit inside of something like the comments of another language. EG, is there a way to write pod like this...

#! /bin/bash echo "stupid bash user! Write perl!" exit #=head1 NAME # #Foo # #=head1 SYNOPSIS # #Eat 100 pounds of bannanas

Or like this

#include stdio.h void main () { printf("all that just to say this? Use perl!\n"); } /* =head1 NAME Foo =head1 SYNOPSIS Eat 100 pounds of bannanas */

...er... okay that works out of the box... but anyway, you get my point...

UPDATE: my original bash problem was just me being stupid. You can put pod after the exit in bash. Duh. However! I'm still curious if pod can operate inside another languages arbitrary line-based comments.

Another Update!: Yes. I suck and I waste your time. I admit it freely and accept any punishment you desire to inflict. Achem...

You can put the pod inside a string that does nothing in nearly any language. EG in bash:

#! /bin/bash echo "Pileofrogs is a jerk!" FOO=<<ENDOFPOD =head1 NAME i_suck =head1 SYNOPSIS To increase your overall suckage, simply introduce Pilofrogs into the +environment =cut ENDOFPOD

Replies are listed 'Best First'.
Re: Pod in other languages?
by toolic (Bishop) on Nov 20, 2009 at 18:13 UTC
    I'm not really sure what your question is, or what you are trying to accomplish, but it is possible to use perldoc to display your POD comments in manpage-style (assuming you get rid of the leading #'s in your bash code):
    perldoc my_bash_script perldoc foo.c

      I'm curious if pod tools can be told to ignore the # marks, basicallly.

        You could write wrapper that strips them
Re: Pod in other languages?
by JavaFan (Canon) on Nov 20, 2009 at 23:02 UTC
    cut -c2- program.sh | pod2man
    should do, if you put the comment in the first column. For pod2html, which uses magic open, you can write it as:
    pod2html 'cut -c2- program.sh |'
Re: Pod in other languages?
by davies (Prior) on Nov 20, 2009 at 23:27 UTC
    I know I'll get lots of downvotes for mentioning MessWare, but I'll be releasing - very soon - an Excel version. It's a Perl programme that reads Excel files and produces first POD and, from that, HTML files (although you can do what you like with the POD files later). My proposal for a talk at the London Perl Workshop has been accepted and the code is working. All I really need is a web site (WIP) and to get some personal issues straight (nothing that will stop me speaking at the LPW). I wasn't intending to announce it just yet, but couldn't resist hijacking your post to do a little self-promotion!

    Regards,

    John Davies
      If you want to make announcement, go ahead and do so. Hijacking is stupid.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 14:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found