UpdateChecker::Data -- API to store target data to somewhere.
Following methods are the methods to be overrided in sub class. If you want to create sub class, you need to read this document. But you don't, you don't need to read on.
@list = $u->check_list;
It returns the sorted list to be checked whether the target is updated or not.
By the default, it takes an array, an array reference or no arguments.
If the argument is passed, it is the list to be checked whether the target is updated or not.
If no arguments is passed, it will call _data
method,
it may have the hash reference which has the list as key of hash.
I think you will define following method in sub class:
sub check_list{ my $self = shift; my @check_list;
# do somehting ...
return $self->SUPER::check_list(\@check_list); }
@check_list is the list to be checked whether the target is updated or not.
or define constructor in sub class:
sub new{ my($class, $data) = @_; ref $class and $class = ref $class; my $self = $class->SUPER::new();
# do something ...
$self->{data} = $self->_get_hash_ref; return $self; }
_get_hash_ref
returns the hash reference
which has the list as key of hash.
If you don't like this behavior, for example you want to sort by descending, you can override this. This method just has to return the sorted list to be checked whether the target is updated or not.
$self->_record($target, $contents);
This method stores the contents to somewhere and returns 1 or 0. If successfuly stored the contents, return 1. If not, return 0. It is passed two arguments. First argument is the target. Second argument is the contents of the target.
$u->_delete_stored(@target); $u->_delete_stored_post(@target);
It takes one argument or more than one arguments. Whether it allows several arguments or not depends on your impementation. The argument is the target to remove from the check list and to delete the stored contents.
$self->stored_contents($target);
If you define stored_file
method, you have to define this method.
It returns the contents of the target.
The target is passed as first argument or $self->target.
If it doesn't get the target by the argument or the method, it will croak.
$self->stored_file($target); $self->stored_file();
If you don't define this method, you must define stored_contents
method.
It return the file name in which has the contents of the target.
The target is passed as first argument or $self->target.
If it doesn't get the target by the argument or the method, it will croak.
UpdateChecker
Ktat <ktat.is at gmail.com>
Copyright 2003-2004 by Ktat <ktat.is at gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html