| 1 | # HTTP Integer (for things like Content-length and ranges) | ||
| 2 | # | ||
| 3 | # subclass of HTTP; see that for interface requirements | ||
| 4 | # | ||
| 5 | |||
| 6 | package IDS::DataSource::HTTP::Int; | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | use Carp qw(carp confess); | ||
| 11 | use base qw(IDS::DataSource::HTTP::Part); | ||
| 12 | |||
| 13 | $IDS::DataSource::HTTP::Int::VERSION = "1.0"; | ||
| 14 | |||
| 15 | sub empty { | ||
| 16 | my $self = shift; | ||
| 17 | undef $self->{"data"}, $self->{"tokens"}; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub parse { | ||
| 21 | my $self = shift; | ||
| 22 | my $int = $self->{"data"}; # convenience | ||
| 23 | my @tokens; | ||
| 24 | |||
| 25 | defined($int) or confess *parse{PACKAGE}, "::parse: missing int."; | ||
| 26 | |||
| 27 | $self->mesg(1, *parse{PACKAGE} . "::parse: data '$int'"); | ||
| 28 | |||
| 29 | push @tokens, $int =~ /^\d+$/ ? "Integer" : "Invalid integer '$int'"; | ||
| 30 | |||
| 31 | $self->mesg(2, *parse{PACKAGE} . "::parse: tokens\n ", | ||
| 32 | "\n ", \@tokens); | ||
| 33 | $self->{"tokens"} = \@tokens; | ||
| 34 | } | ||
| 35 | |||
| 36 | # accessor functions not provided by the superclass | ||
| 37 | |||
| 38 | =head1 AUTHOR INFORMATION | ||
| 39 | |||
| 40 | Copyright 2005-2007, Kenneth Ingham. All rights reserved. | ||
| 41 | |||
| 42 | This library is free software; you can redistribute it and/or modify | ||
| 43 | it under the same terms as Perl itself. | ||
| 44 | |||
| 45 | Address bug reports and comments to: ids_test at i-pi.com. When sending | ||
| 46 | bug reports, please provide the versions of IDS::Test.pm, IDS::Algorithm.pm, | ||
| 47 | IDS::DataSource.pm, the version of Perl, and the name and version of the | ||
| 48 | operating system you are using. Since Kenneth is a PhD student, the | ||
| 49 | speed of the reponse depends on how the research is proceeding. | ||
| 50 | |||
| 51 | =head1 BUGS | ||
| 52 | |||
| 53 | Please report them. | ||
| 54 | |||
| 55 | =head1 SEE ALSO | ||
| 56 | |||
| 57 | L<IDS::Algorithm>, L<IDS::DataSource> | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | 1; |