/[suikacvs]/webroot/swe/lib/SWE/DB/SuikaWiki3LastModified.pm
Suika

Contents of /webroot/swe/lib/SWE/DB/SuikaWiki3LastModified.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Nov 9 06:46:47 2008 UTC (16 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +7 -28 lines
++ swe/lib/SWE/DB/ChangeLog	9 Nov 2008 06:46:33 -0000
2008-11-09  Wakaba  <wakaba@suika.fam.cx>

	* Lock.pm, HashedProps.pm, IDDOM.pm, IDGenerator.pm, IDProps.pm,
	IDText.pm, SuikaWiki3PageList.pm: New modules.

	* SuikaWiki3.pm, SuikaWiki3LastModified.pm: Changed to use plain
	base 16 encoded file name string as key, rather than array
	reference as in SuikaWiki3.

	* SuikaWiki3LastModified.pm (save_data, set_data): Removed.
	(load_data): Renamed as |_load_data|.
	(get_data): Invoke |_load_data| if and only if necessary.

	* SuikaWiki3Props.pm: Don't treat "%" as a part of hash key.

1 package SWE::DB::SuikaWiki3LastModified;
2 use strict;
3
4 require Encode::EUCJPSW;
5
6 sub new ($) {
7 my $self = bless {
8 file_name => 'lastmodified.dat',
9 }, shift;
10 } # new
11
12 sub _load_data ($) {
13 my $self = shift;
14
15 open my $file, '<', $self->{file_name} or die "$0: $self->{file_name}: $!";
16 local $/ = undef;
17 my $val = <$file>;
18 close $file;
19
20 if ($val =~ s!^\#\?SuikaWikiMetaInfo/0.9[^\x02]*\x02!!s) {
21 $self->{data} = {map {(Encode::decode ('euc-jp-sw', $_->[0]), $_->[1])}
22 map {[split /\x1F/, $_, 2]} split /\x1E/, $val};
23 }
24
25 $self->{data_loaded} = 1;
26 } # _load_data
27
28 sub get_data ($$) {
29 my ($self, $page_name) = @_;
30 $self->_load_data unless $self->{data_loaded};
31
32 $page_name =~ s/ /\x2F\x2F/g;
33 return $self->{data}->{$page_name};
34 } # get_data
35
36 1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24