File Coverage

blib/lib/WWW/WolframAlpha/Link.pm
Criterion Covered Total %
statement 9 24 37.5
branch 0 8 0.0
condition 0 6 0.0
subroutine 3 7 42.8
pod 0 4 0.0
total 12 49 24.4


line stmt bran cond sub pod time code
1             package WWW::WolframAlpha::Link;
2              
3 1     1   16 use 5.008008;
  1         3  
  1         40  
4 1     1   4 use strict;
  1         2  
  1         27  
5 1     1   4 use warnings;
  1         2  
  1         316  
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,$title);
35              
36 0 0         if ($xmlo) {
37 0   0       $title = $xmlo->{'title'} || undef;
38 0   0       $text = $xmlo->{'text'} || undef;
39 0   0       $url = $xmlo->{'url'} || undef;
40              
41 0 0         $self->{'title'} = $title if defined $title;
42 0 0         $self->{'text'} = $text if defined $text;
43 0 0         $self->{'url'} = $url if defined $url;
44             }
45              
46 0           return(bless($self, $class));
47             }
48              
49 0     0 0   sub title {shift->{'title'};}
50 0     0 0   sub text {shift->{'text'};}
51 0     0 0   sub url {shift->{'url'};}
52              
53              
54             # Preloaded methods go here.
55              
56             1;
57              
58              
59             =pod
60              
61             =head1 NAME
62              
63             WWW::WolframAlpha::Link
64              
65             =head1 VERSION
66              
67             version 1.10
68              
69             =head1 SYNOPSIS
70              
71             foreach my $link (@{$info->link}) {
72             print " link: ", $link->url, "\n";
73             print " title: ", $link->title, "\n" if $link->title;
74             print " text: ", $link->text, "\n" if $link->text;
75             }
76              
77             =head1 DESCRIPTION
78              
79             =head2 ATTRIBUTES
80              
81             $link->title
82              
83             $link->text
84              
85             $link->url
86              
87             =head2 EXPORT
88              
89             None by default.
90              
91             =head1 NAME
92              
93             WWW::WolframAlpha::Link - Perl objects returned via $info->link
94              
95             =head1 SEE ALSO
96              
97             L
98              
99             =head1 AUTHOR
100              
101             Gabriel Weinberg, Eyegg@alum.mit.eduE
102              
103             =head1 COPYRIGHT AND LICENSE
104              
105             Copyright (C) 2009 by Gabriel Weinberg
106              
107             This library is free software; you can redistribute it and/or modify
108             it under the same terms as Perl itself, either Perl version 5.8.8 or,
109             at your option, any later version of Perl 5 you may have available.
110              
111             =head1 AUTHOR
112              
113             Gabriel Weinberg
114              
115             =head1 COPYRIGHT AND LICENSE
116              
117             This software is copyright (c) 2009 by Gabriel Weinberg.
118              
119             This is free software; you can redistribute it and/or modify it under
120             the same terms as the Perl 5 programming language system itself.
121              
122             =cut
123              
124              
125             __END__