1Mirmon(3) User Contributed Perl Documentation Mirmon(3)
2
3
4
6 Mirmon - OO interface for mirmon objects
7
9 use Mirmon ;
10
11 $m = Mirmon -> new ( [ $path-to-config ] )
12
13 $conf = $m -> conf ; # a Mirmon::Conf object
14 $state = $m -> state ; # the mirmon state
15
16 for my $url ( keys %$state )
17 { $mirror = $state -> { $url } ; # a Mirmon::Mirror object
18 $mail = $mirror -> mail ; # contact address
19 $mirror -> age ( time ) ; # set mirror age
20 }
21
22 Many class and object methods can be used to get or set attributes :
23
24 $object -> attribute # get an atttibute
25 $object -> attribute ( $attr ) # set an atttibute
26
28 new ( [$path] )
29 Create a Mirmon object from a config file found in $path, or (by
30 default) in the default list of possible config files. Related
31 objects (config, state) are created and initialised.
32
33 verbosity
34 Mirmon always reports errors. Normally it only reports changes
35 (inserts/deletes) found in the mirror_list ; in quiet mode, it
36 doesn't. In verbose mode, it reports progress: the startup and fin‐
37 ishing of probes.
38
39 Mirmon::verbose ( [ $bool ] ) # get/set verbose
40 Mirmon::quiet ( [ $bool ] ) # get/set quiet
41 Mirmon::debug ( [ $bool ] ) # get/set debug
42
44 conf
45 Returns Mirmon's Mirmon::Conf object.
46
47 state
48 Returns a hashref "{ url => mirror, ... }", where url is as speci‐
49 fied in the mirror list and mirror is a Mirmon::Mirror object.
50
51 regions
52 Returns a hashref "{ country_code => country_name, ... }".
53
54 config_list
55 Returns the list of default locations for config files.
56
57 get_dates ( $get [, $URL] )
58 Probes all mirrors if $get is "all" ; or a subset if $get is
59 "update" ; or only $URL if $get is "url".
60
62 A Mirmon::Conf object represents a mirmon conguration. It is normaly
63 created by Mirmon::new(). A specified (or default) config file is read
64 and interpreted.
65
66 attribute methods
67 For every config file entry, there is an attribute method :
68 web_page, state, countries, mirror_list, probe, project_name,
69 project_url, icons, project_logo, timeout, max_probes, min_poll,
70 max_poll, min_sync, max_sync, list_style, put_histo, randomize,
71 add_slash.
72
73 root
74 Returns the file name of (the root of) the configuration file(s).
75
76 site_url
77 Returns a hashref "{ site => url, ... }", as specified in the mir‐
78 mon config file.
79
81 A Mirmon::Mirror object represents the last known state of a mirror.
82 It is normaly created by Mirmon::new() from the state file, as speci‐
83 fied in the mirmon config file. Mirmon::Mirror objects can be used to
84 probe mirrors.
85
86 attribute methods
87
88 url The url as given in the mirror list.
89
90 age The mirror's timestamp found by the last successful probe, or
91 'undef' if no probe was ever successful.
92
93 last_status
94 The status of the last probe, or 'undef' if the mirror was never
95 probed.
96
97 last_ok_probe
98 The timestamp of the last successful probe or 'undef' if the mirror
99 was never successfully probed.
100
101 probe_history
102 The probe history is a list of 's' (for success) and 'f' (for fail‐
103 ure) characters indicating the result of the probe. New results are
104 appended whenever the mirror is probed.
105
106 state_history
107 The state history consists of a timestamp, a '-' char, and a list
108 of chars indicating a past status: 's' (fresh), 'b' (oldish), 'f'
109 (old), 'z' (bad) or 'x' (skip). The timestamp indicates when the
110 state history was last updated. The current status of the mirror
111 is determined by the mirror's age and a few configuration parame‐
112 ters (min_sync, max_sync, max_poll). The state history is updated
113 when the mirror is probed. If the last update of the history was
114 less than 24 hours ago, the last status is replaced by the current
115 status. If the last update of the history was more than 24 hours
116 ago, the current status is appended to the history. One or more
117 'skip's are inserted, if the timestamp is two or more days old
118 (when mirmon hasn't run for more than two days).
119
120 last_probe
121 The timestamp of the last probe, or 'undef' if the mirror was never
122 probed.
123
124 object methods
125
126 mirmon
127 Returns the parent Mirmon object.
128
129 state_history_time
130 Returns the time part of the state_history attribute.
131
132 state_history_hist
133 Returns the history part of the state_history attribute.
134
135 type, site, home
136 For an url like ftp://www.some.org/path/to/home, the type is ftp,
137 the site is www.some.org, and home is ftp://www.some.org/.
138
139 age_in_days
140 Returns the mirror's age (in fractional days), based on the mir‐
141 ror's timestamp as found by the last successful probe ; or based on
142 the length of the state history if no probe was ever successful.
143 Returns 'undef' if the mirror was never probed.
144
145 mail
146 Returns the mirror's contact address as specified in the mirror
147 list.
148
149 region
150 Returns the mirror's country code as specified in the mirror list.
151
152 start_probe
153 Start a probe for the mirror in non-blocking mode ; returns the
154 associated (IO::Handle) file handle. The caller must maintain an
155 association between the handles and the mirror objects.
156
157 finish_probe ( $handle )
158 Sets the (IO::Handle) $handle to blocking IO ; reads a result from
159 the handle, and updates the state of the mirror.
160
162 mirmon(1)
163
164
166 (c) 2003-2016 Henk P. Penning
167 Faculty of Science, Utrecht University
168 http://www.staff.science.uu.nl/~penni101/ -- penning@uu.nl
169 mirmon-2.11 - Sat Jul 23 09:12:31 2016 ; henkp
170
171
172
173perl v5.8.8 2016-07-23 Mirmon(3)