Changeset 306

Show
Ignore:
Timestamp:
04/17/06 16:57:59 (3 years ago)
Author:
ogawa
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cybozu2ical/trunk/cybozu2ical

    r304 r306  
    1515use DateTime; 
    1616use DateTime::TimeZone; 
     17use Pod::Usage; 
     18use Getopt::Long; 
    1719 
    1820our $VERSION = '0.02'; 
    1921 
    20 my $cfg = YAML::LoadFile($ARGV[0] || 'config.yaml'); 
     22my %opt = (conf => 'config.yaml'); 
     23GetOptions(\%opt, 'help', 'conf=s') or pod2usage(2); 
     24pod2usage(1) if $opt{help}; 
     25 
     26my $cfg = YAML::LoadFile($opt{conf}); 
    2127my $tz = DateTime::TimeZone->new(name => $cfg->{time_zone} || 'Asia/Tokyo'); 
    2228 
     
    132138 
    133139  % cybozu2ical 
    134   % cybozu2ical /path/to/config.yaml 
     140  % cybozu2ical --conf /path/to/config.yaml 
    135141 
    136142=head1 DESCRIPTION 
     
    167173=over 4 
    168174 
    169 =item path/to/config.yaml 
    170  
    171 Specified the path to a configuration file. By default, C<config.yaml> 
     175=item --conf path/to/config.yaml 
     176 
     177Specifies the path to a configuration file. By default, C<config.yaml> 
    172178in the current directory. 
    173179