NAME

HTTP::WebTest::Utils - Some misc staff used by various parts of 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);

*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);

DESCRIPTION

This packages contains some subroutines used by various parts of HTTP::WebTest which don't fit any its classes.

SUBROUTINES

make_access_method($field, $optional_default_value)

Creates anonymouse subroutine which can be used as accessor method. Such method can be used together with objects which are based on 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.

COPYRIGHT

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

This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License.

SEE ALSO

HTTP::WebTest

HTTP::WebTest::API