Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTTP-Tiny-Mech CPAN distribution.

Report information
The Basics
Id: 80674
Status: resolved
Priority: 0/
Queue: HTTP-Tiny-Mech

People
Owner: KENTNL [...] cpan.org
Requestors: diogomfranco [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.1.0
  • 0.1.1
  • 0.1.2
Fixed in: 0.1.3



Subject: HTTP::Tiny::Mech::get misbehaves when receiving less than 2 args
Download (untitled) / with headers
text/plain 599b
The code sub get { my ( $self, $uri, $opts ) = @_; return $self->_unwrap_response( $self->mechua->get( $uri, $opts ) ); } misbehaves when $opts is undef due to @_ being less than 3. This causes WWW::Mechanize to interpret the arguments to get as a $uri followed by an invalid key-without-value hash, causing a `die` in HTTP::Headers. Replacing the get sub with sub get { my ( $self ) = shift; return $self->_unwrap_response( $self->mechua->get( @_ ) ); } behaves correctly. Fixes breakage on MetaCPAN::API::fetch, which calls get on an HTTP::Tiny::Mech instance with only one argument.
Hi, thanks for the bug report.

Pedro Melo also filed   a bug/pull req that covers the same issue.

https://github.com/kentfredric/HTTP-Tiny-Mech/pull/1


However, it seems your sample code for get { } is wrong. 


Show quoted text
> sub get {
> my ( $self ) = shift;
> return $self->_unwrap_response( $self->mechua->get( @_ ) );
> }
>

HTTP::Tiny expects a hashREF, while it appears WWW::Mechanise expects a list of ( key => value )

could you try 


sub get {
  my ( $self, $uri, $opts ) = @_;
  return $self->_unwrap_response( $self->mechua->get( $uri, ($opts? %$opts : ()) ) );
 }

 

And see how that works out for you? =)



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.