Mercurial > hg > Applications > Calcon
comparison Calcon.pm @ 4:d3e2e1d1a16c
fix various warinings ( mostly uninitialized value)
author | kono |
---|---|
date | Sat, 25 Jan 2003 14:19:32 +0900 |
parents | cb79baed256e |
children | 99bbcf06aac0 |
comparison
equal
deleted
inserted
replaced
3:cb79baed256e | 4:d3e2e1d1a16c |
---|---|
2 | 2 |
3 ## $Id$ | 3 ## $Id$ |
4 | 4 |
5 use 5.008; | 5 use 5.008; |
6 use strict; | 6 use strict; |
7 # use warnings; | 7 # use warnings; we have -w, so why we need this? |
8 | 8 |
9 #require Exporter; | 9 #require Exporter; |
10 | 10 |
11 #our @ISA = qw(Exporter); | 11 #our @ISA = qw(Exporter); |
12 | 12 |
87 } | 87 } |
88 | 88 |
89 sub option { | 89 sub option { |
90 my ($self,$option) = @_; | 90 my ($self,$option) = @_; |
91 | 91 |
92 return if (! defined($option)); | |
92 foreach my $opt ( $option =~ /./g ) { | 93 foreach my $opt ( $option =~ /./g ) { |
93 if ($opt eq '-') { | 94 if ($opt eq '-') { |
94 } elsif ($opt eq 'n') { | 95 } elsif ($opt eq 'n') { |
95 $self->{'-file-out'} = 1; | 96 $self->{'-file-out'} = 1; |
96 } elsif ($opt eq 'd') { | 97 } elsif ($opt eq 'd') { |
464 } | 465 } |
465 | 466 |
466 sub add { | 467 sub add { |
467 my ($self,$add) = @_; | 468 my ($self,$add) = @_; |
468 my ($result); | 469 my ($result); |
470 return $self if (!defined($add)); | |
469 $result = $$self + $add; | 471 $result = $$self + $add; |
470 bless \$result; | 472 bless \$result; |
471 } | 473 } |
472 | 474 |
473 sub date_after { | 475 sub date_after { |
534 return if (! $record->{'date'}); # internal error | 536 return if (! $record->{'date'}); # internal error |
535 # print ">**$record->{'date'}***\n"; | 537 # print ">**$record->{'date'}***\n"; |
536 # print ">**$record->{'end-date'}***\n"; | 538 # print ">**$record->{'end-date'}***\n"; |
537 # print ">**$record->{'time'}***\n"; | 539 # print ">**$record->{'time'}***\n"; |
538 # print ">**$record->{'end-time'}***\n"; | 540 # print ">**$record->{'end-time'}***\n"; |
541 # warning killer | |
542 if (! defined($record->{'date'})) { $record->{'date'} = '';} | |
543 if (! defined($record->{'time'})) { $record->{'time'} = '';} | |
544 if (! defined($record->{'end-time'})) { $record->{'end-time'} = '';} | |
545 if (! defined($record->{'end-date'})) { $record->{'end-date'} = '';} | |
546 $sday = $eday = $stime = $etime = ''; | |
539 | 547 |
540 if ($record->{'time'} =~ /(\d+:\d+)\s*-\s*(\d+:\d+)/) { | 548 if ($record->{'time'} =~ /(\d+:\d+)\s*-\s*(\d+:\d+)/) { |
541 $stime = $1; $etime = $2; | 549 $stime = $1; $etime = $2; |
542 } elsif ($record->{'time'} =~ /(\d+:\d+)/) { | 550 } elsif ($record->{'time'} =~ /(\d+:\d+)/) { |
543 $stime = $1; | 551 $stime = $1; |
1405 push(@{$self->{'-date-records'}}, $record); | 1413 push(@{$self->{'-date-records'}}, $record); |
1406 } | 1414 } |
1407 | 1415 |
1408 sub end_file { | 1416 sub end_file { |
1409 my ($self) = @_; | 1417 my ($self) = @_; |
1410 $self->write_datebook() if ( $self->{'-date-max'} > 0); | 1418 $self->write_datebook() if ( defined($self->{'-date-max'})); |
1411 $self->write_addressbook() if ( $self->{'-adr-max'} > 0); | 1419 $self->write_addressbook() if ( defined($self->{'-adr-max'})); |
1412 } | 1420 } |
1413 | 1421 |
1414 sub write_datebook { | 1422 sub write_datebook { |
1415 my ($self) = @_; | 1423 my ($self) = @_; |
1416 my $count = $self->{'-date-max'}; | 1424 my $count = $self->{'-date-max'}; |
2662 } | 2670 } |
2663 } else { | 2671 } else { |
2664 $dates->{'date'} = $self->unix_time($dates->{'date'}); | 2672 $dates->{'date'} = $self->unix_time($dates->{'date'}); |
2665 $dates->{'end-date'} = $self->unix_time($dates->{'end-date'}) | 2673 $dates->{'end-date'} = $self->unix_time($dates->{'end-date'}) |
2666 } | 2674 } |
2675 # warning killer | |
2676 if (! defined($dates->{'summary'})) { $dates->{'summary'} = '';}; | |
2677 if (! defined($dates->{'memo'})) { $dates->{'memo'} = '';}; | |
2667 $dates->{'memo'} = nkf('-w -Z3',$dates->{'summary'}.$dates->{'memo'}); | 2678 $dates->{'memo'} = nkf('-w -Z3',$dates->{'summary'}.$dates->{'memo'}); |
2668 | 2679 |
2669 my $memo = $dates->{'memo'}; | 2680 my $memo = $dates->{'memo'}; |
2670 my $start_time = $dates->{'date'}; | 2681 my $start_time = $dates->{'date'}; |
2671 my $end_time = $dates->{'end-date'}; | 2682 my $end_time = $dates->{'end-date'}; |
2697 $self->print ( "<RIDMax>$count</RIDMax>\n"); | 2708 $self->print ( "<RIDMax>$count</RIDMax>\n"); |
2698 $self->print ( "<Groups></Groups>\n"); | 2709 $self->print ( "<Groups></Groups>\n"); |
2699 for my $adr ( @{$self->{'-address-records'}} ) { | 2710 for my $adr ( @{$self->{'-address-records'}} ) { |
2700 | 2711 |
2701 if (defined $adr->{'birth'}){ | 2712 if (defined $adr->{'birth'}){ |
2702 $adr->{'birth'} = $self->birth_date($adr->{'birth'}) ;} | 2713 $adr->{'birth'} = $self->birth_date($adr->{'birth'}) ; |
2703 foreach my $key ( keys %$adr ) { | |
2704 $adr->{$adr} = nkf('-w -Z3',$adr->{$adr}); | |
2705 } | 2714 } |
2706 | 2715 |
2707 my ($address) = $adr->{'address'}; | 2716 my ($address) = $adr->{'address'}; |
2708 my ($birth) = $adr->{'birth'}; | 2717 my ($birth) = $adr->{'birth'}; |
2709 my ($company) = $adr->{'office'}; | 2718 my ($company) = $adr->{'office'}; |
2773 return "$year/$month/$day"; | 2782 return "$year/$month/$day"; |
2774 } | 2783 } |
2775 | 2784 |
2776 sub print { | 2785 sub print { |
2777 my ($self,@data) = @_; | 2786 my ($self,@data) = @_; |
2778 print CAL nkf("--utf8",@data); | 2787 print CAL nkf("--utf8 -Z3",@data); |
2779 } | 2788 } |
2780 | 2789 |
2781 #######################################################################/ | 2790 #######################################################################/ |
2782 | 2791 |
2783 package Calcon::Vcard_write; | 2792 package Calcon::Vcard_write; |
3312 $self->close(); | 3321 $self->close(); |
3313 } | 3322 } |
3314 | 3323 |
3315 sub open { | 3324 sub open { |
3316 my ($self,$date) = @_; | 3325 my ($self,$date) = @_; |
3317 my $name = $self->{'-directory'}."/". | 3326 my $name = $date->xcalendar_file_name; |
3318 $date->xcalendar_file_name; | 3327 if (defined($self->{'-directory'})) { |
3328 $name = $self->{'-directory'}."/".$name; | |
3329 } | |
3319 open(OUT,">>".$name); | 3330 open(OUT,">>".$name); |
3320 select OUT; | 3331 select OUT; |
3321 } | 3332 } |
3322 | 3333 |
3323 sub close { | 3334 sub close { |