Changeset 309 for flickr2pics

Show
Ignore:
Timestamp:
04/17/06 17:38:22 (3 years ago)
Author:
ogawa
Message:

Employs Getopt::Long and Pod::Usage modules.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • flickr2pics/trunk/flickr2pics

    r305 r309  
    1111use strict; 
    1212use YAML; 
     13use Pod::Usage; 
     14use Getopt::Long; 
    1315 
    1416our $VERSION = '0.01'; 
    1517 
    16 my $cfg = YAML::LoadFile($ARGV[0] || 'config.yaml'); 
     18my %opt = (conf => 'config.yaml'); 
     19GetOptions(\%opt, 'help', 'conf=s') or pod2usage(2); 
     20pod2usage(1) if $opt{help}; 
     21 
     22my $cfg = YAML::LoadFile($opt{conf}); 
    1723die "Cannot find proper configuration for flickr2pics." 
    1824    unless $cfg->{flickr_username} && $cfg->{pics_username} && $cfg->{pics_password}; 
     
    189195 
    190196  % flickr2pics 
    191   % flickr2pics /path/to/config.yaml 
     197  % flickr2pics --conf /path/to/config.yaml 
    192198 
    193199=head1 DESCRIPTION 
     
    219225=over 4 
    220226 
    221 =item path/to/config.yaml 
     227=item --conf /path/to/config.yaml 
    222228 
    223229Specified the path to a configuration file. By default, C<config.yaml>