| 1 | package Astro::Catalog::Query::GSC; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Astro::Catalog::Query::GSC - A query request to the GSC Catalog | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | $gsc = new Astro::Catalog::Query::GSC( | ||||||||||||||||||||||||||||
| 10 | RA => $ra, | ||||||||||||||||||||||||||||
| 11 | Dec => $dec, | ||||||||||||||||||||||||||||
| 12 | Radius => $radius, | ||||||||||||||||||||||||||||
| 13 | Bright => $magbright, | ||||||||||||||||||||||||||||
| 14 | Faint => $magfaint, | ||||||||||||||||||||||||||||
| 15 | Sort => $sort_type, | ||||||||||||||||||||||||||||
| 16 | Nout => $number_out ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | my $catalog = $gsc->querydb(); | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | The module is an object orientated interface to the online Guide Star | ||||||||||||||||||||||||||||
| 23 | catalogue at the ESO/ST-ECF archive site. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | Stores information about an prospective GSC query and allows the query to | ||||||||||||||||||||||||||||
| 26 | be made, returning an Astro::Catalog::GSC::Catalog object. | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | The object will by default pick up the proxy information from the HTTP_PROXY | ||||||||||||||||||||||||||||
| 29 | and NO_PROXY environment variables, see the LWP::UserAgent documentation for | ||||||||||||||||||||||||||||
| 30 | details. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | See L<Astro::Catalog::BaseQuery> for the catalog-independent methods. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =cut | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 2 | ▶ | use base qw/Astro::Catalog::Transport::REST/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 2 | ▶ | use Astro::Catalog; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 44 | 2 | ▶ | use Astro::Catalog::Item; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | 2 | ▶ | use Astro::Flux; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | 2 | ▶ | use Astro::Fluxes; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 47 | 2 | ▶ | use Number::Uncertainty; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 2 | our $VERSION = '4.38'; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =begin __PRIVATE_METHODS__ | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head2 Private methods | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | These methods are for internal use only. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =over 4 | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =item B<_default_remote_host> | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | ▶ | sub _default_remote_host { | ||||||||||||||||||||||||||
|
Subroutine
_default_remote_host: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 64 | 1 | return "archive.eso.org"; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =item B<_default_url_path> | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 1 | ▶ | sub _default_url_path { | ||||||||||||||||||||||||||
|
Subroutine
_default_url_path: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 72 | 1 | return "gsc/gsc?"; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =item B<_get_allowed_options> | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | Returns a hash with keys, being the internal options supported | ||||||||||||||||||||||||||||
| 78 | by this subclass, and values being the key name actually required | ||||||||||||||||||||||||||||
| 79 | by the remote system (and to be included in the query). | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =cut | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 27 | ▶ | sub _get_allowed_options { | ||||||||||||||||||||||||||
|
Subroutine
_get_allowed_options: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 84 | 27 | my $self = shift; | |||||||||||||||||||||||||||
| 85 | return ( | ||||||||||||||||||||||||||||
| 86 | 27 | ra => 'ra', | |||||||||||||||||||||||||||
| 87 | dec => 'dec', | ||||||||||||||||||||||||||||
| 88 | object => 'object', | ||||||||||||||||||||||||||||
| 89 | radmax => 'radmax', | ||||||||||||||||||||||||||||
| 90 | magbright => 'magbright', | ||||||||||||||||||||||||||||
| 91 | magfaint => 'magfaint', | ||||||||||||||||||||||||||||
| 92 | sort => 'sort', | ||||||||||||||||||||||||||||
| 93 | nout => 'nout', | ||||||||||||||||||||||||||||
| 94 | format => 'format', | ||||||||||||||||||||||||||||
| 95 | catalogue => 'catalogue', | ||||||||||||||||||||||||||||
| 96 | epoch => 'epoch', | ||||||||||||||||||||||||||||
| 97 | chart => 'chart', | ||||||||||||||||||||||||||||
| 98 | multi => 'multi', | ||||||||||||||||||||||||||||
| 99 | ); | ||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =item B<_get_default_options> | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | Get the default query state. | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =cut | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 1 | ▶ | sub _get_default_options { | ||||||||||||||||||||||||||
|
Subroutine
_get_default_options: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 109 | return ( | ||||||||||||||||||||||||||||
| 110 | # Hidden | ||||||||||||||||||||||||||||
| 111 | 1 | catalogue => 'gsc', | |||||||||||||||||||||||||||
| 112 | epoch => '2000.0', | ||||||||||||||||||||||||||||
| 113 | chart => 1, | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | # Target information | ||||||||||||||||||||||||||||
| 116 | ra => undef, | ||||||||||||||||||||||||||||
| 117 | dec => undef, | ||||||||||||||||||||||||||||
| 118 | object => undef, | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | # Limits | ||||||||||||||||||||||||||||
| 121 | radmax => 5, | ||||||||||||||||||||||||||||
| 122 | magbright => 0, | ||||||||||||||||||||||||||||
| 123 | magfaint => 100, | ||||||||||||||||||||||||||||
| 124 | format => 1, | ||||||||||||||||||||||||||||
| 125 | sort => 'RA', | ||||||||||||||||||||||||||||
| 126 | nout => 20000, | ||||||||||||||||||||||||||||
| 127 | multi => 1, | ||||||||||||||||||||||||||||
| 128 | ); | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | =item B<_parse_query> | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | Private function used to parse the results returned in an GSC query. | ||||||||||||||||||||||||||||
| 134 | Should not be called directly. Instead use the querydb() assessor method to | ||||||||||||||||||||||||||||
| 135 | make and parse the results. | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | =cut | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 1 | ▶ | sub _parse_query { | ||||||||||||||||||||||||||
|
Subroutine
_parse_query: called CC=9 SCAR=35.8
| |||||||||||||||||||||||||||||
| 140 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | # get a local copy of the current BUFFER | ||||||||||||||||||||||||||||
| 143 | 1 | my @buffer = split /\n/, $self->{BUFFER}; | |||||||||||||||||||||||||||
| 144 | 1 | chomp @buffer; | |||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | # create an Astro::Catalog object to hold the search results | ||||||||||||||||||||||||||||
| 147 | 1 | my $catalog = new Astro::Catalog(); | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | # create a temporary object to hold stars | ||||||||||||||||||||||||||||
| 150 | 1 | my $star; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 1 | my ($line, $counter); | |||||||||||||||||||||||||||
| 153 | 1 | my %field; # field centre | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | # loop round the returned buffer and stuff the contents into star objects | ||||||||||||||||||||||||||||
| 156 | 1 | foreach $line (0 ... $#buffer) { | |||||||||||||||||||||||||||
| 157 | # Parse field centre | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | # RA | ||||||||||||||||||||||||||||
| 160 | 2 | ▶ | if (lc($buffer[$line]) =~ "<td>ra:") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | 0 | $_ = lc($buffer[$line]); | |||||||||||||||||||||||||||
| 162 | 0 | my ($ra) = /^\s*<td>ra:\s+(.*)<\/td>/; | |||||||||||||||||||||||||||
| 163 | 0 | $field{RA} = $ra; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | # Dec | ||||||||||||||||||||||||||||
| 167 | 2 | ▶ | if (lc($buffer[$line]) =~ "<td>dec:") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | 0 | $_ = lc($buffer[$line]); | |||||||||||||||||||||||||||
| 169 | 0 | my ($dec) = /^\s+<td>dec:\s+(.*)<\/td>/; | |||||||||||||||||||||||||||
| 170 | 0 | $field{Dec} = $dec; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | # Radius | ||||||||||||||||||||||||||||
| 174 | 2 | ▶ | if (lc($buffer[$line]) =~ "search radius:") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 175 | 0 | $_ = lc($buffer[$line+1]); | |||||||||||||||||||||||||||
| 176 | 0 | my ($radius) = />\s+(.*)\s\w/; | |||||||||||||||||||||||||||
| 177 | 0 | $field{Radius} = $radius; | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | 2 | $catalog->fieldcentre(%field); | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | # Parse list of objects | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 2 | ▶ | if (lc($buffer[$line]) =~ "<pre>") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | # reached the catalog block, loop through until </pre> reached | ||||||||||||||||||||||||||||
| 185 | 0 | $counter = $line + 2; | |||||||||||||||||||||||||||
| 186 | 0 | ▶ | until (lc($buffer[$counter+1]) =~ "</pre>") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | # split each line | ||||||||||||||||||||||||||||
| 188 | 0 | my @separated = split /\s+/, $buffer[$counter]; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | # check that there is something on the line | ||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if (defined $separated[0]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | # create a temporary place holder object | ||||||||||||||||||||||||||||
| 193 | 0 | $star = new Astro::Catalog::Item(); | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | # ID | ||||||||||||||||||||||||||||
| 196 | 0 | my $id = $separated[2]; | |||||||||||||||||||||||||||
| 197 | 0 | $star->id($id); | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | # RA | ||||||||||||||||||||||||||||
| 200 | 0 | my $objra = "$separated[3] $separated[4] $separated[5]"; | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | # Dec | ||||||||||||||||||||||||||||
| 203 | 0 | my $objdec = "$separated[6] $separated[7] $separated[8]"; | |||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | $star->coords(new Astro::Coords( | |||||||||||||||||||||||||||
| 206 | ra => $objra, | ||||||||||||||||||||||||||||
| 207 | dec => $objdec, | ||||||||||||||||||||||||||||
| 208 | units => 'sex', | ||||||||||||||||||||||||||||
| 209 | type => 'J2000', | ||||||||||||||||||||||||||||
| 210 | name => $id, | ||||||||||||||||||||||||||||
| 211 | ), | ||||||||||||||||||||||||||||
| 212 | ); | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 0 | $star->fluxes(new Astro::Fluxes(new Astro::Flux( | |||||||||||||||||||||||||||
| 215 | new Number::Uncertainty( | ||||||||||||||||||||||||||||
| 216 | Value => $separated[10], | ||||||||||||||||||||||||||||
| 217 | Error => $separated[11]), | ||||||||||||||||||||||||||||
| 218 | 'mag', "B"))); | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | # Quality | ||||||||||||||||||||||||||||
| 221 | 0 | my $quality = $separated[13]; | |||||||||||||||||||||||||||
| 222 | 0 | ▶ | $quality = 1 if $quality == 3; # 3 == non-stellar | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 0 | $star->quality($quality); | |||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | # Field | ||||||||||||||||||||||||||||
| 226 | 0 | my $field = $separated[12]; | |||||||||||||||||||||||||||
| 227 | 0 | $star->field($field); | |||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | # GSC, obvious! | ||||||||||||||||||||||||||||
| 230 | 0 | $star->gsc("TRUE"); | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | # Distance | ||||||||||||||||||||||||||||
| 233 | 0 | my $distance = $separated[16]; | |||||||||||||||||||||||||||
| 234 | 0 | $star->distance($distance); | |||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | # Position Angle | ||||||||||||||||||||||||||||
| 237 | 0 | my $pos_angle = $separated[17]; | |||||||||||||||||||||||||||
| 238 | 0 | $star->posangle($pos_angle); | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | # Push the star into the catalog | ||||||||||||||||||||||||||||
| 242 | 0 | $catalog->pushstar($star); | |||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | # increment counter | ||||||||||||||||||||||||||||
| 245 | 0 | $counter = $counter + 1; | |||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | # reset $line to correct place | ||||||||||||||||||||||||||||
| 249 | 0 | $line = $counter; | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | # Set the field centre | ||||||||||||||||||||||||||||
| 254 | 1 | $catalog->fieldcentre(%field); | |||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 1 | return $catalog; | |||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =back | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | =head2 Translation Methods | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | The query options stored internally in the object are not necessarily | ||||||||||||||||||||||||||||
| 265 | the form required for a query to a remote server. Methods for converting | ||||||||||||||||||||||||||||
| 266 | from the internal representation to the external query format are | ||||||||||||||||||||||||||||
| 267 | provided in the form of _from_$opt. ie: | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | ($outkey, $outvalue) = $q->_from_ra(); | ||||||||||||||||||||||||||||
| 270 | ($outkey, $outvalue) = $q->_from_object(); | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | The base class only includes one to one mappings. | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =item B<_translate_one_to_one> | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | Return a list of internal options (as defined in C<_get_allowed_options>) | ||||||||||||||||||||||||||||
| 277 | that are known to support a one-to-one mapping of the internal value | ||||||||||||||||||||||||||||
| 278 | to the external value. | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | %one = $q->_translate_one_to_one(); | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | Returns a hash with keys and no values (this makes it easy to | ||||||||||||||||||||||||||||
| 283 | check for the option). | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | This method also returns, the values from the parent class. | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =cut | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | 1 | ▶ | sub _translate_one_to_one { | ||||||||||||||||||||||||||
|
Subroutine
_translate_one_to_one: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 290 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 291 | # convert to a hash-list | ||||||||||||||||||||||||||||
| 292 | return ($self->SUPER::_translate_one_to_one, | ||||||||||||||||||||||||||||
| 293 | 1 | map { $_, undef }(qw/ | |||||||||||||||||||||||||||
| 294 | chart epoch catalogue | ||||||||||||||||||||||||||||
| 295 | /) | ||||||||||||||||||||||||||||
| 296 | ); | ||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | 1 | ▶ | sub _from_multi { | ||||||||||||||||||||||||||
|
Subroutine
_from_multi: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||
| 301 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 302 | 1 | my $key = "multi"; | |||||||||||||||||||||||||||
| 303 | 1 | my $value = $self->query_options($key); | |||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | # convert boolean to "yes" or "no" | ||||||||||||||||||||||||||||
| 306 | 1 | ▶ | if (! $value || $value =~ /^no%/i) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $value or $value =~ /^no%/i
MC/DC0%0/2
not $value or $value =~ /^no%/i
not $value
$value =~ /^no%/i
Truth table33%1/3
not(A) or B
A= not $valueB= $value =~ /^no%/i
| |||||||||||||||||||||||||||||
| 307 | # boolean false is always false | ||||||||||||||||||||||||||||
| 308 | # as is "no" | ||||||||||||||||||||||||||||
| 309 | 0 | $value = 'no'; | |||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||
| 311 | else { | ||||||||||||||||||||||||||||
| 312 | # must be true | ||||||||||||||||||||||||||||
| 313 | 1 | $value = 'yes'; | |||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | 1 | my %allow = $self->_get_allowed_options(); | |||||||||||||||||||||||||||
| 317 | 1 | return ($allow{$key}, $value); | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 2 | 1; | |||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | __END__ | ||||||||||||||||||||||||||||