HTTP/XForwarded.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 CC 2 SCAR 11.0
CC
2
Cov
0%
parse
6.0
empty
2.0
BEGIN
2.0
CRAP 3.0
1 # HTTP x-forwarded-for line; Section 14.1 of RFC 2616
2 #
3 # subclass of HTTP:Part; see that for interface requirements
4 #
5  
6 package IDS::DataSource::HTTP::XForwarded;
7  
8 use strict;
9 use warnings;
10 use Carp qw(carp confess);
11 use base qw(IDS::DataSource::HTTP::Part);
12 use IDS::DataSource::HTTP::URIAuthority;
13  
14 $IDS::DataSource::HTTP::XForwarded::VERSION = "1.0";
15  
16 sub empty {
17 my $self = shift;
18 undef $self->{"data"}, $self->{"tokens"};
19 }
20  
21 sub parse {
22 my $self = shift;
23 my $data = $self->{"data"}; # convenience
24 my ($part, @parts, @tokens);
25  
26 $self->mesg(1, *parse{PACKAGE} . "::parse: data '$data'");
27  
28 # If the data contains spaces or commas, consider it a list.
29 if ($data =~ /[,\s]/) {
30 @parts = split /,?\s+/, $data;
31 } else {
32 @parts = ( $data );
33 }
34  
35 for $part (@parts) {
36 my $pobj = new IDS::DataSource::HTTP::URIAuthority($self->{"params"}, $part);
37 push @tokens, $pobj->tokens;
38 }
39  
40 $self->mesg(2, *parse{PACKAGE} . "::parse: tokens\n ",
41 "\n ", \@tokens);
42 $self->{"tokens"} = \@tokens;
43 }
44  
45 # accessor functions not provided by the superclass
46  
47 =head1 AUTHOR INFORMATION
48  
49 Copyright 2005-2007, Kenneth Ingham. All rights reserved.
50  
51 This library is free software; you can redistribute it and/or modify
52 it under the same terms as Perl itself.
53  
54 Address bug reports and comments to: ids_test at i-pi.com. When sending
55 bug reports, please provide the versions of IDS::Test.pm, IDS::Algorithm.pm,
56 IDS::DataSource.pm, the version of Perl, and the name and version of the
57 operating system you are using. Since Kenneth is a PhD student, the
58 speed of the reponse depends on how the research is proceeding.
59  
60 =head1 BUGS
61  
62 Please report them.
63  
64 =head1 SEE ALSO
65  
66 L<IDS::Algorithm>, L<IDS::DataSource>
67  
68 =cut
69  
70 1;