| 1 | # HTTP Referer line; Section 14.36 of RFC 2616 | ||
| 2 | # | ||
| 3 | # subclass of HTTP:Part; see that for interface requirements | ||
| 4 | # | ||
| 5 | # This is simply a wrapper for IDS::DataSource::HTTP::URI. However, we may want a | ||
| 6 | # syntax-only check here, but not for URIs in general. | ||
| 7 | # | ||
| 8 | |||
| 9 | package IDS::DataSource::HTTP::Referer; | ||
| 10 | |||
| 11 | use strict; | ||
| 12 | use warnings; | ||
| 13 | use Carp qw(carp confess); | ||
| 14 | use base qw(IDS::DataSource::HTTP::Part); | ||
| 15 | |||
| 16 | $IDS::DataSource::HTTP::Referer::VERSION = "1.0"; | ||
| 17 | |||
| 18 | sub empty { | ||
| 19 | my $self = shift; | ||
| 20 | undef $self->{"data"}, $self->{"tokens"}; | ||
| 21 | } | ||
| 22 | |||
| 23 | sub parse { | ||
| 24 | my $self = shift; | ||
| 25 | my $referer = $self->{"data"}; # convenience | ||
| 26 | my $OK = 1; # optimism | ||
| 27 | my (@tokens, $params, $uri); | ||
| 28 | |||
| 29 | $self->mesg(1, *parse{PACKAGE} . "::parse: data '$referer'"); | ||
| 30 | |||
| 31 | $params = $self->{"params"}; | ||
| 32 | |||
| 33 | ${$params}{"Syntax only"}{"URI"} = ${$params}{"Syntax only"}{"Referer"} | ||
| 34 | if (exists(${$params}{"Syntax only"}{"Referer"})); | ||
| 35 | |||
| 36 | $uri = new IDS::DataSource::HTTP::URI($params, $referer); | ||
| 37 | $self->{"URI"} = $uri; | ||
| 38 | |||
| 39 | $self->{"tokens"} = $uri->tokens(); | ||
| 40 | } | ||
| 41 | |||
| 42 | # accessor functions not provided by the superclass | ||
| 43 | |||
| 44 | =head1 AUTHOR INFORMATION | ||
| 45 | |||
| 46 | Copyright 2005-2007, Kenneth Ingham. All rights reserved. | ||
| 47 | |||
| 48 | This library is free software; you can redistribute it and/or modify | ||
| 49 | it under the same terms as Perl itself. | ||
| 50 | |||
| 51 | Address bug reports and comments to: ids_test at i-pi.com. When sending | ||
| 52 | bug reports, please provide the versions of IDS::Test.pm, IDS::Algorithm.pm, | ||
| 53 | IDS::DataSource.pm, the version of Perl, and the name and version of the | ||
| 54 | operating system you are using. Since Kenneth is a PhD student, the | ||
| 55 | speed of the reponse depends on how the research is proceeding. | ||
| 56 | |||
| 57 | =head1 BUGS | ||
| 58 | |||
| 59 | Please report them. | ||
| 60 | |||
| 61 | =head1 SEE ALSO | ||
| 62 | |||
| 63 | L<IDS::Algorithm>, L<IDS::DataSource> | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | 1; |