WWW-Mechanize-1.86 000755 000765 000024 0 13126734347 13254 5 ustar 00olaf staff 000000 000000 tags 100644 000765 000024 26657 13126734347 14256 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86 !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.7 //
AREA_CHECKS t/area_link.t /^AREA_CHECKS: {$/;" l
AREA_CHECKS t/find_link.t /^AREA_CHECKS: {$/;" l
AUTOCHECK_OFF t/autocheck.t /^AUTOCHECK_OFF: {$/;" l
AUTOCHECK_ON t/autocheck.t /^AUTOCHECK_ON: {$/;" l
BACK_TO_FIRST_PAGE t/cookies.t /^BACK_TO_FIRST_PAGE: {$/;" l
BAD_PAGE t/local/failure.t /^BAD_PAGE: {$/;" l
CHECK_DEATH t/die.t /^CHECK_DEATH: {$/;" l
CHECK_LIVING t/die.t /^CHECK_LIVING: {$/;" l
CLICK_BY_NAME t/local/click_button.t /^CLICK_BY_NAME: {$/;" l
CLICK_BY_NUMBER t/local/click_button.t /^CLICK_BY_NUMBER: {$/;" l
CLICK_BY_OBJECT_REFERENCE t/local/click_button.t /^CLICK_BY_OBJECT_REFERENCE: {$/;" l
COOKIE_SHARING t/clone.t /^COOKIE_SHARING: {$/;" l
DESTROY t/local/LocalServer.pm /^sub DESTROY {$/;" s
EAT_THE_WARNING t/select.t /^EAT_THE_WARNING: { # Mech complains about the non-existent field$/;" l
FIND_BY_CLASS t/find_link_id.t /^FIND_BY_CLASS: {$/;" l
FIND_BY_ID t/find_link_id.t /^FIND_BY_ID: {$/;" l
FIND_CLASS_BY_REGEX t/find_link_id.t /^FIND_CLASS_BY_REGEX: {$/;" l
FIND_ID_BY_REGEX t/find_link_id.t /^FIND_ID_BY_REGEX: {$/;" l
FIRST_COOKIE t/cookies.t /^FIRST_COOKIE: {$/;" l
FIRST_FORM t/find_inputs.t /^FIRST_FORM: {$/;" l
FIRST_GET t/local/reload.t /^FIRST_GET: {$/;" l
FORMS lib/WWW/Mechanize.pm /^ FORMS: for my $form (@{ $self->forms }) {$/;" l
FORWARD_TO_NONCOOKIE_PAGE t/cookies.t /^FORWARD_TO_NONCOOKIE_PAGE: {$/;" l
GET_A_THIRD_COOKIE t/cookies.t /^GET_A_THIRD_COOKIE: {$/;" l
GOOD_PAGE t/local/failure.t /^GOOD_PAGE: {$/;" l
INITIAL_CLONE t/clone.t /^INITIAL_CLONE: {$/;" l
INVALIDATE t/local/reload.t /^INVALIDATE: {$/;" l
LANGUAGES t/live/wikipedia.t /^use constant LANGUAGES => qw( en it ja es nl pl );$/;" c
LocalServer t/local/LocalServer.pm /^package LocalServer;$/;" p
MY Makefile.PL /^sub MY::postamble {$/;" s
MyMech t/local/overload.t /^ package MyMech;$/;" p
NEW_API t/link.t /^NEW_API: {$/;" l
NON_REGEX_STRING t/find_link-warnings.t /^NON_REGEX_STRING: {$/;" l
NO_AGENT t/new.t /^NO_AGENT: {$/;" l
NO_BASE t/link-base.t /^NO_BASE: {$/;" l
NO_GET t/local/reload.t /^NO_GET: {$/;" l
NO_STACK t/local/page_stack.t /^NO_STACK: {$/;" l
OLD_API t/link.t /^OLD_API: {$/;" l
PAIRS t/live/encoding.t /^use constant PAIRS => {$/;" c
REGEX_STRING t/find_link-warnings.t /^REGEX_STRING: {$/;" l
REGEX_USAGE t/find_link-warnings.t /^REGEX_USAGE: {$/;" l
RELOAD t/local/reload.t /^RELOAD: {$/;" l
RES_ON_NEW t/new.t /^RES_ON_NEW: {$/;" l
SECOND_COOKIE t/cookies.t /^SECOND_COOKIE: {$/;" l
SECOND_FORM t/find_inputs.t /^SECOND_FORM: {$/;" l
SKIP t/area_link.t /^ SKIP: {$/;" l
SKIP t/area_link.t /^SKIP: {$/;" l
SKIP t/content.t /^SKIP: {$/;" l
SKIP t/live/wikipedia.t /^SKIP: {$/;" l
SKIP t/local/back.t /^SKIP: {$/;" l
SKIP t/local/get.t /^SKIP: {$/;" l
SKIP t/local/referer.t /^SKIP: {$/;" l
SKIP t/local/reload.t /^SKIP: {$/;" l
SKIP t/local/submit.t /^SKIP: {$/;" l
SPACE_PADDED t/find_link-warnings.t /^SPACE_PADDED: {$/;" l
STANDARD_STACK t/local/page_stack.t /^STANDARD_STACK: {$/;" l
THIRD_FORM t/find_inputs.t /^THIRD_FORM: {$/;" l
TestServer t/TestServer.pm /^package TestServer;$/;" p
Tools t/Tools.pm /^package Tools;$/;" p
UNKNOWN_ALIAS t/warnings.t /^UNKNOWN_ALIAS: {$/;" l
URI lib/WWW/Mechanize/Image.pm /^sub URI {$/;" s
URI lib/WWW/Mechanize/Link.pm /^sub URI {$/;" s
USER_AGENT t/new.t /^USER_AGENT: {$/;" l
WWW::Mechanize lib/WWW/Mechanize.pm /^package WWW::Mechanize;$/;" p
WWW::Mechanize::Image lib/WWW/Mechanize/Image.pm /^package WWW::Mechanize::Image;$/;" p
WWW::Mechanize::Link lib/WWW/Mechanize/Link.pm /^package WWW::Mechanize::Link;$/;" p
_SUPER_put lib/WWW/Mechanize.pm /^sub _SUPER_put {$/;" s
_check_unhandled_parms lib/WWW/Mechanize.pm /^sub _check_unhandled_parms {$/;" s
_clean_keys lib/WWW/Mechanize.pm /^sub _clean_keys {$/;" s
_die lib/WWW/Mechanize.pm /^sub _die {$/;" s
_extract_forms lib/WWW/Mechanize.pm /^sub _extract_forms {$/;" s
_extract_images lib/WWW/Mechanize.pm /^sub _extract_images {$/;" s
_extract_links lib/WWW/Mechanize.pm /^sub _extract_links {$/;" s
_image_from_token lib/WWW/Mechanize.pm /^sub _image_from_token {$/;" s
_is_tainted lib/WWW/Mechanize.pm /^sub _is_tainted {$/;" s
_link_from_token lib/WWW/Mechanize.pm /^sub _link_from_token {$/;" s
_make_request lib/WWW/Mechanize.pm /^sub _make_request {$/;" s
_match_any_image_parms lib/WWW/Mechanize.pm /^sub _match_any_image_parms {$/;" s
_match_any_link_parms lib/WWW/Mechanize.pm /^sub _match_any_link_parms {$/;" s
_modify_request lib/WWW/Mechanize.pm /^sub _modify_request {$/;" s
_push_page_stack lib/WWW/Mechanize.pm /^sub _push_page_stack {$/;" s
_reset_page lib/WWW/Mechanize.pm /^sub _reset_page {$/;" s
_taintedness lib/WWW/Mechanize.pm /^sub _taintedness {$/;" s
_update_page lib/WWW/Mechanize.pm /^sub _update_page {$/;" s
_warn lib/WWW/Mechanize.pm /^sub _warn {$/;" s
add_header lib/WWW/Mechanize.pm /^sub add_header {$/;" s
agent_alias lib/WWW/Mechanize.pm /^sub agent_alias {$/;" s
alt lib/WWW/Mechanize/Image.pm /^sub alt { return ($_[0])->{alt}; }$/;" s
attrs lib/WWW/Mechanize/Link.pm /^sub attrs { return ($_[0])->[5]; }$/;" s
back lib/WWW/Mechanize.pm /^sub back {$/;" s
background t/TestServer.pm /^sub background {$/;" s
base lib/WWW/Mechanize.pm /^sub base { my $self = shift; return $self->{base}; }$/;" s
base lib/WWW/Mechanize/Image.pm /^sub base { return ($_[0])->{base}; }$/;" s
base lib/WWW/Mechanize/Link.pm /^sub base { return ($_[0])->[4]; }$/;" s
clear_credentials lib/WWW/Mechanize.pm /^sub clear_credentials {$/;" s
click lib/WWW/Mechanize.pm /^sub click {$/;" s
click_button lib/WWW/Mechanize.pm /^sub click_button {$/;" s
clone lib/WWW/Mechanize.pm /^sub clone {$/;" s
content lib/WWW/Mechanize.pm /^sub content {$/;" s
content_type lib/WWW/Mechanize.pm /^sub content_type { my $self = shift; return $self->{ct}; }$/;" s
cookieval t/cookies.t /^sub cookieval {$/;" s
credentials lib/WWW/Mechanize.pm /^sub credentials {$/;" s
creds_required t/local/LocalServer.pm /^sub creds_required {$/;" s
critic Makefile.PL /^critic:$/;" l
ct lib/WWW/Mechanize.pm /^sub ct { my $self = shift; return $self->{ct}; }$/;" s
current_form lib/WWW/Mechanize.pm /^sub current_form {$/;" s
delete_header lib/WWW/Mechanize.pm /^sub delete_header {$/;" s
die lib/WWW/Mechanize.pm /^sub die {$/;" s
dump_forms bin/mech-dump /^sub dump_forms {$/;" s
dump_forms bin/mech-dump.orig /^sub dump_forms {$/;" s
dump_forms lib/WWW/Mechanize.pm /^sub dump_forms {$/;" s
dump_headers bin/mech-dump /^sub dump_headers {$/;" s
dump_headers bin/mech-dump.orig /^sub dump_headers {$/;" s
dump_headers lib/WWW/Mechanize.pm /^sub dump_headers {$/;" s
dump_images bin/mech-dump /^sub dump_images {$/;" s
dump_images bin/mech-dump.orig /^sub dump_images {$/;" s
dump_images lib/WWW/Mechanize.pm /^sub dump_images {$/;" s
dump_links bin/mech-dump /^sub dump_links {$/;" s
dump_links bin/mech-dump.orig /^sub dump_links {$/;" s
dump_links lib/WWW/Mechanize.pm /^sub dump_links {$/;" s
dump_text bin/mech-dump /^sub dump_text {$/;" s
dump_text lib/WWW/Mechanize.pm /^sub dump_text {$/;" s
field lib/WWW/Mechanize.pm /^sub field {$/;" s
find_all_images lib/WWW/Mechanize.pm /^sub find_all_images {$/;" s
find_all_inputs lib/WWW/Mechanize.pm /^sub find_all_inputs {$/;" s
find_all_links lib/WWW/Mechanize.pm /^sub find_all_links {$/;" s
find_all_submits lib/WWW/Mechanize.pm /^sub find_all_submits {$/;" s
find_image lib/WWW/Mechanize.pm /^sub find_image {$/;" s
find_link lib/WWW/Mechanize.pm /^sub find_link {$/;" s
follow_link lib/WWW/Mechanize.pm /^sub follow_link {$/;" s
form_id lib/WWW/Mechanize.pm /^sub form_id {$/;" s
form_name lib/WWW/Mechanize.pm /^sub form_name {$/;" s
form_number lib/WWW/Mechanize.pm /^sub form_number {$/;" s
form_with_fields lib/WWW/Mechanize.pm /^sub form_with_fields {$/;" s
forms lib/WWW/Mechanize.pm /^sub forms {$/;" s
get lib/WWW/Mechanize.pm /^sub get {$/;" s
get_basic_credentials lib/WWW/Mechanize.pm /^sub get_basic_credentials {$/;" s
get_output t/local/LocalServer.pm /^sub get_output {$/;" s
handle_request t/TestServer.pm /^sub handle_request {$/;" s
height lib/WWW/Mechanize/Image.pm /^sub height { return ($_[0])->{height}; }$/;" s
hostname t/TestServer.pm /^sub hostname {$/;" s
images lib/WWW/Mechanize.pm /^sub images {$/;" s
import t/Tools.pm /^sub import {$/;" s
is_html lib/WWW/Mechanize.pm /^sub is_html { my $self = shift; return defined $self->ct && ($self->ct eq 'text\/html'); }$/;" s
known_agent_aliases lib/WWW/Mechanize.pm /^sub known_agent_aliases {$/;" s
links lib/WWW/Mechanize.pm /^sub links {$/;" s
main Makefile.PL /^package main;$/;" p
name lib/WWW/Mechanize/Image.pm /^sub name { return ($_[0])->{name}; }$/;" s
name lib/WWW/Mechanize/Link.pm /^sub name { return ($_[0])->[2]; }$/;" s
new lib/WWW/Mechanize.pm /^sub new {$/;" s
new lib/WWW/Mechanize/Image.pm /^sub new {$/;" s
new lib/WWW/Mechanize/Link.pm /^sub new {$/;" s
new t/TestServer.pm /^sub new {$/;" s
nosend_cookies t/cookies.t /^sub nosend_cookies {$/;" s
port t/local/LocalServer.pm /^sub port {$/;" s
put lib/WWW/Mechanize.pm /^sub put {$/;" s
quiet lib/WWW/Mechanize.pm /^sub quiet {$/;" s
redirect_ok lib/WWW/Mechanize.pm /^sub redirect_ok {$/;" s
reload lib/WWW/Mechanize.pm /^sub reload {$/;" s
request lib/WWW/Mechanize.pm /^sub request {$/;" s
res lib/WWW/Mechanize.pm /^sub res { my $self = shift; return $self->{res}; }$/;" s
response lib/WWW/Mechanize.pm /^sub response { my $self = shift; return $self->{res}; }$/;" s
root t/TestServer.pm /^sub root {$/;" s
run t/TestServer.pm /^sub run {$/;" s
save_content lib/WWW/Mechanize.pm /^sub save_content {$/;" s
select lib/WWW/Mechanize.pm /^sub select {$/;" s
send_cookies t/cookies.t /^sub send_cookies {$/;" s
set_dispatch t/TestServer.pm /^sub set_dispatch {$/;" s
set_fields lib/WWW/Mechanize.pm /^sub set_fields {$/;" s
set_visible lib/WWW/Mechanize.pm /^sub set_visible {$/;" s
slurp t/save_content.t /^sub slurp {$/;" s
spawn t/local/LocalServer.pm /^sub spawn {$/;" s
stack_depth lib/WWW/Mechanize.pm /^sub stack_depth {$/;" s
status lib/WWW/Mechanize.pm /^sub status { my $self = shift; return $self->{status}; }$/;" s
stop t/TestServer.pm /^sub stop {$/;" s
stop t/local/LocalServer.pm /^sub stop {$/;" s
submit lib/WWW/Mechanize.pm /^sub submit {$/;" s
submit_form lib/WWW/Mechanize.pm /^sub submit_form {$/;" s
success lib/WWW/Mechanize.pm /^sub success {$/;" s
tag lib/WWW/Mechanize/Image.pm /^sub tag { return ($_[0])->{tag}; }$/;" s
tag lib/WWW/Mechanize/Link.pm /^sub tag { return ($_[0])->[3]; }$/;" s
tags Makefile.PL /^tags:$/;" l
text lib/WWW/Mechanize.pm /^sub text {$/;" s
text lib/WWW/Mechanize/Link.pm /^sub text { return ($_[0])->[1]; }$/;" s
tick lib/WWW/Mechanize.pm /^sub tick {$/;" s
title lib/WWW/Mechanize.pm /^sub title {$/;" s
untick lib/WWW/Mechanize.pm /^sub untick {$/;" s
update_html lib/WWW/Mechanize.pm /^sub update_html {$/;" s
update_html t/local/overload.t /^ sub update_html {$/;" s
uri lib/WWW/Mechanize.pm /^sub uri {$/;" s
url lib/WWW/Mechanize/Image.pm /^sub url { return ($_[0])->{url}; }$/;" s
url lib/WWW/Mechanize/Link.pm /^sub url { return ($_[0])->[0]; }$/;" s
url t/local/LocalServer.pm /^sub url {$/;" s
url_abs lib/WWW/Mechanize/Image.pm /^sub url_abs {$/;" s
url_abs lib/WWW/Mechanize/Link.pm /^sub url_abs {$/;" s
value lib/WWW/Mechanize.pm /^sub value {$/;" s
warn lib/WWW/Mechanize.pm /^sub warn {$/;" s
width lib/WWW/Mechanize/Image.pm /^sub width { return ($_[0])->{width}; }$/;" s
INSTALL 100644 000765 000024 2206 13126734347 14366 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86 This is the Perl distribution WWW-Mechanize.
Installing WWW-Mechanize is straightforward.
## Installation with cpanm
If you have cpanm, you only need one line:
% cpanm WWW::Mechanize
If it does not have permission to install modules to the current perl, cpanm
will automatically set up and install to a local::lib in your home directory.
See the local::lib documentation (https://metacpan.org/pod/local::lib) for
details on enabling it in your environment.
## Installing with the CPAN shell
Alternatively, if your CPAN shell is set up, you should just be able to do:
% cpan WWW::Mechanize
## Manual installation
As a last resort, you can manually install it. Download the tarball, untar it,
then build it:
% perl Makefile.PL
% make && make test
Then install it:
% make install
If your perl is system-managed, you can create a local::lib in your home
directory to install modules to. For details, see the local::lib documentation:
https://metacpan.org/pod/local::lib
## Documentation
WWW-Mechanize documentation is available as POD.
You can run perldoc from a shell to read the documentation:
% perldoc WWW::Mechanize
LICENSE 100644 000765 000024 43671 13126734347 14375 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86 This software is copyright (c) 2004-2016 by Andy Lester.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2004-2016 by Andy Lester.
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2004-2016 by Andy Lester.
This is free software, licensed under:
The Artistic License 1.0
The Artistic License
Preamble
The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.
Definitions:
- "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through
textual modification.
- "Standard Version" refers to such a Package if it has not been modified,
or has been modified in accordance with the wishes of the Copyright
Holder.
- "Copyright Holder" is whoever is named in the copyright or copyrights for
the package.
- "You" is you, if you're thinking about copying or distributing this Package.
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the Package
with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.
6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.
7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
Changes 100644 000765 000024 150162 13126734347 14675 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86 Revision history for WWW::Mechanize
1.86 2017-07-04 15:48:46Z
[FIXED]
- use 127.0.0.1 instead of 'localhost' in a test script to avoid the test
hanging due to ipv6 issues (GH#31, see also changes in 1.85)
1.85 2017-06-28 22:06:00Z
========================================
[FIXED]
- use 127.0.0.1 instead of 'localhost' in a test to avoid the test hanging
due to ipv6 issues (GH#31)
- Remove private logic for taint checking (Dave Doyle)
- Fix Pod (simbabque)
- Bump Test::More prereq to get working subtest support (Karen Etheridge)
- Fix intermittent failures of taint.t (GH#108) (Kivanc Yazan)
- Fix kwalitee issues (GH#107) (Kivanc Yazan)
[ENHANCEMENTS]
- Print section titles if mech-dump --all is invoked (GH#81) (Сергей
Романов)
- Add cookbook docs on dumping a req without sending it (#115) (Grigor
Karavardanyan)
- Document that submit only submits current form (GH#114) (nawglan)
- Add Travis testing on Perl 5.26 (Karen Etheridge)
- Remove obsolete and unincremented $VERSIONs in test modules (Karen
Etheridge)
1.84 2017-03-07 13:34:57-05:00 America/Toronto
[ENHANCEMENTS]
- Parse url (href attribute) for js window.open GH#11
[FIXED]
- Set STDOUT to be utf8 in mech-dump. Fixes issue GH#36
- Added --version option to mech-dump
- Don't die on uri() when there has been no request. Fixes issue GH#60
- Remove old information from the cookbook. Fixes issue GH#28
- Documentation correction. Fixes issue GH#65 and GH#59
- Work around Test::More prior to 1.001004. Fixes GH#74
- Fix hostname in test. Fixes GH#73
1.83 2016-10-14 16:45:30-04:00 America/Toronto
========================================
[FIXED]
- Moved live tests to be author tests. Run using dzil test --author. (Steve
Scaffidi)
1.82 2016-10-06 23:00:30-04:00 America/Toronto
========================================
[ENHANCEMENTS]
- Added strict_forms flag to submit_form() which sets the HTML::Form strict flag (Gareth Tunley)
[FIXED]
- Fixed tests which tried to access HTTPS urls when LWP::Protocol::https wasn't
installed (Olaf Alders). Reported by Slaven Rezić. See
https://github.com/libwww-perl/WWW-Mechanize/issues/54
1.81 2016-10-06 08:52:44-04:00 America/Toronto
========================================
[FIXED]
- Work around bug in HTTP::Cookies that is triggered on reload(). See
https://rt.cpan.org/Public/Bug/Display.html?id=75897 (Gianni Ceccarelli)
1.80 2016-09-24 22:38:27-04:00 America/Toronto
========================================
[FIXED]
- Fixes behaviour of submit_form() when multiple filters have been supplied (Ed
Avis)
1.79 2016-09-16 23:53:48-04:00 America/Toronto
========================================
[ENHANCEMENTS]
- Added form_with() method. (Martin Sluka)
1.78 2016-08-08 09:18:59-04:00 America/Toronto
========================================
[OTHER CHANGES]
- No changes specific to this version. First non-develepment release in about a year.
1.77 2016-08-05 12:50:12-04:00 America/Toronto (TRIAL RELEASE)
========================================
[TESTS]
- Skip Wikipedia tests if LWP::Protocol::https is not installed.
1.76 2016-07-29 12:17:25-04:00 America/Toronto (TRIAL RELEASE)
========================================
[ENHANCEMENTS]
- Added history() and history_count() methods. (Ricardo Signes)
- click_button() now accepts ids. (Olaf Alders)
- Add a more descriptive error message when ->request is called without a
parameter. (Max Maischein)
[DOCUMENTATION]
- Document that form_id warns in addition to returning undef when a form cannot
be found. (Olaf Alders)
- Document use of a proxy with bin/mech-dump. (Florian Schlichting)
[OTHER CHANGES]
- New releases for this distribution are now generated by Dist::Zilla
1.75 2015-06-03
========================================
[OTHER CHANGES]
- WWW::Mechanize::Image and WWW::Mechanize::Link now have a defined $VERSION
- fixed warning about the use of the encoding pragma (new in 5.22) (RT#91971)
- fixed warning about the use of CGI::param in list context (RT#103096)
1.74 2015-01-23
========================================
[OTHER CHANGES]
- updated repository link in metadata
1.73 2013-08-24
========================================
[TESTS]
- Update t/local/back.t to use LocalServer for 404 checking to avoid fails
on win32. Fix by Matt S Trout, patient diagnostics and testing provided
by jayefuu of freenode #perl
- Blow away more proxy env vars in LocalServer, and do it on load so that
the LWP env checking doesn't happen before we've done it.
[OTHER CHANGES]
- Better error when passing only one parameter to follow_link
1.72 Thu Feb 2 18:37:28 EST 2012
========================================
[DEPENDENCIES]
Bumped the HTML::Form dependency to fix failures on CentOS 5
1.71 Tue Nov 14 13:50:41 EDT 2011
========================================
[ENHANCEMENTS]
Recognise application/xhtml+xml as HTML.
[DOCUMENTATION]
Improved docs about support of JavaScript
Typo fixes.
[TESTS]
Updated tests as oops-music.com is in utf-8 now
1.70 Fri Aug 26 13:46:30 EDT 2011
========================================
[ENHANCEMENTS]
Mech now defaults to _not_ running live tests by default.
You can still enable them by running "perl Makefile.PL --live"
Thanks to RJBS for the suggestion
1.69_01
========================================
[INTERNALS]
The test suite for the local tests was updated
1.68 Fri Apr 22 01:10:40 EST 2011
========================================
No changes from 1.67_01
1.67_01
========================================
[ANNOUNCE]
As of this release, Jesse Vincent has taken over maintenance of
WWW-Mechanize. The project's repository can be found at:
https://github.com/bestpractical/www-mechanize
[FIXED]
Added prereq for HTML::TreeBuilder.
1.66 Fri Sep 10 16:25:44 CDT 2010
========================================
[FIXED]
Fixed prerequisites on HTTP::Server::Simple on Windows.
DNS checks in t/autocheck.t and t/local/failure.t improved. Thanks,
Schwern.
[ENHANCEMENTS]
New $mech->text method returns the text from your HTML page. The
exact rendering of this text is simply removing all the HTML
tags, but this will change. It's pretty ugly. If anyone wants to
work on a better-looking text dump, I'd love to see it.
Added mech-dump --text.
[DOCUMENTATION]
Improvements to the docs explaining explicitly about the subclassed
methods we inherit from LWP::UserAgent. Thanks, Lyle Hopkins!
1.64 Thu Jul 1 10:41:00 CDT 2010
========================================
[THINGS THAT MAY BREAK YOUR CODE]
If you've been accessing $mech->{forms} or $mech->{form} values
directly, instead of going through the $mech->forms or $mech->current_form
accessors, respectively, then this version of Mech will break your
code.
[ENHANCEMENTS]
Parsing of forms has been delayed until they're actually needed.
If don't use forms on a page, you'll no longer waste time and memory
parsing them.
$mech->title now caches the title of the page after parsing the
page to find it.
mech-dump now takes a --cookie-file parameter for keeping cookies
between calls. Thanks, Damien Clark.
[DOCUMENTATION]
Typo fixes.
1.62 Sat Apr 10 23:10:07 CDT 2010
========================================
[FIXED]
Fixed a declaration in the Movable Type example in
WWW::Mechanize::Examples.
Quiet warnings if %ENV has undef values.
$mech->follow_link() no longer dies with an inappropriate error if
the link is not found.
$mech->click_button() now checks to see if a form is selected.
[INCOMPATIBILITIES]
$mech->form_name() and $mech->form_number() no longer throw warnings
if they can't find the form specified. They still return undef,
though.
[DOCUMENTATION]
More additions to the FAQ.
1.60 Mon Aug 17 00:41:39 CDT 2009
========================================
No new features. Exists only to skip tests that always fail on
Windows.
Fixed up some minor documentation problems.
1.58 Mon Jul 13 22:32:23 CDT 2009
========================================
No new features. If you have 1.56 installed OK, you do NOT need
to install 1.58.
[FIXES]
Removed prereq of HTTP::Response::Encoding, even though it was never
used. Thanks for the catch, Gisle.
1.56 Thu Jul 9 00:36:54 CDT 2009
========================================
[THINGS THAT MAY BREAK YOUR CODE]
For a while, Mech used HTTP::Response::Encoding to try to suss out
the proper encoding of the page it receives. Now, it lets
LWP::UserAgent do the work, and no longer requires
HTTP::Response::Encoding.
[ENHANCEMENTS]
Added a new dump_headers() method to dump the HTTP response headers.
Added --headers flag to mech-dump to dump the HTTP response headers.
[FIXES]
Now requires LWP version 5.829 because HTTP::Response has memory
cycle bugs.
[DOCUMENTATION]
Added a few notes to the FAQ, and fixed some incorrect docs.
1.55_01 Mon Jul 6 12:17:10 CDT 2009
========================================
This is mostly a bug fix release. There will be a number of other
bug fix releases in the next few days.
[FIXED]
New test server now randomizes the port it runs on.
t/cookies.t should not hang on Windows any more.
META.yml has been updated so the search.cpan.org links should be
correct.
Passing no_proxy would make LWP::UserAgent barf. Thanks to Mike
Schilli for the fix.
Cookies test would fail under Windows. Fixed, thanks to many people
reporting it.
[ENHANCEMENTS]
$mech->submit_form() now can specify the form by ID using the form_id
parameter.
[DOCUMENTATION]
The docs used to say that ->stack_depth(0) was an infinite stack
size. This is wrong. Zero will tell Mech not to keep any history.
1.54 Mon Jan 12 00:36:08 CST 2009
========================================
[FIXED]
Removed the computers4sure test that was failing.
1.52 Tue Nov 25 09:52:30 CST 2008
========================================
[FIXED]
Improved some error messages in $mech->submit_form(). Thanks to
Norbert Buchmuller.
1.51_03 Thu Nov 20 11:05:49 CST 2008
========================================
[FIXED]
The $mech->clone() method was not passing the cookie jar to its
clone properly. Thanks to David Sainty.
The $mech->back() can fail if there's nothing on the stack to go
back to. Thanks to Dave Page.
$mech->follow_link() did not complain if a link could not be found,
even with autocheck on. Now it does. Thanks, Flavio Poletti.
[ENHANCEMENTS]
Added a $mech->form_id() method so you can look up forms by ID.
Added $mech->content_type(), because $mech->ct() is too cryptic.
1.51_02 Tue Nov 18 01:30:54 CST 2008
========================================
[STILL BROKEN]
t/local/click_button.t is still failing its tests for calling ->click
on an HTML::Form object. I suspect this is an LWP change, but I
haven't dug into it enough yet.
[FIXES]
Fixed the bad credentials API that stomped on LWP::UserAgent's
credentials() method. Thanks to Max Maschien and Matt Lawrence.
The $mech->links method now finds links. Thanks
to H.Merijn Brand.
Makefile.PL explicitly requires Perl 5.8.0.
URI.pm has to be version 1.36 or else URIs don't get encoded
correctly.
LWP has to be 5.819 or we have encoding problems.
1.51_01 Thu Nov 6 15:13:03 CST 2008
========================================
[FIXES]
Page history is now working much better. The $mech->back() method
should behave more like a browser now. Most notably, it no longer
restores the cookie state, just like your browser doesn't restore
cookie state when you page back. It also should use much less
memory.
1.50 Sun Sun Oct 26 22:42:46 CDT 2008
========================================
[THINGS THAT MAY BREAK YOUR CODE]
WWW::Mechanize now requires version 5.815 of LWP. This in itself
may cause problems for you because of changes in how LWP does
authentication.
1.49_01 Sat Sep 27 23:50:04 CDT 2008
========================================
[THINGS THAT MAY BREAK YOUR CODE]
The autocheck argument to the constructor is now ON by default,
unless WWW::Mechanize is being subclassed. There are so many new
programmers whose ->get() calls fail unchecked that I'm now putting
on the seat belts for them.
[FIXES]
I do believe we are on the way to having all the encoding problems
ironed out. This version incorporates a patch from here:
http://code.google.com/p/www-mechanize/issues/detail?id=61
and tests from Miyagawa's WWW::Mechanize::DecodedContent
http://search.cpan.org/dist/WWW-Mechanize-DecodedContent/
to finally fix this.
[ENHANCEMENTS]
You can now specify not to set up the proxy, if there is one. The
proxy causes problems for Crypt::SSLeay. For details see:
http://code.google.com/p/www-mechanize/issues/detail?id=39
[DOCUMENTATION]
Fixed internal links.
[INTERNALS]
Lots of refactoring based on Schwern's "Skimmable Code" talk.
http://use.perl.org/~schwern/journal/36704
http://schwern.org/~schwern/talks/Skimmable%20Code%20-%20YAPC-NA-2008.pdf
1.34 Mon Dec 10 00:30:39 CST 2007
========================================
[FIXES]
Many fixes to make the test suite more portable.
1.32 Tue Oct 30 12:02:17 CDT 2007
========================================
[ENHANCEMENTS]
Added dump methods to mirror mech-dump:
* $mech->dump_images()
* $mech->dump_links()
* $mech->dump_forms()
* $mech->dump_all()
Sanity checks in the WWW::Mechanize::Image constructor. Every Image
must have a "url" and "tag" field passed in to it.
1.31_02 Thu Oct 25 11:48:29 CDT 2007
========================================
[ENHANCEMENTS]
Added class, class_regex, id and id_regex limiters to find_link()
and find_all_links(). Thanks to Adriano Ferreira.
1.31_01 Mon Sep 17 23:38:03 CDT 2007
========================================
[FIXES]
Mech tests now pass even if your DNS server gives A records for
anything (like OpenDNS). Thanks, Miyagawa!
Searching for the is now case-inensitive. A better
solution would be to actually parse the HTML.
[ENHANCEMENTS]
mech-dump now handles --user and --password arguments for sites
that require authentication.
1.30 Thu May 24 21:31:10 CDT 2007
========================================
[DOCUMENTATION]
Minor doc fixes. Thanks David Steinbrunner.
1.29_01 Tue May 22 14:02:55 CDT 2007
========================================
Kevin Falcone and I ask for your assistance in figuring out how to
handle the warnings thrown by the tests, other than hiding them.
[FIXES]
Overhauled how tainting was done. Stole code directly from
Test::Taint.
Have LWP only handle decoding of Content-Encoding, not charset.
[DOCUMENTATION]
Fixed the docs for $mech->submit_form()'s with_fields arg.
Thanks, Peteris Krumins.
1.26 Wed May 16 14:21:29 CDT 2007
========================================
[FIXES]
Re-reversed the content decoding. This is critical for reading from
sites with gzip on the fly, like Wikipedia.
Content is now properly tainted.
[ENHANCEMENTS]
mech-dump can now pass --agent and --agent-alias flags so you can
fetch from sites like Wikipedia that block LWP user agents.
[INSTALLATION]
The mech-dump program is now always installed. It no longer is
presented as an option.
1.24 Fri May 11 15:57:56 CDT 2007
========================================
NOTE: Version 1.24 will NOT automatically decode gzipped content for
you any more. Consider it a "do not use" release.
[FIXES]
* Fixed failures in "make test" with some versions of HTTP::Server::Simple
* RT #26593: Improved handling of charsets. Thanks Kevin Falcone.
* RT #24354: find_link now handles http-equivs with quoted URLs.
* Reverses the change in 1.21_01 where it decodes the content.
[ENHANCEMENTS]
* Added find_all_inputs() and find_all_submits() methods. Thanks,
Mike O'Regan.
* Test::LongString is no longer needed, so has been removed as a
requirement.
[TESTS]
* Added a test for save_content()
1.22 Fri Mar 2 00:05:57 CST 2007
========================================
[INTERNALS]
Added new tests.
Added Perl::Critic changes and a perlcriticrc file.
1.21_04 Sat Oct 7 21:35:42 CDT 2006
========================================
[FIXES]
* $mech->content( type => 'text' ) was not freeing memory. Thanks to
Cat Okita for finding it.
[INTERNALS]
* Made the order of parms to $mech->content() not relevant.
1.21_03 Sat Oct 7 01:21:46 CDT 2006
========================================
[THINGS THAT MAY BREAK YOUR CODE]
* The methods $mech->form() and $mech->follow() have been removed.
They've been deprecated since 1.10, which was released in Feb 2005.
[ENHANCEMENTS]
* I'm trying to nail down what seems to be a memory leak on long-running
Mech programs. I'm stringifying URI::URL objects wherever I can.
[INTERNALS]
* No longer uses UNIVERSAL.
1.21_02 Wed Oct 4 13:14:30 CDT 2006
========================================
[ENHANCEMENTS THAT MAY BREAK YOUR CODE]
* The $mech->stack_depth() setting had no way to say "don't cache any
pages at all". How silly!
Now, if you set $mech->stack_depth(0), no history of pages will be kept.
In the past, it would mean "Keep all pages." This means that if you want
to set it to keep all pages, set it to some ridiculously large number.
[DOCUMENTATION]
* The docs previously refered to Compress::Gzip instead of Compress::Zlib.
1.21_01 Mon Sep 18 17:18:43 CDT 2006
========================================
[ENHANCEMENTS]
* If Compress::Zlib is installed, gzipped content is now
accepted and transparently decoded. No additional syntax needed!
This should save time and bandwidth in a number of cases.
(Mark Stosberg)
* Added a put() method. It also calls a subfunction called
_SUPER_put that will be removed once LWP::UserAgent supports put().
1.20 Sat Aug 19 09:09:08 EDT 2006
[ENHANCEMENTS]
* Added new two-argument form of credentials() method.
$mech->credentials($username, $password);
That provides simpler visiting of password-protected
resources in the vast majority of cases and still
allows the other cases to be supported. (Peter Scott)
[BUG FIXES]
* autocheck no longer is triggered when informational
responses are returned. (Mark Stosberg)
[INTERNALS]
* test suite no longer fails when Test::Warn is missing.
(CPAN testers, Mark Stosberg)
* Removed all the testing against live sites. The networking
code is not actually in Mech anway, and they were prone to
breaking, as the live sites changed. (Mark Stosberg)
1.19_02 Mon Aug 7 23:57:56 CDT 2006
[ENHANCEMENTS]
* Add new Do-What-I-Mean submit_form() option.
$mech->submit_form(
with_fields => \%data
);
That expresses that you want to select the first form contains all
fields in \%data, and then submit the data to that form. See the docs
for form_with_fields() and submit_form() for details.
(Mark Stosberg, inspired by RT#6100)
[BUG FIXES]
* The behavior of clone() now copies over the cookie jar, which
is probably what you expected it did in the first place.
This fixes bug RT#13541 filed against Test::WWW::Mechanize,
which was using clone() internally. (Mark Stosberg)
* The correct URL is returned after redirecting. This a regression
from 1.04 and was reported as RT#9059, RT#12882, and RT#12786.
The documentation about this has also been clarified that we
return a URI object, but that it stringifies to the URI itself.
[DOCUMENTATION]
* Fixed a misleading parm in the constructor.
* Document the return value of set_visible (RT#6071, MJD,
Mark Stosberg)
* Document that form_name and form_number return an HTML::Form
object (Mark Stosberg)
[INTERNALS]
* Made lots of little cleanups based on Perl::Critic
* Fix Taint-mode warnings with Perl 5.6.1 (RT#16945)
1.18 Thu Feb 2 00:11:26 CST 2006
[TESTS]
* Makefile.PL now takes four new parms:
* --live/nolive turns on/off the live tests
* --local/nolocal turns on/off the local tests
* --mech-dump/nomech-dump installs/doesn't the mech-dump program
* --all turns on all tests and installs mech-dump
* Fixed some failures in tests. Non-existent URLs now have a
"." postpended to them, so if someone's got a search domain
with a wildcard (i.e. ignore.us) it'll ignore that. Also,
Google's second link is now a https:// link, which some Mechs
can't handle. Added a 'url_regex' which now makes it look at
the second non-https link. Thanks to Pete Krawczyk.
1.16 Fri Oct 28 17:34:20 CDT 2005
[ENHANCEMENTS]
* Sped up Mech significantly (~20% in some cases). Images and
links are extracted from the HTML, and objects are created,
only when they're actually needed. This will be a speedup for
pages where you're only following links, or vice versa.
[THINGS THAT MAY BREAK YOUR CODE]
* If you've been relying on the $mech->{images} and $mech->{links}
fields being populated so that you can bypass the $mech->images()
and $mech->links() accessors, your code will break. That's OK,
because you should have been using the accessors all along.
1.14 Tue Aug 30 17:17:40 CDT 2005
[DOCUMENTATION]
* Added lots of new FAQs. Thanks to Peter Stevens.
[INTERNALS]
* Now requires Test::LongString. That's not too odious.
[FIXES]
* Tests now pass with the shuffling around that Google did.
1.13_01 Tue Apr 12 14:11:18 CDT 2005
[ENHANCEMENTS]
* Now dies if you call submit_form() with a non-existing
form_number or form_name. Before, it would just warn.
[DOCUMENTATION]
* Added an example of using credentials() in the cookbook.
1.12 Thu Feb 24 23:38:44 CST 2005
[FIXES]
* Fixed RT #9026: hang in t/local/back.t under Windows XP.
Thanks Andrew Savige. It also should no longer complain
about being unable to clean up a temp file.
1.11_01 Mon Feb 14 00:12:48 CST 2005
[THINGS THAT MAY BREAK YOUR CODE]
* Removed deprecated _parse_html() method.
[FIXES]
* Was incorrectly looking for INPUT tags TYPE="SUBMIT" as images.
Thanks to Abe Timmerman.
[ENHANCEMENTS]
* Calling $mech->set_fields() with no current form now dies.
Thanks to Julien Beasley.
1.10 Tue Jan 31 11:30pm-ish
[FIXES]
* Fixed bug where images inside of links would not be found.
* Fixed test failures because of Google changes. Thanks to
Offer Kaye and others who sent in patches.
[DOCUMENTATION]
* More samples in the FAQ. Thanks to Joshua Gatcomb.
[INTERNALS]
* Added explanation of running live tests against Google in
Makefile.PL.
1.08 Fri Dec 24 01:01:06 CST 2004
[ENHANCEMENTS]
* Added find_image() and find_all_images().
1.06 Wed Dec 8 14:58:39 CST 2004
[INTERNALS]
* Now uses the base pragma instead of setting @ISA.
1.05_04 Fri Nov 5 23:35:38 CST 2004
[ENHANCEMENTS]
* Added WWW::Mechanize::Image object for representing images.
* Improved the regex on the URL for META tags.
* Added --images flag to mech-dump.
[FIXES]
* When parsing urls out of meta refresh tags, "url" may now be
uppercase (RT#8230)
* Behavior of back() fixed in a number of cases (RT#8109 reported
by Josh Purinton, patched by Dominique Quatravaux)
[INTERNALS]
* Mark figured out to how to prevent his text editor from
putting tabs into the code. Andy's blood pressure dropped
slightly.
1.05_03 Sun Oct 31 20:54:33 CST 2004
[ENHANCEMENTS]
* click_button() has a new input option for HTML::Form::SubmitInput
objects (DOMQ)
* content() has new options to return the page formatted
as text, with a added. (RT#8087, patch by
Dominique Quatravaux)
* update_html() method has been added, which can be used
to modify the HTML that Mech parses. It should be sub-classed
instead of _parse_html(), which has been deprecated.
(RT#8087, patch by Dominique Quatravaux)
* select() has new option to select an option by number
(RT#5789, Scott Lanning)
* WWW::Mechanize::Link now has support providing all the
attributes of the link through a new attrs() method, which
returns them as a hashref. This is a replacement for the
alt() method, added in 1.05_01. It's not backwards
compatible with that, but, hey, that's what developer
releases are for. (RT#8092, Rob Casey and Mark Stosberg)
[FIXES]
* Upload does not use the default
value to prevent attacks, patch by Jan Pazdziora (RT #7843).
[INTERNALS]
* Improved tests and documentation for select() (RT#5789,
Scott Lanning)
* Improve taint-safeness on Perl 5.6.1 (RT#8042, patch by
Dominique Quatravaux)
* Added tests for click_button() (RT#8061, by Dominique
Quatravaux)
* Require URI 1.25, fixing bug which exposed itself in
WWW::Mechanize (RT#3048)
* Move select() to better location in docs. Document and
test the return values. The return value is now "1" on
success instead of the undocumented behavior of returning
a form value. (RT#6138, spotted by MJD, patched by Mark
Stosberg)
* Possible matching tags for the find_link() 'tag_regex'
attribute are now documented. (RT#2989, by Mark Stosberg)
* refactored find_link() to avoid use of eval(). This should
improve performance a bit and avoid potential security
issues. (Mark Stosberg)
1.05_02 Sat Oct 2 16:55:59 CDT 2004
[ENHANCEMENTS]
* Added the $mech->save_content( $filename ) function, so you
can dump stuff to files easily.
1.05_01 Thu Sep 30 21:04:44 CDT 2004
[FIXES]
* set_visible() doesn't stop setting values when it finds a zero.
[ENHANCEMENTS]
* WWW::Mechanize::Link has a new, easier to remember constructor
interface. The old one is still supported. Support for including
an 'alt' attribute was added, which is useful for links.
(RT #3317). Thanks to Mark Stosberg.
* When links are extracted from tags, the ALT attribute will
be captured and become part of the WWW::Mechanize::Link object.
(RT #3317). Patch by Mark Stosberg.
[INTERNALS]
* t/mech-dump.t is now more portable (RT #7690)
* t/local/follow.t has new tests to confirm that 'follow*' functions
work with characters like o-umlaut, even when the o-umlaut is
encoded in the HTML, but not in the call to follow(). (RT #2416)
By Mark Stosberg.
1.04 Wed Sep 15 23:27:53 CDT 2004
[ENHANCEMENTS]
* $mech->get() now accepts a WWW::Mechanize::Link object.
* $mech->stack_depth(n) lets you set the depth of the mech
object's page stack. This way, if you have a Mech that does
lots of stuff and never/rarely goes back(), you won't be eating
up memory. Thanks to BooK and Chi-Fung. (RT #5362)
[FIXES]
* Fixed tests that fail under LWP >= 5.800.
* Added a workaround for LWP::UserAgent->clone() when ->{proxy}
is undef. (RT #6443)
* The Referer was getting passed as a URI object sometimes,
and that caused sadness. Eugene Haimov supplied a workaround.
(RT #6372)
[DOCUMENTATION]
* Added Ian Langworth's listmod and John Beppu's photobucket
uploader programs to WWW::Mechanize::Examples.
* Minor doc tweak for find_link()
* Finally added a value() func. Thanks to Spoon,
who even now, months after his passing, is still contributing
to Mechanize.
1.02 Tue Apr 13 22:45:10 CDT 2004
No reason to install if you have 1.00. Fixes are only in tests.
[FIXES]
* t/referer.t didn't cope with spaces in $FindBin::Bin. Plus,
it now forces its URL to localhost.
1.00 Sat Apr 10 00:35:51 CDT 2004
I figure it's about time we hit 1.00, and this version seems
like a good place to do it, because of the potential breakage
described below...
[THINGS THAT WILL BREAK YOUR CODE]
* Header handling has changed. There is no more package variable
%headers that holds all the headers to be added. They are
now added on a per-object basis.
If you were adding a header with add_header(), and the code
relied on that header still being set later on in a later
instance of the class, that code will now break, because the
later instance won't have the header set.
[ENHANCEMENTS]
* You can now prevent a header from being sent by adding it with
an undef value, as in:
$mech->add_header( Referer => undef );
[FIXES]
* Now correctly adds Accept-Encoding to all requests that need it.
[INTERNALS]
* Added new $mech->_modify_request($req) method to do all the
HTTP header modification before the actual request gets
sent off. Subclasses are able to override it if they want.
* Removed the unused Compress::Zlib stuff.
0.76 Wed Apr 7 22:01:43 CDT 2004
[ENHANCEMENTS]
* Added update_html() to let you update the HTML for the page
you're on.
[FIXES]
* Test files account for new Google layout.
[INTERNALS]
* Rearranged the local tests into their own t/local/ directory.
* Made the standalone tests show what server they're hitting.
* Checked that it runs under LWP 5.78.
0.74 Mon Mar 22 23:36:46 CST 2004
[ENHANCEMENTS]
* WWW::Mechanize now sends an Accept-Encoding header of "identity"
to always enforce plaintext responses. Preliminary support for
Compress::Zlib is also there, but is disabled by default.
* Added click_button() and select() methods. The field() method
can now take an arrayref of values, if appropriate. Thanks,
Linda Lee Julien.
* Added url_abs and url_abs_regex parms to find_all_links().
* URLs in META REFRESH tags are now treated as links.
* t/taint.t makes sure that things that should be tainted are.
[FIXES]
* Still more fixes if the machine you're on doesn't have
DNS pointing to it.
* The local changes use localhost as the local host name, instead
of whatever host name that might be on the box, but not in DNS.
Thanks to David Wheeler for letting me play on his box.
* The http_proxy and HTTP_PROXY environment variables get
deleted during the tests that access the dummy local server.
This should let your tests pass, and clear up a lot of RT
tickets.
0.72 Mon Jan 26 21:07:20 CST 2004
[ENHANCEMENTS]
* Added the set_visible() method, thanks to Peter Scott.
[DOCUMENTATION]
* Started the Cookbook at WWW::Mechanize::Cookbook.pod.
[INTERNALS]
* Made the globbing in Makefile.PL a little less command-line
intensive. Also fixed the missing files in MANIFEST.
* Added t/pod-coverage.t for testing POD coverage.
0.71_02 Mon Dec 22 14:29:13 CST 2003
[THINGS THAT MAY BREAK YOUR CODE]
* Added a 5th, optional parameter to WWW::Mechanize::Link's
constructor. In 0.71_01, it was at the beginning of the
argument list and was required. Now it's at the end and is
optional. If, in the 15 hours since 0.71_01 came out, you
went and changed all your WWW::Mechanize::Link constructors,
you'll have to change them around again. Otherwise, you can
just ignore this change.
0.71_01 Sun Dec 21 23:48:12 CST 2003
[THINGS THAT MAY BREAK YOUR CODE]
* WWW::Mechanize::Link's constructor has a new argument
that needs to be passed in, at the start of the argument
list.
[ENHANCEMENTS]
* WWW::Mechanize::Link object now takes a $base URL, and will
return absolute URLs with the url_abs() method. Thanks to
Ashley Pond.
* Added another script to WWW::Mechanize::Examples. It's a
script that didn't make it into Spidering Hacks.
[INSTALL & TESTS]
* Heavy use of the new Test::Memory::Cycle module.
* Fixed Makefile.PL so that the tests are selected under Win32.
* Changed t/mech-dump.t so that the test succeeds under Win32.
* Updated t/referer.t and t/mech-dump.t so they run under VMS.
Thanks to Peter Prymmer.
0.70 Sun Nov 30 23:45:27 CST 2003
[THINGS THAT MAY BREAK YOUR CODE]
* Redirects are now handled better by LWP, so the code that
changes POSTs to GETs on redirects has been removed.
[FIXES]
* Fixed redirect_ok(), which had its API changed out from under
it in LWP 5.76.
[ENHANCEMENTS]
* New warnings in find_link() for strings that are space padded,
and for text matches that are passed a regex. Thanks to
Jim Cromie.
[DOCUMENTATION]
* Patches from Mark Stosberg and Jim Cromie.
[INTERNALS]
* Removed all the checking for Carp. I don't know why I
was thinking that Carp wasn't core. RT #4523.
Also, a big bump in requirements on LWP: We need 5.76.
0.66 Thu Nov 13 14:35:31 CST 2003
No new functionality. Fixed up some install bugs and made a
few documentation tweaks, mostly to plug Spidering Hacks.
0.65 Mon Nov 10 00:11:06 CST 2003
[ENHANCEMENTS]
* Made a _parse_html() method that you can override or call
manually, per request from Gavin Estey.
[FIXES]
* Made some path naming use File::Spec->catfile so that
they work correctly under Windows.
* "make clean" cleans up temp flag files.
[INTERNALS]
* Uses the new Test::Pod 1.00 for simplicity.
0.64 October 23, 2003 11:15pm
[ENHANCEMENTS]
* Many new tests, based on the excellent coverage reporting
created by Paul Johnson's Devel::Cover module.
* The start of JavaScript support, sort of!
If you have an tag that does an onClick that opens a
window, Mech will find the URL from that and make that
be the link for the tag. This is for things like Movable
Type that pop little windows to rebuild indexes.
This is subject to change in the future. I don't know
if it will, but I'm not making promises. It might be so
buggy I just yank the whole thing.
* Big jump in requirements, since we'll soon be using Gisle's
new HTML::Form stuff. Also, older versions of HTML::Form
don't give output I'm expecting.
[FIXES]
* Fixed the t/mech-dump.t failure.
0.63 October 13, 2003 2:56pm
[ENHANCEMENTS]
* mech-dump defaults to dumping forms.
* Added name, name_regex, tag and tag_regex options to find_link()
and follow_link().
* Added tests from Jim Brandt.
0.62 October 7, 2003 8:46pm
[THINGS THAT MIGHT BREAK YOUR CODE]
* The parms for find_link()'s url_regex and text_regex must now
be actual regex objects, as in qr// objects. They can't just
be little text strings. If this is a big bummer, let me know.
[ENHANCEMENTS]
* Added autocheck parm, to tell your Mech object to die on
any error. This saves you from having to check yourself.
This closes RT #3056.
* Renamed the internal _carp() method as warn().
* Added a die() method.
* Can now override the warn() and die() handlers in the
constructor.
* find_link() now complains if it gets a *_regex parm that isn't
actually a regex. See RT #3032.
[FIXES]
* mech-dump.t no longer runs if you're not installing mech-dump.
See RT #3724.
[DOCUMENTATION]
* More FAQs. Thanks to Gavin Estey.
0.61 October 6, 2003 6:30pm
No new functionality here. It's mostly to get the new tests
into the pipeline so the CPAN testers can run 'em.
[FIXES]
* Missing dependency on File::Temp. Thanks, Ask.
[ENHANCEMENTS]
* Added the test case for the form processing problem as a .t
file, since I spent so long getting it down to a simple case.
* Internal code uses accessors instead of direct hash entries.
Prepare for deprecation of existing hash entries!
[DOCUMENTATION]
* The FAQ is now its own document at WWW::Mechanize::FAQ.
0.60 September 22, 2003 10:00pm
[FIXES]
* Changed how t/failure.t tries to fail. It used to hit
a bogus hostname in .com, but with Verisign doing its
SiteFinder crap, even bogus addresses in .com succeed.
[ENHANCEMENTS]
* Added _make_request() to let WWW::Mechanize::Cached easily
hook into the request chain.
0.59 September 3, 2003 11:56pm
[FIXES]
* Squelched a warning in follow() where it tries to do a regex
match against an undef value.
* The page stack functionality, including the back() button,
was entirely broken. Now it works. Thanks to the mighty
Iain Truskett for help.
[ENHANCEMENTS]
* Added the mech-dump script, which replaces mech-forms.
It will dump forms and lists of links. Eventually it will
do lists of images, too, but not yet.
0.58 August 14, 2003 11:30pm
[THINGS THAT MIGHT BREAK YOUR CODE]
* $mech->uri() now returns a plain string, not a URI object.
The automatic stringification of the URI object was
causing problems on Win32 and/or threaded Perls, and I
didn't feel like figuring out why. If the non-objectness
of the uri() method is a problem, let me know.
* form(), form_name() and form_number() now return the
HTML::Form object of the form that was chosen. They used
to return a 1 or 0. This means that if you're explicitly
checking for 1 or 0, instead of evaluating the return
code in a boolean context, your code will break.
[FIXES]
* The -handling in extract_links() was incorrectly
building the text.
* uri() now returns a string, not a URI object.
* form(), form_name() and form_number() now return the
HTML::Form object of the form that was chosen.
[INTERNALS]
* Determination of live vs. local tests is now done in
Makefile.PL, and we don't have to set those silly semaphore
files any more.
* Made other cleanups in Makefile.PL, like using
ExtUtils::Command instead of rolling my own touch().
* Moved all the *-live.t tests into t/live/*.t, and renamed
the *-local.t files to not be -local.
* Added more tests for tags.
0.57 July 31, 2003 11:21pm
[ENHANCEMENTS]
* Added tags to those that are links per
find_links().
0.56 July 24, 2003 12:15pm
[THINGS THAT MIGHT BREAK YOUR CODE]
* Created agent_alias() method to do the browser string
translation. Passing "Windows IE 6" to agent() will get
you back exactly that string as the agent. You have to call
$a->agent_alias( "Windows IE 6" ) to get the translation.
Fortunately, unless you used the new functionality of agent() in
the past two days since I released 0.55, it won't be a problem.
[ENHANCEMENTS]
* Removed the dependencies on Carp and Test::Builder. There still
is a dependency on Test::Builder for Test::More, but it's no
longer explicit in the Makefile.PL. Mech will use Carp if
possible, but it's no longer a requirement.
[INTERNALS]
* Added _carp method for handling conditional warnings, rather
than checking quiet() all the time.
0.55 July 22, 2003 12:10pm
[ENHANCEMENTS]
* Added WWW::Mechanize::Link object to encapsulate what used to
be an array reference of stuff from find_link(). This replaces
having to know that $link->[0] was URL and so on. However,
since WWW::Mechanize::Link is a blessed arrayref, it's backwards
compatible with existing code.
* The WWW::Mechanize::Link object now tracks what tag the link
came from (, or
upload.html 100644 000765 000024 350 13126734347 15730 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t
add_header.t 100644 000765 000024 1203 13126734347 16021 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests => 4;
use HTTP::Request::Common;
BEGIN {
delete @ENV{qw( PATH IFS CDPATH ENV BASH_ENV )}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $agent = WWW::Mechanize->new;
isa_ok( $agent, 'WWW::Mechanize', 'Created agent' );
$agent->add_header( Referer => 'x' );
my $req = GET( 'http://www.google.com/' );
$req = $agent->_modify_request( $req );
like( $req->as_string, qr/Referer/, q{Referer's in there} );
$agent->add_header( Referer => undef );
$req = $agent->_modify_request( $req );
unlike( $req->as_string, qr/Referer/, q{Referer's not there} );
find_frame.t 100644 000765 000024 1113 13126734347 16053 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests => 5;
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $uri = URI::file->new_abs( 't/find_frame.html' )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
my $x;
$x = $mech->find_link();
isa_ok( $x, 'WWW::Mechanize::Link' );
is( $x->url, 'bastro.html', 'First link sequentially' );
find_image.t 100644 000765 000024 2241 13126734347 16046 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests => 17;
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $uri = URI::file->new_abs( 't/image-parse.html' )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
my @images;
eval { @images = $mech->find_all_images(); };
is($@,'','survived eval');
is( scalar @images, 3, 'Exactly three images' );
my $first = $images[0];
is( $first->url, 'wango.jpg', 'Got the first image' );
is( $first->tag, 'img', 'img tag' );
is( $first->alt, 'The world of the wango' );
my $second = $images[1];
is( $second->url, 'bongo.gif', 'Got the second image' );
is( $second->tag, 'input', 'input tag' );
is( $second->alt, undef, 'alt' );
is( $second->height, 142, 'height' );
is( $second->width, 43, 'width' );
my $third = $images[2];
is( $third->url, 'linked.gif', 'Got the third image' );
is( $third->tag, 'img', 'input tag' );
is( $third->alt, undef, 'alt' );
is_deeply( \@images, [$mech->images] );
back.t 100644 000765 000024 10150 13126734347 15774 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More tests => 47;
use lib qw( t t/local );
use LocalServer;
use HTTP::Daemon;
use HTTP::Response;
=head1 NAME
=head1 SYNOPSIS
This tests Mech's Back "button". Tests were converted from t/live/back.t,
and subsequently enriched to deal with RT ticket #8109.
=cut
BEGIN {
use Tools;
}
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new(cookie_jar => {});
isa_ok( $mech, 'WWW::Mechanize' );
isa_ok( $mech->cookie_jar(), 'HTTP::Cookies', 'this $mech starts with a cookie jar' );
my $html = <<'HTML';
%s
Whatever.
ImagesScriptsPortsModules
HTML
my $server = LocalServer->spawn( html => $html );
isa_ok( $server, 'LocalServer' );
ok( !$mech->back(), 'With no stack, no going back' );
$mech->get($server->url);
ok( $mech->success, 'Fetched OK' );
my $first_base = $mech->base;
my $title = $mech->title;
$mech->follow_link( n=>2 );
ok( $mech->success, 'Followed OK' );
ok( $mech->back(), 'Back should succeed' );
is( $mech->base, $first_base, 'Did the base get set back?' );
is( $mech->title, $title, 'Title set back?' );
$mech->follow_link( text => 'Images' );
ok( $mech->success, 'Followed OK' );
ok( $mech->back(), 'Back should succeed' );
is( $mech->base, $first_base, 'Did the base get set back?' );
is( $mech->title, $title, 'Title set back?' );
is( scalar @{$mech->{page_stack}}, 0, 'Pre-search check' );
$mech->submit_form(
fields => { 'q' => 'perl' },
);
ok( $mech->success, 'Searched for Perl' );
like( $mech->title, qr/search.cgi/, 'Right page title' );
is( scalar @{$mech->{page_stack}}, 1, 'POST is in the stack' );
$mech->head( $server->url );
ok( $mech->success, 'HEAD succeeded' );
is( scalar @{$mech->{page_stack}}, 1, 'HEAD is not in the stack' );
ok( $mech->back(), 'Back should succeed' );
ok( $mech->success, 'Back' );
is( $mech->base, $first_base, 'Did the base get set back?' );
is( $mech->title, $title, 'Title set back?' );
is( scalar @{$mech->{page_stack}}, 0, 'Post-search check' );
=head2 Back and misc. internal fields
RT ticket #8109 reported that back() is broken after reload(), and
that the cookie_jar was also damaged by back(). We test for that:
reload() should not alter the back() stack, and the cookie jar should
not be versioned (once a cookie is set, hitting the back button in a
browser does not cause it to go away).
=cut
$mech->follow_link( text => 'Images' );
$mech->reload();
ok( $mech->back(), 'Back should succeed' );
is($mech->title, $title, 'reload() does not push page to stack' );
ok(defined($mech->cookie_jar()),
'$mech still has a cookie jar after a number of back()');
# Now some other weird stuff. Start with a fresh history by recreating
# $mech.
SKIP: {
skip 'Test::Memory::Cycle not installed', 1 unless $canTMC;
memory_cycle_ok( $mech, 'No memory cycles found' );
}
$mech = WWW::Mechanize->new( autocheck => 0 );
isa_ok( $mech, 'WWW::Mechanize' );
$mech->get( $server->url );
ok( $mech->success, 'Got root URL' );
my @links = qw(
/scripts
/ports/
modules/
);
is( scalar @{$mech->{page_stack}}, 0, 'Pre-404 check' );
my $server404url = $server->error_notfound('404check');
$mech->get($server404url);
is( $mech->status, 404 , '404 check') or
diag( qq{\$server404url=$server404url\n\$mech->content="}, $mech->content, qq{"\n} );
is( scalar @{$mech->{page_stack}}, 1, 'Even 404s get on the stack' );
ok( $mech->back(), 'Back should succeed' );
is( $mech->uri, $server->url, 'Back from the 404' );
is( scalar @{$mech->{page_stack}}, 0, 'Post-404 check' );
for my $link ( @links ) {
$mech->get( $link );
warn $mech->status() if (! $mech->success());
is( $mech->status, 200, "Get $link" );
ok( $mech->back(), 'Back should succeed' );
is( $mech->uri, $server->url, "Back from $link" );
}
SKIP: {
skip 'Test::Memory::Cycle not installed', 1 unless $canTMC;
memory_cycle_ok( $mech, 'No memory cycles found' );
}
form.t 100644 000765 000024 3475 13126734347 16033 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More tests => 19;
use lib 't/local';
use LocalServer;
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my @warnings;
my $mech = WWW::Mechanize->new( onwarn => sub { push @warnings, @_ } );
isa_ok( $mech, 'WWW::Mechanize' ) or die;
$mech->quiet(1);
$mech->get($server->url);
ok( $mech->success, 'Got a page' ) or die;
is( $mech->uri, $server->url, 'Got page' );
my $form_number_1 = $mech->form_number(1);
isa_ok( $form_number_1, 'HTML::Form', 'Can select the first form');
is( $mech->current_form(), $mech->{forms}->[0], 'Set the form attribute' );
ok( !$mech->form_number(99), 'cannot select the 99th form');
is( $mech->current_form(), $mech->{forms}->[0], 'Form is still set to 1' );
my $form_name_f = $mech->form_name('f');
isa_ok( $form_name_f, 'HTML::Form', 'Can select the form' );
ok( !$mech->form_name('bargle-snark'), 'cannot select non-existent form' );
my $form_id_pounder = $mech->form_id('pounder');
isa_ok( $form_id_pounder, 'HTML::Form', 'Can select the form' );
ok( !$mech->form_id('bargle-snark'), 'cannot select non-existent form' );
my $form_with = $mech->form_with( class => 'test', id => undef );
isa_ok( $form_with, 'HTML::Form', 'Can select the form without id' );
is( $mech->current_form, $form_number_1,
'Form without id is now the current form' );
is( scalar @warnings, 0, 'no warnings so far' );
$mech->quiet(0);
$form_with = $mech->form_with( class => 'test', foo => '', bar => undef );
is( $form_with, $form_number_1, 'Can select form with ambiguous criteria' );
is( scalar @warnings, 1, 'Got one warning' );
is(
"@warnings",
'There are 2 forms with no bar and class "test"'
. ' and empty foo. The first one was used.',
'Got expected warning'
);
TestServer.pm 100644 000765 000024 4456 13126734347 16255 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t package TestServer;
use warnings;
use strict;
use Test::More;
use HTTP::Server::Simple::CGI;
use base qw( HTTP::Server::Simple::CGI );
my $dispatch_table = {};
=head1 OVERLOADED METHODS
=cut
our $pid;
sub new {
die 'An instance of TestServer has already been started.' if $pid;
my $class = shift;
my $port = shift;
if ( !$port ) {
$port = int(rand(20000)) + 20000;
}
my $self = $class->SUPER::new( $port );
my $root = $self->root;
return $self;
}
sub run {
my $self = shift;
$pid = $self->SUPER::run(@_);
$SIG{__DIE__} = \&stop;
return $pid;
}
sub handle_request {
my $self = shift;
my $cgi = shift;
my $path = $cgi->path_info();
my $handler = $dispatch_table->{$path};
if (ref($handler) eq "CODE") {
print "HTTP/1.0 200 OK\r\n";
$handler->($cgi);
}
else {
my $file = $path;
if ( $file =~ m{/$} ) {
$file .= 'index.html';
}
$file =~ s/\s+//g;
my $filename = "t/html/$file";
if ( -r $filename ) {
if (my $response=do { local (@ARGV, $/) = $filename; <> }) {
print "HTTP/1.0 200 OK\r\n";
print "Content-Type: text/html\r\nContent-Length: ", length($response), "\r\n\r\n", $response;
return;
}
}
else {
print "HTTP/1.0 404 Not found\r\n";
print
$cgi->header,
$cgi->start_html('Not found'),
$cgi->h1('Not found'),
$cgi->end_html;
}
}
}
=head1 METHODS UNIQUE TO TestServer
=cut
sub set_dispatch {
my $self = shift;
$dispatch_table = shift;
return;
}
sub background {
my $self = shift;
$pid = $self->SUPER::background()
or Carp::confess( q{Can't start the test server} );
sleep 1; # background() may come back prematurely, so give it a second to fire up
my $root = $self->root;
diag( "Test server $root as PID $pid" );
return $pid;
}
sub hostname {
my $self = shift;
return '127.0.0.1';
}
sub root {
my $self = shift;
my $port = $self->port;
my $hostname = $self->hostname;
return "http://$hostname:$port";
}
sub stop {
if ( $pid ) {
kill( 9, $pid ) unless $^S;
undef $pid;
}
return;
}
1;
bad-request.t 100644 000765 000024 1042 13126734347 16176 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl
use warnings;
use strict;
use Test::More tests => 2;
=head1 NAME
bad-request.t
=head1 SYNOPSIS
Tests the detection of bad API usage.
->request()
Checks for behaviour of calls to C<< ->request() >> without the required
parameter.
=cut
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
my $lives= eval {
#line 1
$mech->request();
1
};
my $err= $@;
ok !$lives, "->request wants at least one parameter";
like $err, qr/->request was called without a request parameter/,
"We carp with a descriptive error message";
credentials.t 100644 000765 000024 3252 13126734347 16264 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use WWW::Mechanize;
use Test::More tests => 14;
my $mech = WWW::Mechanize->new;
isa_ok( $mech, 'WWW::Mechanize' );
my ($user, $pass);
my $uri = URI->new( 'http://localhost' );
($user, $pass) = $mech->get_basic_credentials('myrealm', $uri, 0);
is $user, undef, 'default username is undefined at first';
is $pass, undef, 'default password is undefined at first';
$mech->credentials("username", "password");
($user, $pass) = $mech->get_basic_credentials('myrealm', $uri, 0);
is $user, 'username',
'calling credentials sets username for get_basic_credentials';
is $pass, 'password',
'calling credentials sets password for get_basic_credentials';
my $mech2 = $mech->clone;
($user, $pass) = $mech2->get_basic_credentials('myrealm', $uri, 0);
is $user, 'username',
'cloned object has username for get_basic_credentials';
is $pass, 'password',
'cloned object has password for get_basic_credentials';
my $mech3 = WWW::Mechanize->new;
isa_ok( $mech3, 'WWW::Mechanize' );
($user, $pass) = $mech3->get_basic_credentials('myrealm', $uri, 0);
is $user, undef, 'new object has no username for get_basic_credentials';
is $pass, undef, 'new object has no password for get_basic_credentials';
$mech->clear_credentials;
($user, $pass) = $mech->get_basic_credentials('myrealm', $uri, 0);
is $user, undef, 'username is undefined after clear_credentials';
is $pass, undef, 'password is undefined after clear_credentials';
($user, $pass) = $mech2->get_basic_credentials('myrealm', $uri, 0);
is $user, 'username',
'cloned object still has username for get_basic_credentials';
is $pass, 'password',
'cloned object still has password for get_basic_credentials';
find_inputs.t 100644 000765 000024 2636 13126734347 16316 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests => 11;
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $uri = URI::file->new_abs( 't/find_inputs.html' )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
FIRST_FORM: {
my @inputs = $mech->find_all_inputs();
is( scalar @inputs, 3, 'Exactly three inputs' );
my @submits = $mech->find_all_submits();
is( scalar @submits, 2, 'Exactly two submits' );
}
SECOND_FORM: {
$mech->form_number(2);
my @inputs = $mech->find_all_inputs();
is( scalar @inputs, 4, 'Exactly four inputs' );
my @submits = $mech->find_all_submits();
is( scalar @submits, 1, 'Exactly one submit' );
}
THIRD_FORM: {
$mech->form_number(3);
my @inputs = $mech->find_all_inputs();
is( scalar @inputs, 5, 'Exactly five inputs' );
my @relatives = $mech->find_all_inputs( name_regex => qr/^Your/ );
is( scalar @relatives, 4, 'Found four relatives' );
my @sisters = $mech->find_all_inputs( name => 'YourSister' );
is( scalar @sisters, 2, 'Found two sisters' );
my @submit_sisters = $mech->find_all_inputs( name => 'YourSister' );
is( scalar @submit_sisters, 2, 'But no sisters are submits' );
}
image-parse.t 100644 000765 000024 2076 13126734347 16164 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests=>15;
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $uri = URI::file->new_abs( 't/image-parse.html' )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die 'Can\'t get test page';
my @images = $mech->images;
is( scalar @images, 3, 'Only two images' );
my $first = $images[0];
is( $first->tag, 'img', 'img tag' );
is( $first->url, 'wango.jpg', 'URL matches' );
is( $first->alt, 'The world of the wango', 'alt matches' );
my $second = $images[1];
is( $second->tag, 'input', 'input tag' );
is( $second->url, 'bongo.gif', 'URL matches' );
is( $second->alt, undef, 'alt matches' );
is( $second->height, 142, 'height' );
is( $second->width, 43, 'width' );
my $third = $images[2];
is( $third->url, 'linked.gif', 'Got the third image' );
is( $third->tag, 'img', 'input tag' );
is( $third->alt, undef, 'alt' );
click.t 100644 000765 000024 1533 13126734347 16146 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use lib 't/local';
use LocalServer;
use Test::More tests => 9;
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new();
isa_ok( $mech, 'WWW::Mechanize', 'Created the object' );
my $server = LocalServer->spawn();
isa_ok( $server, 'LocalServer' );
my $response = $mech->get( $server->url );
isa_ok( $response, 'HTTP::Response', 'Got back a response' );
ok( $response->is_success, 'Got URL' ) or die q{Can't even fetch local url};
ok( $mech->is_html, 'Local page is HTML' );
$mech->field(query => 'foo'); # Filled the 'q' field
$response = $mech->click('submit');
isa_ok( $response, 'HTTP::Response', 'Got back a response' );
ok( $response->is_success, q{Can click 'Go' ('Google Search' button)} );
is( $mech->field('query'),'foo', 'Filled field correctly');
regex-error.t 100644 000765 000024 1137 13126734347 16230 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More;
BEGIN {
eval 'use Test::Warn';
plan skip_all => "Test::Warn required to test $0" if $@;
plan tests => 4;
}
BEGIN {
use_ok( 'WWW::Mechanize' );
}
my $m = WWW::Mechanize->new;
isa_ok( $m, 'WWW::Mechanize' );
warning_like {
$m->find_link( link_regex => 'foo' );
} qr[Unknown link-finding parameter "link_regex".+line \d+], 'Passes message, and includes the line number';
warning_like {
$m->find_link( url_regex => 'foo' );
} qr[foo passed as url_regex is not a regex.+line \d+], 'Passes message, and includes the line number';
area_link.html 100644 000765 000024 1267 13126734347 16421 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t
Testing AREA tag handling
find_link.html 100644 000765 000024 4021 13126734347 16420 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t
Testing the linksblargleCPAN ACPAN BCPAN CCPAN DMSNBCCNNBBCNewsNewsNewsRebuild IndexNoWhere NoWhere Blongo!Click Here
find_link_id.t 100644 000765 000024 2423 13126734347 16377 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More 'no_plan';
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $uri = URI::file->new_abs( 't/find_link_id.html' )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
FIND_BY_ID: {
my $x = $mech->find_link( id => 'signature' );
isa_ok( $x, 'WWW::Mechanize::Link' );
is( $x->url, 'signature.html', 'found link with given ID' );
}
FIND_BY_CLASS: {
my $x = $mech->find_link( tag => 'iframe', class => 'smart_iframe' );
isa_ok( $x, 'WWW::Mechanize::Link' );
is( $x->url, 'http://boo.xyz.com/boo_app', 'found link within "iframe" with given class' );
}
FIND_ID_BY_REGEX: {
my $x = $mech->find_link( id_regex => qr/^sig/ );
isa_ok( $x, 'WWW::Mechanize::Link' );
is( $x->url, 'signature.html', 'found link with ID matching a regex' );
}
FIND_CLASS_BY_REGEX: {
my $x = $mech->find_link( tag => 'iframe', class_regex => qr/IFRAME$/i );
isa_ok( $x, 'WWW::Mechanize::Link' );
is( $x->url, 'http://boo.xyz.com/boo_app', 'found link with class matching a regex' );
}
form-parsing.t 100644 000765 000024 733 13126734347 16354 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use strict;
use warnings;
use Test::More tests=>1;
use HTML::Form;
my $base = 'http://localhost/';
my $content = do { local $/ = undef; };
my $forms = [ HTML::Form->parse( $content, $base ) ];
is( scalar @{$forms}, 1, 'Find one form, please' );
__DATA__
WWW::Mechanize::Shell test page
follow.t 100644 000765 000024 4341 13126734347 16363 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More tests => 28;
use lib 't/local';
use LocalServer;
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my $agent = WWW::Mechanize->new( autocheck => 0 );
isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
$agent->quiet(1);
my $response;
$agent->get( $server->url );
ok( $agent->success, 'Got some page' );
is( $agent->uri, $server->url, 'Got local server page' );
$response = $agent->follow_link( n => 99999 );
ok( !$response, q{Can't follow too-high-numbered link});
$response = $agent->follow_link( n => 1 );
isa_ok( $response, 'HTTP::Response', 'Gives a response' );
isnt( $agent->uri, $server->url, 'Need to be on a separate page' );
ok($agent->back(), 'Can go back');
is( $agent->uri, $server->url, 'Back at the first page' );
ok(! $agent->follow_link( text_regex => qr/asdfghjksdfghj/ ), "Can't follow unlikely named link");
ok($agent->follow_link( text => 'Link /foo' ), 'Can follow obvious named link');
isnt( $agent->uri, $server->url, 'Need to be on a separate page' );
ok($agent->back(), 'Can still go back');
ok($agent->follow_link( text_regex=>qr/L\x{f6}schen/ ), 'Can follow link with o-umlaut');
isnt( $agent->uri, $server->url, 'Need to be on a separate page' );
ok($agent->back(), 'Can still go back');
ok($agent->follow_link( text_regex=>qr/St\x{f6}sberg/ ), q{Can follow link with o-umlaut, when it's encoded in the HTML, but not in "follow"});
isnt( $agent->uri, $server->url, 'Need to be on a separate page' );
ok($agent->back(), 'Can still go back');
is( $agent->uri, $server->url, 'Back at the start page again' );
$response = $agent->follow_link( text_regex => qr/Snargle/ );
ok( !$response, q{Couldn't find it} );
ok($agent->follow_link( url => '/foo' ), 'can follow url');
isnt( $agent->uri, $server->url, 'Need to be on a separate page' );
ok($agent->back(), 'Can still go back');
ok(!$agent->follow_link( url => '/notfoo' ), "can't follow wrong url");
is( $agent->uri, $server->url, 'Needs to be on the same page' );
eval {$agent->follow_link( '/foo' )};
like($@, qr/Needs to get key-value pairs of parameters.*follow\.t/, "Invalid parameter passing gets better error message");
reload.t 100644 000765 000024 2555 13126734347 16334 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More tests => 15;
use lib qw( t t/local );
use LocalServer;
BEGIN {
use Tools;
}
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my $agent = WWW::Mechanize->new;
isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
NO_GET: {
my $r = $agent->reload;
ok( !defined($r), 'Initial reload should fail' );
}
FIRST_GET: {
my $r = $agent->get($server->url);
isa_ok( $r, 'HTTP::Response' );
ok( $r->is_success, 'Get google webpage');
ok( $agent->is_html, 'Valid HTML' );
is( $agent->title, 'WWW::Mechanize test page' );
}
INVALIDATE: {
undef $agent->{content};
undef $agent->{ct};
isnt( $agent->title, 'WWW::Mechanize test page' );
ok( !$agent->is_html, 'Not HTML' );
}
RELOAD: {
my $r = $agent->reload;
isa_ok( $r, 'HTTP::Response' );
ok( $agent->is_html, 'Valid HTML' );
ok( $agent->title, 'WWW::Mechanize test page' );
my $cookie_before = $agent->history(0)->{req}->header('Cookie');
$agent->reload;
my $cookie_after = $agent->history(0)->{req}->header('Cookie');
is( $cookie_after, $cookie_before, 'cookies are not multiplied' );
}
SKIP: {
skip 'Test::Memory::Cycle not installed', 1 unless $canTMC;
memory_cycle_ok( $agent, 'Mech: no cycles' );
}
submit.t 100644 000765 000024 2233 13126734347 16362 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use lib qw( t t/local );
use Test::More tests => 13;
use LocalServer;
BEGIN {
use Tools;
}
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my $mech = WWW::Mechanize->new();
isa_ok( $mech, 'WWW::Mechanize', 'Created the object' ) or die;
my $response = $mech->get( $server->url );
isa_ok( $response, 'HTTP::Response', 'Got back a response' ) or die;
is( $mech->uri, $server->url, 'Got the correct page' );
ok( $response->is_success, 'Got local page' ) or die 'cannot even fetch local page';
ok( $mech->is_html, 'is HTML' );
is( $mech->value('upload'), '', 'Hopefully no upload happens');
$mech->field(query => 'foo'); # Filled the 'q' field
$response = $mech->submit;
isa_ok( $response, 'HTTP::Response', 'Got back a response' );
ok( $response->is_success, 'Can click "submit" ("submit" button)');
like($mech->content, qr/\bfoo\b/i, 'Found "Foo"');
is( $mech->value('upload'), '', 'No upload happens' );
SKIP: {
skip 'Test::Memory::Cycle not installed', 1 unless $canTMC;
memory_cycle_ok( $mech, 'Mech: no cycles' );
}
save_content.t 100644 000765 000024 2577 13126734347 16470 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests => 8;
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $original = 't/find_inputs.html';
my $saved = 'saved1.test.txt';
my $uri = URI::file->new_abs( $original )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
#unlink $saved;
ok( !-e $saved, "$saved does not exist" );
$mech->save_content( $saved );
my $old_text = slurp( $original );
my $new_text = slurp( $saved );
ok( $old_text eq $new_text, 'Saved copy matches the original' ) && unlink $saved;
{
my $original = 't/save_content.html';
my $saved = 'saved2.test.txt';
my $uri = URI::file->new_abs( $original )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
#unlink $saved;
ok( !-e $saved, "$saved does not exist" );
$mech->save_content( $saved, binary => 1 );
my $old_text = slurp( $original );
my $new_text = slurp( $saved );
ok( $old_text eq $new_text, 'Saved copy matches the original' ) && unlink $saved;
}
sub slurp {
my $name = shift;
open( my $fh, '<', $name ) or die "Can't open $name: $!\n";
return join '', <$fh>;
}
find_frame.html 100644 000765 000024 413 13126734347 16536 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t
find some frames
link-relative.t 100644 000765 000024 1277 13126734347 16542 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t #!perl -T
use warnings;
use strict;
use Test::More tests => 6;
use URI::file;
BEGIN {
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, 'WWW::Mechanize' );
my $uri = URI::file->new_abs( 't/image-parse.html' )->as_string;
$mech->get( $uri );
ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
$mech->get( 'select.html' );
ok( $mech->success, 'Fetch select.html, no directory' );
$mech->get( './select.html' );
ok( $mech->success, 'Fetch select.html from ./' );
$mech->get( 'local/click.t' );
ok( $mech->success, 'Fetched click.t' );
content.t 100644 000765 000024 2002 13126734347 16523 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use lib 't/local';
use LocalServer;
use Test::More tests => 10;
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $mech = WWW::Mechanize->new();
isa_ok( $mech, 'WWW::Mechanize', 'Created the object' );
my $server = LocalServer->spawn();
isa_ok( $server, 'LocalServer' );
diag('Running tests against ' . $server->url . '?xml=1');
my $response = $mech->get( $server->url . '?xml=1' );
isa_ok( $response, 'HTTP::Response', 'Got back a response' );
ok( $response->is_success, 'Got URL' ) or die q{Can't even fetch local url};
is( $response->content_type, 'application/xhtml+xml', 'Content type is application/xhtml+xml' );
ok( $mech->is_html, 'Local page is HTML' );
$mech->field(query => 'foo'); # Filled the 'q' field
$response = $mech->click('submit');
isa_ok( $response, 'HTTP::Response', 'Got back a response' );
ok( $response->is_success, q{Can click 'Go' ('Google Search' button)} );
is( $mech->field('query'),'foo', 'Filled field correctly');
failure.t 100644 000765 000024 3044 13126734347 16507 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More;
use lib 't/local';
use LocalServer;
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
}
my $NONEXISTENT = 'blahblahblah.xx-only-testing.foo.';
my @results = gethostbyname( $NONEXISTENT );
if ( @results ) {
my ($name,$aliases,$addrtype,$length,@addrs) = @results;
my $ip = join( '.', unpack('C4',$addrs[0]) );
plan skip_all => "Your ISP is overly helpful and returns $ip for non-existent domain $NONEXISTENT. This test cannot be run.";
}
my $bad_url = "http://$NONEXISTENT/";
plan tests => 15;
require_ok( 'WWW::Mechanize' );
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my $mech = WWW::Mechanize->new( autocheck => 0 );
isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
GOOD_PAGE: {
my $response = $mech->get($server->url);
isa_ok( $response, 'HTTP::Response' );
ok( $response->is_success, 'Success' );
ok( $mech->success, 'Get webpage' );
ok( $mech->is_html, 'It\'s HTML' );
is( $mech->title, 'WWW::Mechanize test page', 'Correct title' );
my @links = $mech->links;
is( scalar @links, 10, '10 links, please' );
my @forms = $mech->forms;
is( scalar @forms, 2, 'Two form' );
}
BAD_PAGE: {
my $bad_url = "http://$NONEXISTENT/";
$mech->get( $bad_url );
ok( !$mech->success, 'Failed the fetch' );
ok( !$mech->is_html, "Isn't HTML" );
ok( !defined $mech->title, "No title" );
my @links = $mech->links;
is( scalar @links, 0, "No links" );
my @forms = $mech->forms;
is( scalar @forms, 0, "No forms" );
}
referer.t 100644 000765 000024 4066 13126734347 16517 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use FindBin;
use Test::More tests => 13;
BEGIN {
use lib 't';
use Tools;
}
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
our $server;
my $agent = WWW::Mechanize->new();
isa_ok( $agent, 'WWW::Mechanize' );
SKIP: {
eval { require HTTP::Daemon; };
skip 'HTTP::Daemon required to test the referrer header',10 if $@;
# We want to be safe from non-resolving local host names
delete $ENV{HTTP_PROXY};
# Now start a fake webserver, fork, and connect to ourselves
my $command = qq'"$^X" "$FindBin::Bin/referer-server"';
if ($^O eq 'VMS') {
$command = qq'mcr $^X t/referer-server';
}
open $server, "$command |" or die "Couldn't spawn fake server: $!";
sleep 1; # give the child some time
my $url = <$server>;
chomp $url;
$agent->get( $url );
is($agent->status, 200, 'Got first page') or diag $agent->res->message;
is($agent->content, q{Referer: ''}, 'First page gets sent with empty referrer');
$agent->get( $url );
is($agent->status, 200, 'Got second page') or diag $agent->res->message;
is($agent->content, "Referer: '$url'", 'Referer got sent for absolute url');
$agent->get( '.' );
is($agent->status, 200, 'Got third page') or diag $agent->res->message;
is($agent->content, "Referer: '$url'", 'Referer got sent for relative url');
$agent->add_header( Referer => 'x' );
$agent->get( $url );
is($agent->status, 200, 'Got fourth page') or diag $agent->res->message;
is($agent->content, q{Referer: 'x'}, 'Referer can be set to empty again');
my $ref = 'This is not the referer you are looking for *jedi gesture*';
$agent->add_header( Referer => $ref );
$agent->get( $url );
is($agent->status, 200, 'Got fourth page') or diag $agent->res->message;
is($agent->content, "Referer: '$ref'", 'Custom referer can be set');
};
SKIP: {
skip 'Test::Memory::Cycle not installed', 1 unless $canTMC;
memory_cycle_ok( $agent, 'No memory cycles found' );
}
END {
close $server if $server;
}
find_inputs.html 100644 000765 000024 1614 13126734347 17012 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t
image-parse.html 100644 000765 000024 1154 13126734347 16661 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t
Testing image extractionblargleBBCBlongo!
encoding.t 100644 000765 000024 753 13126734347 16632 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More tests => 5;
use lib qw( t/local );
use LocalServer;
BEGIN {
delete @ENV{qw( IFS CDPATH ENV BASH_ENV )};
use_ok('WWW::Mechanize');
}
my $mech = WWW::Mechanize->new();
isa_ok( $mech, 'WWW::Mechanize' );
my $server = LocalServer->spawn();
isa_ok( $server, 'LocalServer' );
my $response = $mech->get( $server->url . 'encoding/euc-jp' );
ok( $mech->success, 'Fetched OK' );
is( $response->content_charset(), 'EUC-JP', 'got encoding enc-jp' );
log-server 100644 000765 000024 14500 13126734347 16722 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local # vi: ft=perl
# Thanks to merlyn for nudging me and giving me this snippet!
use strict;
use HTTP::Daemon;
use CGI 4.08;
use Getopt::Long;
$|++;
GetOptions(
'e=s' => \my $expression,
);
my $host = 'localhost';
my $d = HTTP::Daemon->new(
LocalAddr => $host,
) or die;
# HTTP::Deamon doesn't return http://localhost:.../
# for LocalAddr => 'localhost'. This causes the
# tests to fail of many machines.
( my $url = URI->new($d->url) )->host($host);
print "$url\n";
my ($filename,$logfile) = @ARGV[0,1];
if ($filename) {
open DATA, "< $filename"
or die "Couldn't read page '$filename' : $!\n";
};
#open LOG, ">", $logfile
# or die "Couldn't create logfile '$logfile' : $!\n";
my $log;
my $body = join "", ;
$body =~ s//chr(hex($1))/eg;
utf8::encode($body);
utf8::upgrade($body);
sub debug($) {
my $message = $_[0];
$message =~ s!\n!\n#SERVER:!g;
warn "#SERVER: $message"
if $ENV{TEST_HTTP_VERBOSE};
};
SERVERLOOP: {
my $quitserver;
while (my $c = $d->accept) {
debug "New connection";
while (my $r = $c->get_request) {
debug "Request:\n" . $r->as_string;
my $location = ($r->uri->path || "/");
my ($link1,$link2) = ('','');
if ($location =~ m!^/link/([^/]+)/(.*)$!) {
($link1,$link2) = ($1,$2);
};
my $res;
if ($location eq '/get_server_log') {
$res = HTTP::Response->new(200, "OK", undef, $log);
$log = '';
} elsif ( $location eq '/quit_server') {
debug "Quitting";
$res = HTTP::Response->new(200, "OK", [Connection => 'close'], "quit");
$quitserver = 1;
} else {
eval $expression
if $expression;
warn "eval: $@" if $@;
$log .= "Request:\n" . $r->as_string . "\n";
if ($location =~ m!^/redirect/(.*)$!) {
$res = HTTP::Response->new(302);
$res->header('location', $d->url . $1);
} elsif ($location =~ m!^/error/notfound/(.*)$!) {
$res = HTTP::Response->new(404, "Not found", [Connection => 'close']);
} elsif ($location =~ m!^/error/timeout/(\d+)$!) {
sleep $1;
$res = HTTP::Response->new(599, "Timeout reached", [Connection => 'close']);
} elsif ($location =~ m!^/error/close/(\d+)$!) {
sleep $1;
$res = undef;
} elsif ( $location =~ m!^/chunks!) {
my $count = 5;
$res = HTTP::Response->new(200, "OK", undef, sub {
sleep 1;
my $buf = 'x' x 16;
return $buf if $count-- > 0;
return undef; # done
});
} elsif ($location =~ m!^/error/after_headers$!) {
my $count = 2;
$res = HTTP::Response->new(200, "OK", undef, sub {
sleep 1;
my $buf = 'x' x 16;
return $buf if $count-- > 0;
die "Planned error after headers";
});
} elsif ($location =~ m!^/encoding/(.*)!) {
my $encoding = $1;
$res = HTTP::Response->new(
200, "OK",
[ 'Content-Type' => "text/html; charset=$encoding" ],
"encoding $encoding"
);
} else {
my $q = CGI->new($r->uri->query);
# Make sticky form fields
my ($query,$session,%cat);
$query = defined $q->param('query') ? $q->param('query') : "(empty)";
$session = defined $q->param('session') ? $q->param('session') : 1;
%cat = map { $_ => 1 } (defined $q->param('cat') ? $q->multi_param('cat') : qw( cat_foo cat_bar ));
my @categories = map { $cat{$_} ? "checked" : "" } qw( cat_foo cat_bar cat_baz );
(my $h = $r->headers->{host}) =~ s/:\d+//;
my $rbody = sprintf $body,$location,$session,$query,@categories;
$res = HTTP::Response->new(200, "OK", [
"Set-Cookie" => $q->cookie(-name => 'log-server',-value=>'shazam2', -discard=>1,),
'Cache-Control' => 'no-cache',
'Pragma' => 'no-cache',
'Max-Age' => 0,
'Connection' => 'close',
'Content-Length' => length($rbody),
], $rbody);
$res->content_type(
$q->param('xml') ? 'application/xhtml+xml' : 'text/html'
);
debug "Request " . ($r->uri->path || "/");
};
};
debug "Response:\n" . $res->as_string
if $res;
eval {
$c->send_response($res)
if $res;
};
if (my $err = $@) {
debug "Server raised error: $err";
if ($err !~ /^Planned error\b/) {
warn $err;
};
$c->close;
};
if (! $res) {
$c->close;
};
last if $quitserver;
}
sleep 1;
undef($c);
last SERVERLOOP
if $quitserver;
}
};
END { debug "Server stopped" };
__DATA__
WWW::Mechanize test page
nonascii.t 100644 000765 000024 1143 13126734347 16661 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use warnings;
use strict;
use Test::More tests => 5;
use lib 't/local';
use LocalServer;
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn( file => 't/local/nonascii.html' );
isa_ok( $server, 'LocalServer' );
my $agent = WWW::Mechanize->new;
isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
$agent->quiet(0);
$agent->get( $server->url );
ok( $agent->success, 'Got some page' );
# \321\202 is \x{442}
$agent->field("ValueOf'CF.{\321\202}'", "\321\201");
is($agent->value("ValueOf'CF.{\321\202}'"), "\321\201", 'set utf value');
overload.t 100644 000765 000024 4545 13126734347 16702 0 ustar 00olaf staff 000000 000000 WWW-Mechanize-1.86/t/local use Test::More skip_all => "Mysteriously stopped passing, and I don't know why.";
use warnings;
use strict;
use lib 't/local';
use LocalServer;
use Test::More tests => 11;
=head1 NAME
overload.t
=head1 SYNOPSIS
This tests for various ways, advertised in L, to
create a subclass of the mech to alter it's behavior in a useful
manner. (Of course free-style overloading is discouraged, as it breaks
encapsulation big time.)
This test first feeds some bad HTML to Mech to make sure that it throws
an error. Then, it overloads update_html() to fix the HTML before
processing it, and then we should not have an error.
=head2 Overloading update_html()
This is the recommended way to tidy up the received HTML in a generic
way, and/or to install supplemental "surface tests" on the HTML
(e.g. link checker).
=cut
BEGIN {
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn(html => <<'BROKEN_HTML');
Broken document