Mirmon(3)             User Contributed Perl Documentation            Mirmon(3)



NAME
       Mirmon - OO interface for mirmon objects

SYNOPSIS
         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

Mirmon class methods
       new ( [$path] )
           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 quiet mode, it
           doesn’t. In verbose 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

Mirmon object methods
       conf
           Returns Mirmon’s Mirmon::Conf object.

       state
           Returns a hashref "{ url => mirror, ... }", where url is as speci-
           fied in the mirror list and mirror is a Mirmon::Mirror object.

       regions
           Returns a hashref "{ country_code => country_name, ... }".

       config_list
           Returns the list of default locations for config files.

       get_dates ( $get [, $URL] )
           Probes all mirrors if $get is "all" ; or a subset if $get is
           "update" ; or only $URL if $get is "url".

Mirmon::Conf object methods
       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.

       attribute methods
           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.

       root
           Returns the file name of (the root of) the configuration file(s).

       site_url
           Returns a hashref "{ site => url, ... }", as specified in the mir-
           mon config file.

Mirmon::Mirror object methods
       A Mirmon::Mirror object represents the last known state of a mirror.
       It is normaly created by Mirmon::new() from the state file, as speci-
       fied in the mirmon config file.  Mirmon::Mirror objects can be used to
       probe mirrors.

       attribute methods


       url The url as given in the mirror list.

       age The mirror’s timestamp found by the last successful probe, or
           ’undef’ if no probe was ever successful.

       last_status
           The status of the last probe, or ’undef’ if the mirror was never
           probed.

       last_ok_probe
           The timestamp of the last successful probe or ’undef’ if the mirror
           was never successfully probed.

       probe_history
           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.

       state_history
           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).

       last_probe
           The timestamp of the last probe, or ’undef’ if the mirror was never
           probed.

       object methods


       mirmon
           Returns the parent Mirmon object.

       state_history_time
           Returns the time part of the state_history attribute.

       state_history_hist
           Returns the history part of the state_history attribute.

       type, site, home
           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/.

       age_in_days
           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.

       mail
           Returns the mirror’s contact address as specified in the mirror
           list.

       region
           Returns the mirror’s country code as specified in the mirror list.

       start_probe
           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.

       finish_probe ( $handle )
           Sets the (IO::Handle) $handle to blocking IO ; reads a result from
           the handle, and updates the state of the mirror.

SEE ALSO
       mirmon(1)


AUTHOR
         (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)
