Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Added uri escaped query replacement, fixed load test impossibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Getty committed May 30, 2012
1 parent b42c356 commit efdd86b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -56,7 +56,7 @@ MooX::HasEnv = 0
Parse::CPAN::Packages::Fast = 0.04
Plack = 0.9986
Term::UI = 0.30
URL::Encode = 0.01
URI = 1.60
utf8::all = 0.004
version = 0.96

Expand Down
4 changes: 4 additions & 0 deletions lib/App/DuckPAN/Web.pm
Expand Up @@ -10,6 +10,7 @@ use Data::Printer;
use IO::All -utf8;
use HTTP::Request;
use LWP::UserAgent;
use URI::Escape;

has blocks => ( is => 'ro', required => 1 );
has page_root => ( is => 'ro', required => 1 );
Expand Down Expand Up @@ -118,7 +119,10 @@ sub request {
last if $result;
}
my $page = $self->page_spice;
my $uri_encoded_query = uri_escape($query);
my $uri_encoded_ddh = uri_escape('duckduckhack-template-for-spice');
$page =~ s/duckduckhack-template-for-spice/$query/g;
$page =~ s/$uri_encoded_ddh/$uri_encoded_query/g;
if ($result) {
p($result);
my $call_extf = $result->caller->module_share_dir.'/spice.js';
Expand Down
2 changes: 1 addition & 1 deletion t/00-load.t
Expand Up @@ -5,6 +5,6 @@ use warnings;
use Test::LoadAllModules;

BEGIN {
all_uses_ok( search_path => 'App::DuckPAN' );
all_uses_ok( search_path => 'App::DuckPAN', except => [ 'App::DuckPAN::Web' ] );
}

0 comments on commit efdd86b

Please sign in to comment.