1 <SELECT NAME="<% $prefix %>_month" SIZE="1" <% $disabled%>>
3 <% $empty ? '<OPTION VALUE="">' : '' %>
4 % foreach ( 1 .. 12 ) {
6 <OPTION<% $_ == $mon ? ' SELECTED' : '' %> VALUE="<% $_ %>"><% $mon[$_-1] %>
10 </SELECT>/<SELECT NAME="<% $prefix %>_year" SIZE="1" <% $disabled%>>
12 <% $empty ? '<OPTION VALUE="">' : '' %>
13 % for ( $start_year .. $end_year ) {
15 <OPTION<% $_ == $year ? ' SELECTED' : '' %> VALUE="<% $_ %>"><% $_ %>
23 my $prefix = $opt{'prefix'} || '';
24 my $disabled = $opt{'disabled'} || '';
25 my $empty = $opt{'empty_option'} || '';
26 my $start_year = $opt{'start_year'};
27 my $end_year = $opt{'end_year'} || '2037';
30 if ( $opt{'show_month_abbr'} ) {
31 @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
34 @mon = ( ( map "0$_", 1 .. 9 ), 10 .. 12 ),
37 my $date = $opt{'selected_date'} || '';
38 $date = '' if $date eq '-';
40 my $mon = $opt{'selected_mon'} || 0;
41 my $year = $opt{'selected_year'} || 0;
43 if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
44 ( $mon, $year ) = ( $2, $1 );
45 } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
46 ( $mon, $year ) = ( $1, $3 );
48 die "unrecognized expiration date format: $date";
52 unless ( $start_year ) {
54 $start_year = $t[5] + 1900;
56 $start_year = $year if $start_year > $year && $year > 0;