How... had I never realized that "perldoc -f <builtin-function>” is a thing? Game changer!

I realized this as I'm poking around to find out if there is /any/ way (documented or not) to substitute the current program/topic in the =pod section, so I can copy a script template around and require fewer changes to get up and running.

If anyone has an answer to that (which may be of the form "Nope, no dice”), I would appreciate it.

 #perl #perldoc #pod #TIL

@jochie You can have a bin/yourthing.PL in a dist and it will be run to generate the content of bin/yourthing.

it could replace a literal $0 in the pod at that point during install

it often makes more sense to just generate the pod when you first create the script though

@EndlessMason In my use case I have a single script, using Pod::Usage with the =pod content after the __END__ marker, so embedded in the script itself.

Closest I can see myself getting there is a workaround using pod2usage(-input <handle>, ..), though that obviously wouldn't work for someone running "perldoc <myscript.pl>" from a shell.

I πŸ’― see your point re generating it upon creation (which is on par with just editing the script after I copy the template) I’m just scratching an itch here 😁

@jochie usually i either put a literal $0 in the pod... you can also get away with leaving it out :
"Usage: --globals subcommand --switches"