AddressBook
view release on metacpan or search on metacpan
lib/AddressBook/DB/DBI.pm view on Meta::CPAN
169170171172173174175176177178179180181182183184185186187188189
$entry
->{timestamp} =
$self
->_get_timestamp;
return
$entry
;
}
return
undef
;
}
sub
_get_timestamp {
my
$self
=
shift
;
my
$class
=
ref
$self
|| croak
"Not a method call"
;
if
(
$self
->{dbi_driver} =~ /^CSV/) {
my
@stat
=
stat
(
$self
->{dbh}->{f_dir} .
"/"
.
$self
->{table});
return
ParseDateString(
"epoch $stat[9]"
);
}
else
{
croak
"Error: Don't know how to determine timestamp for this database type"
;
}
}
sub
reset
{
my
$self
=
shift
;
my
$class
=
ref
$self
|| croak
"Not a method call"
;
$self
->search;
lib/AddressBook/DB/LDIF.pm view on Meta::CPAN
149150151152153154155156157158159160161162163164165166167168
my
%attr
= %{
$entry
->get(
db
=>
$self
->{db_name},
values_only
=>
'1'
)};
(
$dn_calculate
=
$self
->{dn_calculate}) =~ s/\$(\w*)/\
$attr
{$1}->[0]/g;
eval
qq{\$dn = $dn_calculate}
;
warn
"Syntax error in dn_calculate: $@"
if
$@;
$dn
.=
","
.
$self
->{base};
return
$dn
;
}
sub
_get_timestamp {
my
$self
=
shift
;
my
$class
=
ref
$self
|| croak
"Not a method call"
;
my
@stat
=
stat
(
$self
->{filename});
return
ParseDateString(
"epoch $stat[9]"
);
}
1;
=head2 Timestamps
For syncronization purposes, all records are timestamped with the modification date
of the LDIF file.
( run in 0.331 second using v1.01-cache-2.11-cpan-4e96b696675 )