genorg.pl
changeset 21 f61879daacf0
parent 20 ce527668bd78
child 22 dc1add4ee525
equal deleted inserted replaced
20:ce527668bd78 21:f61879daacf0
   509   my (%c_files, %r_files);	# Cataogry files and rss
   509   my (%c_files, %r_files);	# Cataogry files and rss
   510   
   510   
   511   for my $cat (sort { $catags{$b} <=> $catags{$a} } keys(%catags)) {
   511   for my $cat (sort { $catags{$b} <=> $catags{$a} } keys(%catags)) {
   512     my $num = $catags{$cat};
   512     my $num = $catags{$cat};
   513     # ($h_intro, $h_c_intro, $h_cat_li, $h_chap, $h_en_cat, $h_en, $h_end)
   513     # ($h_intro, $h_c_intro, $h_cat_li, $h_chap, $h_en_cat, $h_en, $h_end)
   514     print $fh $h_cat_li =~ s/NUMBER/$num/re
   514     print $fh $h_cat_li
       
   515       =~ s/NUMBER/$num/re
   515       =~ s/CATAG/$cat/er
   516       =~ s/CATAG/$cat/er
   516       =~ s=LINK="$cat/1.html"=er;
   517       =~ s=LINK="$cat/1.html"=er;
   517     mkdir "$no_name_dir/$cat";
   518     mkdir "$no_name_dir/$cat";
   518     open $c_files{$cat}, '>', "$no_name_dir/$cat/1.html";
   519     open $c_files{$cat}, '>', "$no_name_dir/$cat/1.html";
   519     open $r_files{$cat}, '>', "$no_name_dir/$cat/rss.xml";
   520     open $r_files{$cat}, '>', "$no_name_dir/$cat/rss.xml";
   695     bless $self, $class;
   696     bless $self, $class;
   696     return $self;
   697     return $self;
   697   }
   698   }
   698 
   699 
   699   # $d1 is greater than $d2
   700   # $d1 is greater than $d2
   700   sub cmp  {
   701   sub cmp {
   701     my ($d1, $d2) = @_;
   702     my ($d1, $d2) = @_;
   702     for ($d1->{year} <=> $d2->{year},
   703     for ($d1->{year} <=> $d2->{year},
   703 	 $d1->{month} <=> $d2->{month},
   704 	 $d1->{month} <=> $d2->{month},
   704 	 $d1->{day} <=> $d2->{day}) {
   705 	 $d1->{day} <=> $d2->{day}) {
   705       return $_ unless $_ == 0
   706       return $_ unless $_ == 0