Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 305277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:21:31+00:00 2026-05-12T07:21:31+00:00

I want to create a POD for my own custom command and display the

  • 0

I want to create a POD for my own custom command and display the syntax for that using pod2usage() function..

Can anyone give me a simple example for it?

Regards,
Anandan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:21:31+00:00Added an answer on May 12, 2026 at 7:21 am

    I do this using Getopt::Long together with Pod::Usage. (I got into this habit after reading a tutorial on the PerlMonks site, so here’s the link to that as well.) It looks something like this example:

    use Getopt::Long;
    use Pod::Usage;
    
    my( $opt_help, $opt_man, $opt_full, $opt_admins, $opt_choose, $opt_createdb, );
    
    GetOptions(
        'help!'                 =>      \$opt_help,
        'man!'                  =>      \$opt_man,
        'full!'                 =>      \$opt_full,
        'admin|admins!'         =>      \$opt_admins,
        'choose|select|c=s'     =>      \$opt_choose,
        'createdb!'             =>      \$opt_createdb,
    )
      or pod2usage( "Try '$0 --help' for more information." );
    
    pod2usage( -verbose => 1 ) if $opt_help;
    pod2usage( -verbose => 2 ) if $opt_man;
    

    The options other than $opt_man and $opt_help are irrelevant to you in that example. I just copied the top of a random script I had here.

    After that, you just need to write the POD. Here’s a good link describing the basics of POD itself.

    Edit: In response to the OP’s question in the comments, here’s how you might print just the NAME section when passed an appropriate option. First, add another option to the hash of options in GetOptions. Let’s use 'name' => \$opt_name here. Then add this:

    pod2usage(-verbose => 99, -sections => "NAME") if $opt_name;
    

    Verbose level 99 is magic: it allows you to choose one or more sections only to be printed. See the documentation of Pod::Usage under -sections for more details. Note that -sections (the name) is plural even if you only want one section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create a site by command line using appcmd. How can I associate
I want create a ruby script that I can run on the command line
I want to create a function that performs a function passed by parameter on
I want create own SetupTypeDlg using wix default dialogs to show the disk costs
I want create timer in my program so that I can cause it to
I want to create a Java application bundle for Mac without using Mac. According
I want to create a simple http proxy server that does some very basic
I want create a button option that takes the entire datalist and converts it
What I'm trying to do is create a new custom data type that behaves
i want create something like link_to which can link to request for permission in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.