Synopsis
use UNIVERSAL::tap;
my $base = URI->new('http://example.com/');
$mech->get_ok($base->tap(sub { $_->query_form(page => 2) }), [ 'X-Requested-With' => 'XMLHttpRequest' ]);
Description
UNIVERSAL::tap is similar to Ruby's Object#tap.

Comments
use Object::tap -package => [qw/URI HTTP::Message HTTP::Headers/];
which would install the tap method into only the specified packages.
{
package MyClass;
use Object::tap;
}
would install tap into only MyClass.
use Object::tap -package => 'UNIVERSAL';
Please sign up to post a review.