#!/usr/bin/env perl # +-======-+ # Copyright (c) 2003-2018 United States Government as represented by # the Admistrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, # REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN # COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS # REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). # THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN # INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR # REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, # DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED # HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE # RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. # # Government Agency: National Aeronautics and Space Administration # Government Agency Original Software Designation: GSC-15354-1 # Government Agency Original Software Title: GEOS-5 GCM Modeling Software # User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov # Government Agency Point of Contact for Original Software: # Dale Hithon, SRA Assistant, (301) 286-2691 # # +-======-+ #======================================================================= # name - num_days_in_month # purpose - wrapper script for num_days_in_month() in Manipulate_time.pm #======================================================================= use strict; use warnings; # global variables #----------------- my ($year, $month); # main program #------------- { use FindBin; use lib "$FindBin::Bin"; use Manipulate_time ("num_days_in_month"); my $num_days; init(); $num_days = num_days_in_month($year, $month); print "$num_days\n"; } #======================================================================= # name - init # purpose - get runtime parameters #======================================================================= sub init { use Getopt::Long; my ($help); GetOptions( "h|help" => \$help ); usage() if $help; # get inputs #----------- ($year, $month) = @ARGV; unless ($year and $month) { warn "Warning. Incorrect inputs;"; usage() } } #======================================================================= # name - usage # purpose - print usage information #======================================================================= sub usage { use File::Basename ("basename"); my $name = basename $0; print <<"EOF"; usage: $name year month purpose: prints number of days in the specified year/month EOF exit; }