Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: $0 in perl pod, not expanding to script name

by thanos1983 (Parson)
on Jul 16, 2018 at 08:01 UTC ( [id://1218537]=note: print w/replies, xml ) Need Help??


in reply to $0 in perl pod, not expanding to script name

Hello spatterson,

Can you provide us a small sample of script that replicates the case that you are mentioning?

#!/usr/bin/perl use strict; use warnings; =pod =head1 DESCRIPTION This script can have 2 parameters. The name or address of a machine and a command. It will execute the command on the given machine and print the output to the screen. =cut print "Here comes the name of the script ... $0\n"; __END__ $ perl test.pl Here comes the name of the script ... test.pl

Looking forward to your update.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^2: $0 in perl pod, not expanding to script name
by spatterson (Pilgrim) on Jul 16, 2018 at 08:08 UTC
    Stripped down to the minimum, my code is this: I simply want the first $0 (inside perlpod) to output the script name
    =pod Usage: C<$0> =cut $arg = shift(); if (defined($arg) && $arg eq '-h') { print `pod2text $0`; }

      In that case, just post-process it:

      =pod Usage: C<$0> =cut $arg = shift(); if (defined($arg) && $arg eq '-h') { for (`pod2text $0`) { s/\$0/$0/; print; } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-03-29 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found