fixed rt.cpan.org#75145. rt.cpan.org#75146.

This commit is contained in:
TLINDEN
2012-07-20 13:40:43 +02:00
parent 5c28e1f954
commit 4cf8fe6eb9
4 changed files with 47 additions and 21 deletions

View File

@@ -1,3 +1,14 @@
1.04
fixed rt.cpan.org#75145. uninitialized fields lead to
program abort. solved by pre-initializing them in the
new records method. types notes and groups affected.
fixed rt.cpan.org#75146. mtime will only modified if
the passwd field changed. POD adjusted. Fix suggested
by Luca Filipozzi - thx.
1.03
after saving we do not mv the tmp file but copying
it, because mv sometimes doesn't work with files the
@@ -5,6 +16,7 @@
while cp works on such files. so now we cp and unlink
the tmpfile after saving.
1.02
doc fix in ::Record (group separator is . not /)
added Shell.pm to Makefile.PL dependencies

4
README
View File

@@ -32,7 +32,7 @@ INSTALLATION
COPYRIGHT
Crypt::PWSafe3
Copyright (c) 2011 by T. Linden <tlinden@cpan.org>
Copyright (c) 2011-2012 by T. Linden <tlinden@cpan.org>
This library is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
@@ -49,4 +49,4 @@ AUTHOR
VERSION
1.03
1.04

View File

@@ -22,7 +22,7 @@ use Data::Dumper;
use Exporter ();
use vars qw(@ISA @EXPORT);
$Crypt::PWSafe3::VERSION = '1.03';
$Crypt::PWSafe3::VERSION = '1.04';
use Crypt::PWSafe3::Field;
use Crypt::PWSafe3::HeaderField;
@@ -869,9 +869,6 @@ T. Linden <tlinden@cpan.org>
Report bugs to
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Crypt-PWSafe3.
=head1 VERSION
Crypt::PWSafe3 Version 1.03.
=head1 SEE ALSO
@@ -895,7 +892,7 @@ in this module are his ideas ported to perl.
=head1 COPYRIGHT
Copyright (c) 2011 by T.Linden <tlinden@cpan.org>.
Copyright (c) 2011-2012 by T.Linden <tlinden@cpan.org>.
All rights reserved.
=head1 LICENSE
@@ -903,6 +900,10 @@ All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
=head1 VERSION
Crypt::PWSafe3 Version 1.04.
=cut

View File

@@ -9,7 +9,7 @@ my %map2type = %Crypt::PWSafe3::Field::map2type;
my %map2name = %Crypt::PWSafe3::Field::map2name;
$Crypt::PWSafe3::Record::VERSION = '1.02';
$Crypt::PWSafe3::Record::VERSION = '1.03';
foreach my $field (keys %map2type ) {
eval qq(
@@ -37,6 +37,9 @@ sub new {
# just in case this is a record to be filled by the user,
# initialize it properly
my $newuuid = $self->genuuid();
my $time = time;
$self->addfield(new Crypt::PWSafe3::Field(
name => 'uuid',
raw => $newuuid,
@@ -44,17 +47,17 @@ sub new {
$self->addfield(new Crypt::PWSafe3::Field(
name => 'ctime',
value => time,
value => $time,
));
$self->addfield(new Crypt::PWSafe3::Field(
name => 'mtime',
value => time
value => $time
));
$self->addfield(new Crypt::PWSafe3::Field(
name => 'lastmod',
value => time
value => $time
));
$self->addfield(new Crypt::PWSafe3::Field(
@@ -72,6 +75,16 @@ sub new {
value => ''
));
$self->addfield(new Crypt::PWSafe3::Field(
name => 'notes',
value => ''
));
$self->addfield(new Crypt::PWSafe3::Field(
name => 'group',
value => ''
));
return $self;
}
@@ -85,21 +98,24 @@ sub modifyfield {
type => $type,
value => $value
);
my $time = time;
# we are in fact just overwriting an eventually
# existing field with a new one, instead of modifying
# it, so we are using the conversion automatism in
# Field::new()
$this->addfield($field);
# mark the record as modified
# mark the field as modified if it's passwd field
$this->addfield(new Crypt::PWSafe3::Field(
name => 'mtime',
value => time
));
value => $time
)) if $name eq 'passwd';
$this->addfield(new Crypt::PWSafe3::Field(
name => "lastmod",
value => time
value => $time
));
return $field;
}
@@ -207,11 +223,11 @@ you mind, do it yourself.
=head2 B<mtime([time_t])>
Returns the modification time without argument. Sets the modification time
Returns the modification time of the passwd field without argument. Sets the modification time
if an argument is given. Argument must be an integer timestamp
as returned by L<time()>.
This will be generated automatically for modified records, so you
This will be generated automatically for modified records if the passwd field changed, so you
normally don't have to cope with.
=head2 B<lastmod([string])>
@@ -223,9 +239,6 @@ as returned by L<time()>.
This will be generated automatically for modified records, so you
normally don't have to cope with.
I<Note: I don't really know, what's the difference to mtime,
so, I update both. If someone knows better, please tell me.>
=head2 B<url([string])>
Returns the url without argument. Sets the url
@@ -283,7 +296,7 @@ T. Linden <tlinden@cpan.org>
=head1 COPYRIGHT
Copyright (c) 2011 by T.Linden <tlinden@cpan.org>.
Copyright (c) 2011-2012 by T.Linden <tlinden@cpan.org>.
All rights reserved.
=head1 LICENSE