Mirmon(3) User Contributed Perl Documentation Mirmon(3) NNAAMMEE Mirmon - OO interface for mirmon objects SSYYNNOOPPSSIISS 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 MMiirrmmoonn ccllaassss mmeetthhooddss nneeww (( [[$$ppaatthh]] )) 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. verbosity Mirmon always reports errors. Normally it only reports changes (inserts/deletes) found in the mirror_list ; in _q_u_i_e_t mode, it doesn’t. In _v_e_r_b_o_s_e mode, it reports progress: the startup and fin- ishing of probes. Mirmon::verbose ( [ $bool ] ) # get/set verbose Mirmon::quiet ( [ $bool ] ) # get/set quiet Mirmon::debug ( [ $bool ] ) # get/set debug MMiirrmmoonn oobbjjeecctt mmeetthhooddss ccoonnff Returns Mirmon’s Mirmon::Conf object. ssttaattee Returns a hashref "{ url => mirror, ... }", where _u_r_l is as speci- fied in the mirror list and _m_i_r_r_o_r is a Mirmon::Mirror object. rreeggiioonnss Returns a hashref "{ country_code => country_name, ... }". ccoonnffiigg__lliisstt Returns the list of default locations for config files. ggeett__ddaatteess (( $$ggeett [[,, _$$_UU_RR_LL]] )) Probes all mirrors if $get is "all" ; or a subset if $get is "update" ; or only _$_U_R_L if $get is "url". MMiirrmmoonn::::CCoonnff oobbjjeecctt mmeetthhooddss A Mirmon::Conf object represents a mirmon conguration. It is normaly created by _M_i_r_m_o_n_:_:_n_e_w_(_). A specified (or default) config file is read and interpreted. attribute methods For every config file entry, there is an attribute method : wweebb__ppaaggee, ssttaattee, ccoouunnttrriieess, mmiirrrroorr__lliisstt, pprroobbee, pprroojjeecctt__nnaammee, pprroojjeecctt__uurrll, iiccoonnss, pprroojjeecctt__llooggoo, ttiimmeeoouutt, mmaaxx__pprroobbeess, mmiinn__ppoollll, mmaaxx__ppoollll, mmiinn__ssyynncc, mmaaxx__ssyynncc, lliisstt__ssttyyllee, ppuutt__hhiissttoo, rraannddoommiizzee, aadddd__ssllaasshh. rroooott Returns the file name of (the root of) the configuration file(s). ssiittee__uurrll Returns a hashref "{ site => url, ... }", as specified in the mir- mon config file. MMiirrmmoonn::::MMiirrrroorr oobbjjeecctt mmeetthhooddss A Mirmon::Mirror object represents the last known state of a mirror. It is normaly created by _M_i_r_m_o_n_:_:_n_e_w_(_) from the state file, as speci- fied in the mirmon config file. Mirmon::Mirror objects can be used to probe mirrors. aattttrriibbuuttee mmeetthhooddss uurrll The url as given in the mirror list. aaggee The mirror’s timestamp found by the last successful probe, or ’undef’ if no probe was ever successful. llaasstt__ssttaattuuss The status of the last probe, or ’undef’ if the mirror was never probed. llaasstt__ookk__pprroobbee The timestamp of the last successful probe or ’undef’ if the mirror was never successfully probed. pprroobbee__hhiissttoorryy The probe history is a list of ’s’ (for success) and ’f’ (for fail- ure) characters indicating the result of the probe. New results are appended whenever the mirror is probed. ssttaattee__hhiissttoorryy 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 parame- ters (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). llaasstt__pprroobbee The timestamp of the last probe, or ’undef’ if the mirror was never probed. oobbjjeecctt mmeetthhooddss mmiirrmmoonn Returns the parent Mirmon object. ssttaattee__hhiissttoorryy__ttiimmee Returns the _t_i_m_e part of the state_history attribute. ssttaattee__hhiissttoorryy__hhiisstt Returns the _h_i_s_t_o_r_y part of the state_history attribute. ttyyppee, ssiittee, hhoommee For an url like _f_t_p_:_/_/_w_w_w_._s_o_m_e_._o_r_g_/_p_a_t_h_/_t_o_/_h_o_m_e, the ttyyppee is _f_t_p, the ssiittee is _w_w_w_._s_o_m_e_._o_r_g, and hhoommee is _f_t_p_:_/_/_w_w_w_._s_o_m_e_._o_r_g_/. aaggee__iinn__ddaayyss Returns the mirror’s age (in fractional days), based on the mir- ror’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. mmaaiill Returns the mirror’s contact address as specified in the mirror list. rreeggiioonn Returns the mirror’s country code as specified in the mirror list. ssttaarrtt__pprroobbee 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. ffiinniisshh__pprroobbee (( $$hhaannddllee )) Sets the (IO::Handle) $$hhaannddllee to blocking IO ; reads a result from the handle, and updates the state of the mirror. SSEEEE AALLSSOO mirmon(1) AAUUTTHHOORR (c) 2003-2016 Henk P. Penning Faculty of Science, Utrecht University http://www.staff.science.uu.nl/~penni101/ -- penning@uu.nl mirmon-2.11 - Sat Jul 23 09:12:31 2016 ; henkp perl v5.8.8 2016-07-23 Mirmon(3)