ch14.020_best_ex14.4

来自「Perl Best Practices the source code」· 4 代码 · 共 43 行

4
43
字号
################################################################################   Example 14.4 (Recommended) from Chapter 14 of "Perl Best Practices"    ####     Copyright (c) O'Reilly & Associates, 2005. All Rights Reserved.      ####  See: http://www.oreilly.com/pub/a/oreilly/ask_tim/2001/codepolicy.html  #################################################################################  Example 14-4. Command-line parsing via Getopt::Clade# Standard modules...use strict;use warnings;use IO::Prompt;use Carp;use English qw( -no_match_vars );use Data::Alias;use Readonly;# Handle command-lines of the form:##    > orchestrate -in source.txt -o=dest.orc -verbose# Specify and parse valid command-line arguments...use Getopt::Clade q{    -i[n]  [=] <file:in>    Specify input file  [default: '-']    -o[ut] [=] <file:out>   Specify output file [default: '-']    -l[en] [=] <l:+int>     Display length [default: 24 ]    -w[id] [=] <w:+int>     Display width  [default: 78 ]    -v                      Print all warnings    --verbose               [ditto]};# Report intended behaviour...if ($ARGV{-v}) {    print "Loading first $ARGV{'-l'} chunks of file: $ARGV{'-i'}\n"}# etc.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?