File Coverage

blib/lib/WWW/WolframAlpha/Error.pm
Criterion Covered Total %
statement 9 23 39.1
branch 0 8 0.0
condition 0 4 0.0
subroutine 3 6 50.0
pod 0 3 0.0
total 12 44 27.2


line stmt bran cond sub pod time code
1             package WWW::WolframAlpha::Error;
2              
3 1     1   18 use 5.008008;
  1         4  
  1         42  
4 1     1   6 use strict;
  1         2  
  1         33  
5 1     1   5 use warnings;
  1         2  
  1         345  
6              
7             require Exporter;
8              
9             our @ISA = qw(Exporter);
10              
11             # Items to export into callers namespace by default. Note: do not export
12             # names by default without a very good reason. Use EXPORT_OK instead.
13             # Do not simply export all your public functions/methods/constants.
14              
15             # This allows declaration use WWW::WolframAlpha ':all';
16             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
17             # will save memory.
18             our %EXPORT_TAGS = ( 'all' => [ qw(
19             ) ] );
20              
21             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
22              
23             our @EXPORT = qw(
24             );
25              
26             our $VERSION = '1.0';
27              
28             sub new {
29 0     0 0   my $class = shift;
30 0           my $xmlo = shift;
31              
32 0           my $self = {};
33              
34 0           my ($code,$msg);
35              
36 0 0         if ($xmlo eq 'true') {
    0          
37 0           $self->{'code'} = '?';
38 0           $self->{'msg'} = 'unknown error';
39              
40             } elsif ($xmlo) {
41 0   0       $code = $xmlo->[1]->{'code'} || undef;
42 0   0       $msg = $xmlo->[1]->{'msg'} || undef;
43              
44 0 0         $self->{'code'} = $code if defined $code;
45 0 0         $self->{'msg'} = $msg if defined $msg;
46             }
47              
48 0           return(bless($self, $class));
49             }
50              
51 0     0 0   sub code {shift->{'code'};}
52 0     0 0   sub msg {shift->{'msg'};}
53              
54             # Preloaded methods go here.
55              
56             1;
57              
58              
59             =pod
60              
61             =head1 NAME
62              
63             WWW::WolframAlpha::Error
64              
65             =head1 VERSION
66              
67             version 1.10
68              
69             =head1 SYNOPSIS
70              
71             print "Error ", $pod->error->code, ": ", $pod->error->msg, "\n";
72              
73             =head1 DESCRIPTION
74              
75             =head2 ATTRIBUTES
76              
77             $error->code
78              
79             $error->msg
80              
81             =head2 EXPORT
82              
83             None by default.
84              
85             =head1 NAME
86              
87             WWW::WolframAlpha::Error - Perl objects returned via ->error calls
88              
89             =head1 SEE ALSO
90              
91             L
92              
93             =head1 AUTHOR
94              
95             Gabriel Weinberg, Eyegg@alum.mit.eduE
96              
97             =head1 COPYRIGHT AND LICENSE
98              
99             Copyright (C) 2009 by Gabriel Weinberg
100              
101             This library is free software; you can redistribute it and/or modify
102             it under the same terms as Perl itself, either Perl version 5.8.8 or,
103             at your option, any later version of Perl 5 you may have available.
104              
105             =head1 AUTHOR
106              
107             Gabriel Weinberg
108              
109             =head1 COPYRIGHT AND LICENSE
110              
111             This software is copyright (c) 2009 by Gabriel Weinberg.
112              
113             This is free software; you can redistribute it and/or modify it under
114             the same terms as the Perl 5 programming language system itself.
115              
116             =cut
117              
118              
119             __END__