File: Source.pm

package info (click to toggle)
libwebservice-cia-perl 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 680 kB
  • ctags: 46
  • sloc: perl: 3,707; makefile: 5
file content (117 lines) | stat: -rw-r--r-- 2,020 bytes parent folder | download | duplicates (5)
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
package WebService::CIA::Source;

require 5.005_62;
use strict;
use warnings;

our $VERSION = '1.4';


# Preloaded methods go here.

sub new {

    my $proto = shift;
    my $source = shift;
    my $class = ref($proto) || $proto;
    my $self = {};

    bless ($self, $class);
    return $self;

}

sub value {

    my $self = shift;
    my ($cc, $f) = @_;
    if ($cc eq 'testcountry' and $f eq 'Test') {
        return 'Wombat';
    } else {
        return;
    }

}

sub all {

    my $self = shift;
    my $cc = shift;
    if ($cc eq 'testcountry') {
        return {'Test' => 'Wombat'};
    } else {
        return {};
    }

}


1;
__END__


=head1 NAME

WebService::CIA::Source - A base class for WebService::CIA sources


=head1 SYNOPSIS

  use WebService::CIA::Source;
  my $source = WebService::CIA::Source->new();


=head1 DESCRIPTION

WebService::CIA::Source is a base class for WebService::CIA sources, such as
WebService::CIA::Source::DBM and WebService::CIA::Source::Web.

It could be used as a source in its own right, but it won't get you very far.


=head1 METHODS


=over 4

=item C<new()>

This method creates a new WebService::CIA::Source object. It takes no arguments.

=item C<value($country_code, $field)>

Retrieve a value. Always returns C<undef>.

=item C<all($country_code)>

Retrieve all fields and values. Always returns an empty hashref.


=back


=head1 AUTHOR

Ian Malpass (ian-cpan@indecorous.com)


=head1 COPYRIGHT

Copyright 2003-2007, Ian Malpass

This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

The CIA World Factbook's copyright information page
(L<https://www.cia.gov/library/publications/the-world-factbook/docs/contributor_copyright.html>)
states:

  The Factbook is in the public domain. Accordingly, it may be copied
  freely without permission of the Central Intelligence Agency (CIA).


=head1 SEE ALSO

WebService::CIA, WebService::CIA::Parser, WebService::CIA::Source::DBM, WebService::CIA::Source::Web

=cut