| 1 | package WWW::PGXN::Mirror; | ||
| 2 | |||
| 3 | 9 | ▶ | use 5.8.1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 9 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 9 | our $VERSION = v0.12.4; | |
| 7 | |||
| 8 | BEGIN { | ||
| 9 | 9 | ▶ | for my $attr (qw( |
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||
| 10 | uri | ||
| 11 | frequency | ||
| 12 | location | ||
| 13 | organization | ||
| 14 | timezone | ||
| 15 | bandwidth | ||
| 16 | src | ||
| 17 | rsync | ||
| 18 | notes | ||
| 19 | )) { | ||
| 20 | 9 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 81 | ▶ | *{$attr} = sub { shift->{$attr} }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | sub new { | ||
| 26 | 2 | ▶ | my ($class, $data) = @_; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 27 | 2 | bless $data, $class; | |
| 28 | } | ||
| 29 | |||
| 30 | sub email { | ||
| 31 | 1 | ▶ | my ($host, $user) = split /[|]/ => shift->{email}; |
|
Subroutine
email: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | 1 | return "$user\@$host"; | |
| 33 | } | ||
| 34 | |||
| 35 | 9 | 1; | |
| 36 | __END__ | ||
| 37 | |||
| 38 | =head1 Name | ||
| 39 | |||
| 40 | WWW::PGXN::Mirror - Mirror metadata fetched from PGXN | ||
| 41 | |||
| 42 | =head1 Synopsis | ||
| 43 | |||
| 44 | my $pgxn = WWW::PGXN->new( url => 'http://api.pgxn.org/' ); | ||
| 45 | for my $mirror ($pgxn->mirrors) { | ||
| 46 | say $mirror->url; | ||
| 47 | } | ||
| 48 | |||
| 49 | =head1 Description | ||
| 50 | |||
| 51 | This module represents PGXN mirror metadata fetched from PGXN>. It is not | ||
| 52 | intended to be constructed directly, but via the L<WWW::PGXN/mirrors> method | ||
| 53 | of L<WWW::PGXN>. | ||
| 54 | |||
| 55 | =head1 Interface | ||
| 56 | |||
| 57 | =begin private | ||
| 58 | |||
| 59 | =head2 Constructor | ||
| 60 | |||
| 61 | =head3 C<new> | ||
| 62 | |||
| 63 | my $mirror = WWW::PGXN::Mirror->new($data); | ||
| 64 | |||
| 65 | Construct a new WWW::PGXN::Mirror object. The argument must be the data | ||
| 66 | fetched. | ||
| 67 | |||
| 68 | =end private | ||
| 69 | |||
| 70 | =head2 Instance Accessors | ||
| 71 | |||
| 72 | =head3 C<uri> | ||
| 73 | |||
| 74 | my $uri = $mirror->uri; | ||
| 75 | $mirror->uri($uri); | ||
| 76 | |||
| 77 | The URI of the mirror. | ||
| 78 | |||
| 79 | =head3 C<bandwidth> | ||
| 80 | |||
| 81 | my $bandwidth = $mirror->bandwidth; | ||
| 82 | $mirror->bandwidth($bandwidth); | ||
| 83 | |||
| 84 | The mirror's bandwidth. | ||
| 85 | |||
| 86 | =head3 C<frequency> | ||
| 87 | |||
| 88 | my $frequency = $mirror->frequency; | ||
| 89 | $mirror->frequency($frequency); | ||
| 90 | |||
| 91 | A description of how frequently the mirror updates. | ||
| 92 | |||
| 93 | =head3 C<location> | ||
| 94 | |||
| 95 | my $location = $mirror->location; | ||
| 96 | $mirror->location($location); | ||
| 97 | |||
| 98 | The location of the mirror. | ||
| 99 | |||
| 100 | =head3 C<notes> | ||
| 101 | |||
| 102 | my $notes = $mirror->notes; | ||
| 103 | $mirror->notes($notes); | ||
| 104 | |||
| 105 | Notes about the mirror. | ||
| 106 | |||
| 107 | =head3 C<organization> | ||
| 108 | |||
| 109 | my $organization = $mirror->organization; | ||
| 110 | $mirror->organization($organization); | ||
| 111 | |||
| 112 | The name of the organization hosting the mirror. | ||
| 113 | |||
| 114 | =head3 C<email> | ||
| 115 | |||
| 116 | my $email = $mirror->email; | ||
| 117 | $mirror->email($email); | ||
| 118 | |||
| 119 | The email address of the contact responsible for the mirror.. | ||
| 120 | |||
| 121 | =head3 C<src> | ||
| 122 | |||
| 123 | my $src = $mirror->src; | ||
| 124 | $mirror->src($src); | ||
| 125 | |||
| 126 | The rsync URL that the mirror updates from. | ||
| 127 | |||
| 128 | =head3 C<rsync> | ||
| 129 | |||
| 130 | my $rsync = $mirror->rsync; | ||
| 131 | $mirror->rsync($rsync); | ||
| 132 | |||
| 133 | The rsync URL the mirror offers for other mirrors to update from. If false, | ||
| 134 | the mirror provides no rsync URL of its own. | ||
| 135 | |||
| 136 | =head3 C<timezone> | ||
| 137 | |||
| 138 | my $timezone = $mirror->timezone; | ||
| 139 | $mirror->timezone($timezone); | ||
| 140 | |||
| 141 | The time zone in which the mirror lives. | ||
| 142 | |||
| 143 | =head1 See Also | ||
| 144 | |||
| 145 | =over | ||
| 146 | |||
| 147 | =item * L<WWW::PGXN> | ||
| 148 | |||
| 149 | The main class to communicate with a PGXN mirror or API server. | ||
| 150 | |||
| 151 | =back | ||
| 152 | |||
| 153 | =head1 Support | ||
| 154 | |||
| 155 | This module is stored in an open L<GitHub | ||
| 156 | repository|http://github.com/theory/www-pgxn/>. Feel free to fork and | ||
| 157 | contribute! | ||
| 158 | |||
| 159 | Please file bug reports via L<GitHub | ||
| 160 | Issues|http://github.com/theory/www-pgxn/issues/> or by sending mail to | ||
| 161 | L<bug-WWW-PGXN@rt.cpan.org|mailto:bug-WWW-PGXN@rt.cpan.org>. | ||
| 162 | |||
| 163 | =head1 Author | ||
| 164 | |||
| 165 | David E. Wheeler <david@justatheory.com> | ||
| 166 | |||
| 167 | =head1 Copyright and License | ||
| 168 | |||
| 169 | Copyright (c) 2011 David E. Wheeler. Some Rights Reserved. | ||
| 170 | |||
| 171 | This module is free software; you can redistribute it and/or modify it under | ||
| 172 | the same terms as Perl itself. | ||
| 173 | |||
| 174 | =cut | ||