in reply to Create and edit new scripts
It might be easier if you just have a "template.pl" file, copy that to the requested file name for a new script, and provide a command-line option for the user to indicate whether to fire up an editor on the new file. By using a command-line option (e.g. "-e" to start the editor), the code becomes a lot shorter and easier to read (no need for ALRM handling, reading from term, etc), and a lot easier to use.
And why not make the initial template something like this:
That will make it clear that some amount of documentation should be included, which is usually a very good idea. (You can use the given file name and the user's name to initialize the first and last POD fields -- that would be very handy!)#!/usr/bin/perl =head1 NAME =head1 SYNOPSIS =head1 DESCRIPTION =head1 AUTHOR =cut use strict; use warnings;
In Section Cool Uses for Perl