diff -Nur -x '*.orig' -x '*.rej' e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/config.pm mezzanine_patched_e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/config.pm --- e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/config.pm 2008-07-31 09:12:57.000000000 -0600 +++ mezzanine_patched_e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/config.pm 2008-07-31 09:09:54.000000000 -0600 @@ -170,9 +170,9 @@ =cut -sub _readconf ($) +sub _readconf { - my ($filename) = @_; + my ($self, $filename) = @_; my %config = (); @@ -185,7 +185,8 @@ return \%config; } - binmode(FH, ":encoding(UTF-8)") if $filename =~ m{navigation}; + my $binmode = $self->_read_binmode; + binmode(FH, $binmode) if $binmode; while (my $line = ) { chomp $line; @@ -232,10 +233,9 @@ =cut -sub _writeconf ($$) +sub _writeconf { - shift while($#_ > 1); - my ($filename, $config) = @_; + my ($self, $filename, $config) = @_; eval { if (-f $filename && ! -r $filename) @@ -245,7 +245,8 @@ sysopen (FH, "$filename.$$", O_RDWR | O_CREAT, 0660) or die "Cannot open $filename.$$: $!\n"; - binmode(FH, ":utf8") if $filename =~ m{navigation}; + my $binmode = $self->_write_binmode; + binmode(FH, $binmode) if $binmode; die "Error writing to $filename.$$: $!" unless printf FH <{CONFIG} = _readconf($filename); + $self->{CONFIG} = $self->_readconf($filename); return $self; } @@ -439,7 +440,7 @@ # read in config again, just in case it changed $self->_lock_write; - $self->{CONFIG} = _readconf($self->{FILENAME}); + $self->{CONFIG} = $self->_readconf($self->{FILENAME}); if (exists $self->{CONFIG}{$key} and $self->{CONFIG}{$key} eq $value) @@ -464,7 +465,7 @@ $self->{CONFIG} {$key} = $value; &log("$self->{FILENAME}: NEW $key=$self->{CONFIG}{$key}"); - _writeconf ($self->{FILENAME}, $self->{CONFIG}); + $self->_writeconf ($self->{FILENAME}, $self->{CONFIG}); $self->_unlock; return undef; @@ -484,10 +485,10 @@ # read in config again, just in case it changed $self->_lock_write; - $self->{CONFIG} = _readconf($self->{FILENAME}); + $self->{CONFIG} = $self->_readconf($self->{FILENAME}); my $previous = delete $self->{CONFIG} {$key}; - _writeconf ($self->{FILENAME}, $self->{CONFIG}); + $self->_writeconf ($self->{FILENAME}, $self->{CONFIG}); $self->_unlock; &log("$self->{FILENAME}: DELETE $key=$previous"); @@ -524,7 +525,7 @@ my $self = shift; $self->{CONFIG} = (); - _writeconf ($self->{FILENAME}, $self->{CONFIG}); + $self->_writeconf ($self->{FILENAME}, $self->{CONFIG}); &log("$self->{FILENAME}: CLEAR"); @@ -598,6 +599,25 @@ closelog(); } +=item _read_binmode + +return undef, indicating that by default binmode() need not be called after +file open. + +=end _private + +=cut + +sub _read_binmode +{ + return undef; +} + +sub _write_binmode +{ + return undef; +} + =head1 BUGS and CAVEATS You can't have newlines in keys or values. diff -Nur -x '*.orig' -x '*.rej' e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db/Record.pm mezzanine_patched_e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db/Record.pm --- e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db/Record.pm 2005-07-27 14:24:02.000000000 -0600 +++ mezzanine_patched_e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db/Record.pm 2008-07-31 09:01:17.000000000 -0600 @@ -194,7 +194,6 @@ $ret = db_set_prop($self->{config}, $self->{key}, $property => $value); } - esmith::config::_writeconf($self->{db}->{file}, $self->{config}); return $ret; } @@ -223,7 +222,6 @@ my $val = $self->prop($property); db_delete_prop($self->{config}, $self->{key}, $property); - esmith::config::_writeconf($self->{db}->{file}, $self->{config}); return $val; } @@ -269,7 +267,6 @@ my $type = delete $merged_props{type}; db_set($self->{config}, $self->{key}, $type, \%merged_props); - esmith::config::_writeconf($self->{db}->{file}, $self->{config}); } =item B @@ -313,7 +310,6 @@ my $type = delete $new_props{type} || $self->prop('type'); db_set($self->{config}, $self->{key}, $type, \%new_props); - esmith::config::_writeconf($self->{db}->{file}, $self->{config}); } @@ -331,7 +327,6 @@ croak "The DB is open read-only" if $self->{db}->is_ro; db_delete($self->{config}, $self->{key}); - esmith::config::_writeconf($self->{db}->{file}, $self->{config}); } =item B diff -Nur -x '*.orig' -x '*.rej' e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db.pm mezzanine_patched_e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db.pm --- e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db.pm 2006-02-16 20:52:14.000000000 -0700 +++ mezzanine_patched_e-smith-lib-1.18.0/root/usr/lib/perl5/site_perl/esmith/DB/db.pm 2008-07-31 09:03:47.000000000 -0600 @@ -255,7 +255,7 @@ my ( $self, $file ) = @_; my %config; - tie %config, 'esmith::config', $file; + tie %config, $self->tie_class, $file; return \%config; } @@ -404,7 +404,7 @@ } my $type = exists $props->{type} ? delete $props->{type} : ''; db_set( $self->{config}, $key, $type, $props ); - esmith::config::_writeconf($self->{file}, $self->{config}); + $self->tie_class->_writeconf($self->{file}, $self->{config}); return esmith::DB::db::Record->_construct( $self, $key, $self->{config} ); } @@ -474,6 +474,17 @@ =end testing +=cut + +sub tie_class +{ + return 'esmith::config'; +} + +sub close +{ +} + =begin deprecated =item B