Skip Menu |

This queue is for tickets about the Scrappy CPAN distribution.

Report information
The Basics
Id: 69494
Status: open
Priority: 0/
Queue: Scrappy

People
Owner: Nobody in particular
Requestors: shyokou [...] sina.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.94111610
Fixed in: (no value)



Subject: Try::Tiny::try swallows @_ in both Scrappy::Scraper::form and Scrappy::Scraper::post !
In the "CAVEATS" section of "Try::Tiny" POD, the first one states: @_ is not available within the try block, so you need to copy your arglist. In case you want to work with argument values directly via @_ aliasing (i.e. allow $_[1] = "foo"), you need to pass @_ by reference So a quick-and-dirty fix might be: --- lib/Scrappy/Scraper.pm +++ lib/Scrappy/Scraper.pm @@ -274,8 +274,9 @@ # set html response $self->content(''); + my $args = \@_; try { - $self->content($self->worker->submit_form(@_)); + $self->content($self->worker->submit_form(@{$args})); }; if ($self->content) { @@ -629,8 +630,9 @@ # set html response $self->content(''); + my $args = \@_; try { - $self->content($self->worker->post(@_)); + $self->content($self->worker->post(@{$args})); }; if ($self->content) { Such that would prevent Try::Tiny::try from swallowing @_ in both Scrappy::Scraper::form and Scrappy::Scraper::post ;-) Some lines from 'perl -v': This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32- x86-multi-thread Binary build 1204 [294330] provided by ActiveState http://www.ActiveState.com Built Feb 9 2011 14:38:22
Subject: Re: [rt.cpan.org #69494] Try::Tiny::try swallows @_ in both Scrappy::Scraper::form and Scrappy::Scraper::post !
Date: Tue, 26 Jul 2011 15:31:12 -0400
To: bug-Scrappy [...] rt.cpan.org
From: "Al Newkirk & Associates" <we [...] ana.im>
Thanks for the heads up, this has been fixed in my github repo and will be pushed to cpan shortly. https://github.com/alnewkirk/Scrappy-Moose. On Fri, Jul 15, 2011 at 4:08 AM, Shyokou Ouyou via RT < bug-Scrappy@rt.cpan.org> wrote: Show quoted text
> Fri Jul 15 04:08:33 2011: Request 69494 was acted upon. > Transaction: Ticket created by shyokou@sina.com > Queue: Scrappy > Subject: Try::Tiny::try swallows @_ in both Scrappy::Scraper::form and > Scrappy::Scraper::post ! > Broken in: 0.94111610 > Severity: Important > Owner: Nobody > Requestors: shyokou@sina.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=69494 > > > > In the "CAVEATS" section of "Try::Tiny" POD, the first one states: > > @_ is not available within the try block, so you need to copy your > arglist. In case you want to work with argument values directly via @_ > aliasing (i.e. allow $_[1] = "foo"), you need to pass @_ by reference > > So a quick-and-dirty fix might be: > > --- lib/Scrappy/Scraper.pm > +++ lib/Scrappy/Scraper.pm > @@ -274,8 +274,9 @@ > > # set html response > $self->content(''); > + my $args = \@_; > try { > - $self->content($self->worker->submit_form(@_)); > + $self->content($self->worker->submit_form(@{$args})); > }; > if ($self->content) { > > @@ -629,8 +630,9 @@ > > # set html response > $self->content(''); > + my $args = \@_; > try { > - $self->content($self->worker->post(@_)); > + $self->content($self->worker->post(@{$args})); > }; > if ($self->content) { > > Such that would prevent Try::Tiny::try from swallowing @_ in both > Scrappy::Scraper::form and Scrappy::Scraper::post ;-) > > Some lines from 'perl -v': > > This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32- > x86-multi-thread > Binary build 1204 [294330] provided by ActiveState > http://www.ActiveState.com > Built Feb 9 2011 14:38:22 > > >
-- Al Newkirk & Associates Internet Business Consultants http://ana.im we@ana.im 215 469 1262