Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 29843
Status: resolved
Priority: 0/
Queue: Test-WWW-Mechanize

People
Owner: Nobody in particular
Requestors: greg.sheard [...] wcn.co.uk
Cc:
AdminCc:

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



Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 8063A4D8005 for <bug-Test-WWW-Mechanize [...] rt.cpan.org>; Mon, 8 Oct 2007 12:03:00 -0400 (EDT)
Received: (qmail 4810 invoked by alias); 8 Oct 2007 16:02:59 -0000
Received: from epic0.wcn.co.uk (HELO mailserver.wcn.co.uk) (213.219.59.101) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 08 Oct 2007 09:02:49 -0700
Received: from vaul.wcn.co.uk ([192.168.146.13]) by mailserver.wcn.co.uk with esmtp (Exim 4.63) (envelope-from <greg.sheard [...] wcn.co.uk>) id 1Iev48-0004Cg-7c for bug-Test-WWW-Mechanize [...] rt.cpan.org; Mon, 08 Oct 2007 17:02:44 +0100
Delivered-To: cpan-bug+test-www-mechanize [...] diesel.bestpractical.com
Subject: New method wrapper
MIME-Version: 1.0
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
X-Spam-Status: No, hits=-6.6 required=8.0 tests=BAYES_00,RCVD_IN_DNSWL_MED
Return-Path: <greg.sheard [...] wcn.co.uk>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: bug-Test-WWW-Mechanize [...] rt.cpan.org
Date: Mon, 08 Oct 2007 17:02:39 +0100
Message-Id: <470A549F.1060809 [...] wcn.co.uk>
Content-Type: multipart/mixed; boundary="------------040901030404020606050002"
To: bug-Test-WWW-Mechanize [...] rt.cpan.org
Organization: WCN plc
From: Greg Sheard <greg.sheard [...] wcn.co.uk>
Content-Length: 0
content-type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 195
Download (untitled) / with headers
text/plain 195b
Inspired by get_ok(), this is its counterpart, post_ok(). Patch attached against 1.14. -- Greg Sheard <greg.sheard@wcn.co.uk> Not speaking for WCN plc in any way. #include "long_disclaimer.h"
content-type: text/plain; charset="utf-8"; name="Mechanize.pm.patch"
content-disposition: inline; filename="Mechanize.pm.patch"
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: ascii
Content-Length: 1326
Download Mechanize.pm.patch
text/x-diff 1.2k
--- Mechanize.pm.orig 2007-10-08 16:31:10.000000000 +0100 +++ Mechanize.pm 2007-10-08 16:31:35.000000000 +0100 @@ -124,6 +124,51 @@ return $ok; } +=head2 $mech->post_ok($url, [ \%LWP_options ,] $desc) + +A wrapper around WWW::Mechanize's post(), with similar options, except +the second argument needs to be a hash reference, not a hash. Like +well-behaved C<*_ok()> functions, it returns true if the test passed, +or false if not. + +=cut +sub post_ok { + my $self = shift; + my $url = shift; + + my $desc; + my %opts; + + if ( @_ ) { + my $flex = shift; # The flexible argument + + if ( !defined( $flex ) ) { + $desc = shift; + } + elsif ( ref $flex eq 'HASH' ) { + %opts = %$flex; + $desc = shift; + } + elsif ( ref $flex eq 'ARRAY' ) { + %opts = @$flex; + $desc = shift; + } + else { + $desc = $flex; + } + } # parms left + + $self->post( $url, \%opts ); + my $ok = $self->success; + $Test->ok( $ok, $desc ); + if ( !$ok ) { + $Test->diag( $self->status ); + $Test->diag( $self->response->message ) if $self->response; + } + + return $ok; +} + =head2 $mech->title_is( $str [, $desc ] ) Tells if the title of the page is the given string.
MIME-Version: 1.0
In-Reply-To: <470A549F.1060809 [...] wcn.co.uk>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-9325-1193675682-1440.29843-0-0 [...] rt.cpan.org>
References: <470A549F.1060809 [...] wcn.co.uk>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 179
Download (untitled) / with headers
text/plain 179b
I'm adding this to the next version. Tests would be nice, too. Please don't respond here. This queue is dead, moving over to: http://code.google.com/p/www-mechanize/issues/list


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.