Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,33 @@ authority = cpan:EALLENIII
[PkgVersion]
[PodWeaver]

[CompileTests]
[Test::Compile]
fake_home = 1
[ExtraTests]
[CriticTests]
[Test::Perl::Critic]
critic_config = t/perlcriticrc
[PodCoverageTests]
[PodSyntaxTests]
[Test::Pod::LinkCheck]
[PodSpellingTests]
[Test::PodSpelling]
stopwords = LICENCE
stopwords = PASSed
stopwords = annonations
stopwords = MERCHANTABILITY
[ReportVersions::Tiny]
[Test::ReportPrereqs]

[ExecDir]
dir = bin
[FileFinder::Filter / SkipLWPRecorderCache]
finder = :TestFiles
skip = t/LWPtmp/.*$
[MinimumPerl]
test_finder = SkipLWPRecorderCache
[AutoPrereqs]
skip = ^MyApp
[Bugtracker]
[Homepage]
[MetaConfig]
[MetaData::BuiltWith]
[Repository]
git_remote = origin
[MetaResources]
license = http://dev.perl.org/licenses/
[MetaNoIndex]
Expand Down
18 changes: 9 additions & 9 deletions lib/Test/LWP/Recorder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ use HTTP::Response;
sub new {
my $class = shift;
my %defaults = (
record => 0,
cache_dir => 't/LWPCache',
filter_params => [],
filter_header => [qw(Client-Peer Expires Client-Date Cache-Control)],
'record' => 0,
'cache_dir' => 't/LWPCache',
'filter_params' => [],
'filter_header' => [qw(Client-Peer Expires Client-Date Cache-Control)],
);
my $params = shift || {};
my $self = $class->SUPER::new(@_);
$self->{_test_options} = { %defaults, %{$params} };
$self->{'_test_options'} = { %defaults, %{$params} };
return $self;
}

sub _filter_param {
my ( $self, $key, $value ) = @_;
my %filter = map { $_ => 1 } @{ $self->{_test_options}->{filter_params} };
my %filter = map { $_ => 1 } @{ $self->{'_test_options'}->{'filter_params'} };
return join q{=}, $key, $filter{$key} ? q{} : $value;
}

Expand Down Expand Up @@ -64,13 +64,13 @@ sub _get_cache_key {
. $self->_filter_all_params($params);

#warn "Key is $key";
return File::Spec->catfile( $self->{_test_options}->{cache_dir},
return File::Spec->catfile( $self->{'_test_options'}->{'cache_dir'},
md5_hex($key) );
}

sub _filter_headers {
my ( $self, $response ) = @_;
foreach ( @{ $self->{_test_options}->{filter_header} } ) {
foreach ( @{ $self->{'_test_options'}->{'filter_header'} } ) {
$response->remove_header($_);
}
return;
Expand All @@ -82,7 +82,7 @@ sub request {

my $key = $self->_get_cache_key($request);

if ( $self->{_test_options}->{record} ) {
if ( $self->{'_test_options'}->{'record'} ) {
my $response = $self->SUPER::request(@original_args);

my $cache_response = $response->clone;
Expand Down