File Coverage

blib/lib/RDF/Core/Enumerator/Memory.pm
Criterion Covered Total %
statement 6 19 31.5
branch n/a
condition 0 3 0.0
subroutine 2 6 33.3
pod 4 4 100.0
total 12 32 37.5


line stmt bran cond sub pod time code
1             #
2             # The contents of this file are subject to the Mozilla Public
3             # License Version 1.1 (the "License"); you may not use this file
4             # except in compliance with the License. You may obtain a copy of
5             # the License at http://www.mozilla.org/MPL/
6             #
7             # Software distributed under the License is distributed on an "AS
8             # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9             # implied. See the License for the specific language governing
10             # rights and limitations under the License.
11             #
12             # The Original Code is the RDF::Core module
13             #
14             # The Initial Developer of the Original Code is Ginger Alliance Ltd.
15             # Portions created by Ginger Alliance are
16             # Copyright (C) 2001 Ginger Alliance Ltd.
17             # All Rights Reserved.
18             #
19             # Contributor(s):
20             #
21             # Alternatively, the contents of this file may be used under the
22             # terms of the GNU General Public License Version 2 or later (the
23             # "GPL"), in which case the provisions of the GPL are applicable
24             # instead of those above. If you wish to allow use of your
25             # version of this file only under the terms of the GPL and not to
26             # allow others to use your version of this file under the MPL,
27             # indicate your decision by deleting the provisions above and
28             # replace them with the notice and other provisions required by
29             # the GPL. If you do not delete the provisions above, a recipient
30             # may use your version of this file under either the MPL or the
31             # GPL.
32             #
33              
34             package RDF::Core::Enumerator::Memory;
35              
36 1     1   5 use strict;
  1         2  
  1         52  
37             require Exporter;
38              
39             our @ISA = qw(RDF::Core::Enumerator);
40              
41 1     1   4 use Carp;
  1         2  
  1         212  
42              
43             sub new {
44             #$data is an array of statements
45 0     0 1   my ($pkg,$data)=@_;
46 0   0       $pkg = ref $pkg || $pkg;
47 0           my $self={};
48              
49 0           $self->{_data}=$data;
50 0           $self->{_position} = -1;
51 0           bless $self,$pkg;
52             }
53             sub getFirst {
54 0     0 1   my $self = shift;
55 0           $self->{_position} = -1;
56 0           return $self->getNext
57             }
58             sub getNext {
59 0     0 1   my $self = shift;
60 0           $self->{_position} += 1;
61 0           return $self->{_data}->[$self->{_position}];
62             }
63             sub close {
64 0     0 1   $_[0]->{_data} = undef;
65             }
66              
67             1;
68             __END__