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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Sun Nov 9 06:46:47 2008 UTC (16 years, 5 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +5 -22 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 wakaba 1.1 package SWE::DB::SuikaWiki3;
2     use strict;
3    
4 wakaba 1.2 require Encode::EUCJPSW;
5 wakaba 1.1
6     sub new ($) {
7     my $self = bless {
8     leaf_suffix => '.txt',
9     root_directory_name => ',/',
10     }, shift;
11     return $self;
12     } # new
13    
14 wakaba 1.4 sub _get_file_name ($$) {
15     my ($self, $key) = @_;
16 wakaba 1.1
17 wakaba 1.4 return $self->{root_directory_name} . $key . $self->{leaf_suffix};
18     } # _get_file_name
19 wakaba 1.1
20     sub get_data ($$) {
21 wakaba 1.3 my $self = $_[0];
22 wakaba 1.4 my $file_name = $self->_get_file_name ($_[1]);
23 wakaba 1.1
24     return undef unless -f $file_name;
25    
26 wakaba 1.2 open my $file, '<:encoding(euc-jp-sw)', $file_name
27 wakaba 1.1 or die "$0: $file_name: $!";
28     local $/ = undef;
29     return scalar <$file>;
30     } # get_data
31    
32     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24