File Coverage

blib/lib/WWW/WolframAlpha/Source.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 6 0.0
condition 0 4 0.0
subroutine 3 6 50.0
pod 0 3 0.0
total 12 40 30.0


line stmt bran cond sub pod time code
1             package WWW::WolframAlpha::Source;
2              
3 1     1   45 use 5.008008;
  1         3  
  1         38  
4 1     1   6 use strict;
  1         1  
  1         27  
5 1     1   5 use warnings;
  1         2  
  1         291  
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 ($url,$text);
35              
36 0 0         if ($xmlo) {
37 0   0       $url = $xmlo->{'url'} || undef;
38 0   0       $text = $xmlo->{'text'} || undef;
39              
40 0 0         $self->{'url'} = $url if defined $url;
41 0 0         $self->{'text'} = $text if defined $text;
42             }
43              
44 0           return(bless($self, $class));
45             }
46              
47 0     0 0   sub text {shift->{'text'};}
48 0     0 0   sub url {shift->{'url'};}
49              
50              
51             # Preloaded methods go here.
52              
53             1;
54              
55              
56             =pod
57              
58             =head1 NAME
59              
60             WWW::WolframAlpha::Source
61              
62             =head1 VERSION
63              
64             version 1.10
65              
66             =head1 SYNOPSIS
67              
68             foreach my $source (@{$query->sources->source}) {
69             print " url: ", $source->url, "\n";
70             print " text: ", $source->text, "\n" if $source->text;
71             }
72              
73             =head1 DESCRIPTION
74              
75             =head2 ATTRIBUTES
76              
77             $source->url
78              
79             $spellcheck->text
80              
81             =head2 EXPORT
82              
83             None by default.
84              
85             =head1 NAME
86              
87             WWW::WolframAlpha::Source - Perl objects returned via $query->sources->source
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__