/usr/share/perl5/Flickr/API/Reflection.pm is in libflickr-api-perl 1.28-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | package Flickr::API::Reflection;
use strict;
use warnings;
use Carp;
use parent qw( Flickr::API );
our $VERSION = '1.28';
sub _initialize {
my $self = shift;
$self->_set_status(1,'API::Reflection initialized');
return;
}
sub methods_list {
my $self = shift;
my $rsp = $self->execute_method('flickr.reflection.getMethods');
$rsp->_propagate_status($self->{flickr}->{status});
my $listref = ();
if ($rsp->success() == 1) {
$listref = $rsp->as_hash()->{methods}->{method};
$self->_set_status(1,"flickr.reflection.getMethods returned " . $#{$listref} . " methods.")
}
else {
$self->_set_status(0,"Flickr::API::Reflection Methods list/hash failed with response error");
carp "Flickr::API::Reflection Methods list/hash failed with error code: ",$rsp->error_code()," \n ",
$rsp->error_message(),"\n";
my $listref = ();
}
return $listref;
}
sub methods_hash {
my $self = shift;
my $arrayref = $self->methods_list();
my $hashref;
if ($arrayref) {
%{$hashref} = map {$_ => 1} @{$arrayref};
}
else {
$hashref = {};
}
return $hashref;
}
sub get_method {
my $self = shift;
my $method = shift;
my $rsp = $self->execute_method('flickr.reflection.getMethodInfo',
{'method_name' => $method});
my $hash = $rsp->as_hash();
my $desc = {};
$rsp->_propagate_status($self->{flickr}->{status});
my $err;
my $arg;
if ($rsp->success() == 1) {
$self->_set_status(1,"flickr.reflection.getMethodInfo returned was successful");
$desc->{$method} = $hash->{method};
foreach $err (@{$hash->{errors}->{error}}) {
$desc->{$method}->{error}->{$err->{code}}->{message} = $err->{message};
$desc->{$method}->{error}->{$err->{code}}->{content} = $err->{content};
}
if ( ref($hash->{arguments}->{argument}) eq 'ARRAY') {
foreach $arg (@{$hash->{arguments}->{argument}}) {
$desc->{$method}->{argument}->{$arg->{name}}->{optional} = $arg->{optional};
$desc->{$method}->{argument}->{$arg->{name}}->{content} = $arg->{content};
}
}
else {
$arg = $hash->{arguments}->{argument};
$desc->{$method}->{argument}->{$arg->{name}}->{optional} = $arg->{optional};
$desc->{$method}->{argument}->{$arg->{name}}->{content} = $arg->{content};
}
}
else {
$self->_set_status(0,"Flickr::API::Reflection get_method failed with response error");
carp "Flickr::API::Reflection get method failed with error code: ",$rsp->error_code()," \n ",
$rsp->error_message(),"\n";
}
return $desc;
} # get_method
1;
__END__
=head1 NAME
Flickr::API::Reflection - An interface to the flickr.reflection.* methods.
=head1 SYNOPSIS
use Flickr::API::Reflection;
my $api = Flickr::API::Reflection->new({'consumer_key' => 'your_api_key'});
or
my $api = Flickr::API::Reflection->import_storable_config($config_file);
my @methods = $api->methods_list();
my %methods = $api->methods_hash();
my $method = $api->get_method('flickr.reflection.getMethodInfo');
=head1 DESCRIPTION
This object encapsulates the flickr reflection methods.
C<Flickr::API::Reflection> is a subclass of L<Flickr::API>, so you can access
all of Flickr's reflection goodness while ignoring the nitty-gritty of setting
up the conversation.
=head1 SUBROUTINES/METHODS
=over
=item C<methods_list>
Returns an array of Flickr's API methods.
=item C<methods_hash>
Returns a hash of Flickr's API methods.
=item C<get_method>
Returns a hash reference to a description of the method from Flickr.
=back
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2015, Louis B. Moore
This program is released under the Artistic License 2.0 by The Perl Foundation.
=head1 SEE ALSO
L<Flickr::API>.
L<Flickr|http://www.flickr.com/>,
L<http://www.flickr.com/services/api/>
L<https://github.com/iamcal/perl-Flickr-API>
=cut
|