File: ArrayList.pm

package info (click to toggle)
libformvalidator-simple-perl 0.29-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 412 kB
  • sloc: perl: 3,043; makefile: 4
file content (42 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (7)
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
package FormValidator::Simple::ArrayList;
use strict;
use base qw/Class::Accessor::Fast/;
use FormValidator::Simple::Iterator;

__PACKAGE__->mk_accessors(qw/records/);

sub new {
    my $class = shift;
    my $self  = bless { }, $class;
    $self->records( [ ] );
    $self->_init(@_);
    return $self;
}

sub _init {
    my ($self, @args) = @_;
}

sub append {
    my ($self, $record) = @_;
    push @{ $self->records }, $record;
}

sub get_record_at {
    my ($self, $index) = @_;
    return $self->records->[$index];
}

sub records_count {
    my $self = shift;
    return scalar @{ $self->records };
}

sub iterator {
    my $self = shift;
    return FormValidator::Simple::Iterator->new($self);
}

1;
__END__