NAME

HTTP::WebTest::Utils - Miscellaneous subroutines used by HTTP::WebTest

SYNOPSIS

use HTTP::WebTest::Utils;
use HTTP::WebTest::Utils qw(make_access_method find_port);
use HTTP::WebTest::Utils qw(copy_dir load_package);
use HTTP::WebTest::Utils qw(eval_in_playground);

*method = make_access_method($field);
*method = make_access_method($field, $default_value);
*method = make_access_method($field, sub { ... });

find_port(hostname => $hostname);

copy_dir($src_dir, $dst_dir);

load_package($package);

my $ret = eval_in_playground($code);
die $@ if $@;

DESCRIPTION

This packages contains utility subroutines used by HTTP::WebTest.

SUBROUTINES

make_access_method($field, $optional_default_value)

Creates anonymous subroutine which can be used as accessor method. Method can be used with objects that are blessed hashes.

Typical usage is

*method = make_access_method($field, ...);

Parameters

  • $field

    A hash field used for created accessor method.

  • $optional_default_value

    If $optional_default_value is a code reference, uses values returned by its execution as default for created accessor method. Otherwise, uses $optional_default_value as name of method which returns default value for created accessor method.

Returns

find_port (hostname => $hostname)

Returns

Free port number for network interface specified by $hostname.

copy_dir ($src_dir, $dst_dir)

Copies directiory recursively.

load_package ($package)

Loads package unless it is already loaded.

eval_in_playground ($code)

Evaluates perl code inside playground package.

Returns

A return value of evaluated code.

make_sub_in_playground ($code)

Create anonymous subroutine inside playground package.

Returns

A reference on anonymous subroutine.

COPYRIGHT

Copyright (c) 2001-2002 Ilya Martynov. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

HTTP::WebTest

HTTP::WebTest::API