NAME
Test::WWW::Mechanize::Driver::Util - Useful utilities
USAGE
build_uri
build_uri( $uri, \%params )
Append parameters to a uri. Parameters whose values are array refs will expand to include all values.
Example:
my %params = ( foo => "What's up, doc?",
b => [ 1, 2, 3 ]
);
my $uri = build_uri( "http://example.com/index.pl?foo=bar", \%params );
# $uri eq "http://example.com/index.pl?foo=bar&foo=What's+up%2C+Doc%3F$b=1&b=2&b=3
cat
my $stuff = cat $file;
my $stuff = cat \$mode, $file;
Read in the entirety of a file. If requested in list context, the lines are returned. In scalar context, the file is returned as one large string. If a string reference $mode
is provided as a first argument it will be taken as the file mode (the default is "<").
TRUE
TRUE $hash_ref, qw| key1 arbitrarily/deep/key |;
TRUE $hash_ref, @paths, { sep => $separator, false_pat => $pattern };
Safely test for deep key truth. Recursion happens by splitting on $separator
("/" by default, set $separator
to undef
to disable this behavior), there is no means for escaping. Returns true only if all keys exist and are true. Values matched by $pattern
(^(?i:false)$
by default) as well as an empty list or empty hash will all cause 0 to be returned. Array refs are allowed if corresponding path components are numeric.
HAS
HAS $hash_ref, qw| key1 arbitrarily/deep/key |;
HAS $hash_ref, @paths, { sep => $separator };
Safely test for deep key definedness. Recursion happens by splitting on $separator
("/" by default), there is no means for escaping. Returns true only if all keys exist and are defined. Array refs are allowed if corresponding path components are numeric.
AUTHOR
Dean Serenevy
dean@serenevy.net
https://serenevy.net/
COPYRIGHT
This software is hereby placed into the public domain. If you use this code, a simple comment in your code giving credit and an email letting me know that you find it useful would be courteous but is not required.
The software is provided "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. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
SEE ALSO
perl(1).