Mirmon - OO interface for mirmon objects
use Mirmon ;
$m = Mirmon -> new ( [ $path-to-config ] )
$conf = $m -> conf ; # a Mirmon::Conf object $state = $m -> state ; # the mirmon state
for my $url ( keys %$state ) { $mirror = $state -> { $url } ; # a Mirmon::Mirror object $mail = $mirror -> mail ; # contact address $mirror -> age ( time ) ; # set mirror age }
Many class and object methods can be used to get or set attributes :
$object -> attribute # get an atttibute $object -> attribute ( $attr ) # set an atttibute
Create a Mirmon object from a config file found in $path, or (by default) in the default list of possible config files. Related objects (config, state) are created and initialised.
Mirmon always reports errors. Normally it only reports changes (inserts/deletes) found in the mirror_list ; in quiet mode, it doesn't. In verbose mode, it reports progress: the startup and finishing of probes.
Mirmon::verbose ( [ $bool ] ) # get/set verbose Mirmon::quiet ( [ $bool ] ) # get/set quiet Mirmon::debug ( [ $bool ] ) # get/set debug
Returns Mirmon's Mirmon::Conf object.
Returns a hashref { url => mirror, ... }
,
where url is as specified in the mirror list
and mirror is a Mirmon::Mirror object.
Returns a hashref { country_code => country_name, ... }
.
Returns the list of default locations for config files.
Probes all mirrors if $get is all
; or a subset if $get is update
;
or only $URL if $get is url
.
A Mirmon::Conf object represents a mirmon conguration. It is normaly created by Mirmon::new(). A specified (or default) config file is read and interpreted.
For every config file entry, there is an attribute method : web_page, state, countries, mirror_list, probe, project_name, project_url, icons, project_logo, timeout, max_probes, min_poll, max_poll, min_sync, max_sync, list_style, put_histo, randomize, add_slash.
Returns the file name of (the root of) the configuration file(s).
Returns a hashref { site => url, ... }
,
as specified in the mirmon config file.
A Mirmon::Mirror object represents the last known state of a mirror. It is normaly created by Mirmon::new() from the state file, as specified in the mirmon config file. Mirmon::Mirror objects can be used to probe mirrors.
The url as given in the mirror list.
The mirror's timestamp found by the last successful probe, or 'undef' if no probe was ever successful.
The status of the last probe, or 'undef' if the mirror was never probed.
The timestamp of the last successful probe or 'undef' if the mirror was never successfully probed.
The probe history is a list of 's' (for success) and 'f' (for failure) characters indicating the result of the probe. New results are appended whenever the mirror is probed.
The state history consists of a timestamp, a '-' char, and a list of chars indicating a past status: 's' (fresh), 'b' (oldish), 'f' (old), 'z' (bad) or 'x' (skip). The timestamp indicates when the state history was last updated. The current status of the mirror is determined by the mirror's age and a few configuration parameters (min_sync, max_sync, max_poll). The state history is updated when the mirror is probed. If the last update of the history was less than 24 hours ago, the last status is replaced by the current status. If the last update of the history was more than 24 hours ago, the current status is appended to the history. One or more 'skip's are inserted, if the timestamp is two or more days old (when mirmon hasn't run for more than two days).
The timestamp of the last probe, or 'undef' if the mirror was never probed.
Returns the parent Mirmon object.
Returns the time part of the state_history attribute.
Returns the history part of the state_history attribute.
For an url like ftp://www.some.org/path/to/home, the type is ftp, the site is www.some.org, and home is ftp://www.some.org/.
Returns the mirror's age (in fractional days), based on the mirror's timestamp as found by the last successful probe ; or based on the length of the state history if no probe was ever successful. Returns 'undef' if the mirror was never probed.
Returns the mirror's contact address as specified in the mirror list.
Returns the mirror's country code as specified in the mirror list.
Start a probe for the mirror in non-blocking mode ; returns the associated (IO::Handle) file handle. The caller must maintain an association between the handles and the mirror objects.
Sets the (IO::Handle) $handle to blocking IO ; reads a result from the handle, and updates the state of the mirror.
© 2003-2016
Henk P. Penning,
Faculty of Science,
Utrecht University
mirmon-2.11 - Sat Jul 23 09:12:31 2016 ; henkp ;
verify html