I need some help using perls Getopt::Lazy module. I tried the example from the cpan page:
#!/usr/bin/perl
#
#use warnings;
#use strict;
use Getopt::Lazy
'help|h' => 'Show this help screen',
'verbose|v' => 'Show verbose output',
'output|o=s' => ["[FILE] Send the output to FILE", 'getopt.out'],
'output-encoding=s' => ['[ENCODING] Specify the output encoding', 'utf8'],
-summary => 'a simple example usage of Getopt::Lazy',
-usage => '%c %o file1 [file2 ..]',
;
getopt;
print usage and exit 1 unless @ARGV;
When I put it in a file and execute it like ./mygetopt.pl -h
, I would expect the help message to be printed, but nothing happens. When I call it without the -h
argument, I would expect it to print the usage message. Nothing like this happens. Also, when I use strict and warnings, I get messages like
Unquoted string "usage" may clash with future reserved word at ./mygetopt.pl line 14.
Bareword "getopt" not allowed while "strict subs" in use at ./mygetopt.pl line 13.
Execution of ./mygetopt.pl aborted due to compilation errors.
What am I doing wrong?