The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

File::TestPath - Determines include directories for the test software

SYNOPSIS

  #######
  # Procedural (subroutine) interface
  # 
  use File::TestPath qw(test_lib2inc find_t_paths find_t_roots);

  @INC           = test_lib2inc()
  @t_path        = find_t_paths()
  @t_path        = find_t_roots()

  #######
  # Class interface
  # 
  use File::TestPath

  @INC           = File::TestPath->test_lib2inc()
  @t_path        = File::TestPath->find_t_paths()
  @t_path        = File::TestPath->find_t_roots()

DESCRIPTION

The test software is traditionally not part of the Perl lib subtree since it is usually of little concern to the end-user. The normal run environment does not support loading test program modules outside the lib subtrees.

This module provides methods to access program modules and other files in the test subtree.

find_t_paths method

This method operates on the assumption that the test files are a subtree to a directory named t and the t directories are on the same level as the last directory of each directory tree specified in @INC. If this assumption is not true, this method most likely will not behave very well.

The find_t_paths method returns the directory trees in @INC with the last directory changed to t.

find_t_roots method

This method operates on the assumption that the test files are a subtree to a directory named t and the t directories are on the same level as the last directory of each directory tree specified in @INC. If this assumption is not true, this method most likely will not behave very well.

The find_t_roots method returns the directory trees in @INC with last directory drooped.

test_lib2inc method

 @INC           = File::TestPath->test_lib2inc()

The test_lib2inc method walks up the directory tree from the current directory until it finds a directory named "t". It then pushs the parent to that directory, and a directory with "t" replaced by "lib" onto @INC. The test_lib2inc method returns the @INC before it is altered so that the using method may return @INC to before calling test_lib2inc.

REQUIREMENTS

Coming soon.

DEMONSTRATION

 ~~~~~~ Demonstration overview ~~~~~

Perl code begins with the prompt

 =>

The selected results from executing the Perl Code follow on the next lines. For example,

 => 2 + 2
 4

 ~~~~~~ The demonstration follows ~~~~~

 =>     use File::Spec;
 =>  
 =>     use File::Package;
 =>     my $fp = 'File::Package';

 =>     use File::TestPath;
 =>     my $uut = 'File::TestPath';
 =>     use File::TestPath;
 =>    unshift @INC,File::Spec->catdir(cwd(),'lib');
 =>    my @t_path = $uut->find_t_paths( );
 => $t_path[0]
 'E:\User\SoftwareDiamonds\installation\t\File\t'

 => shift @INC;
 =>    my @restore_inc = $uut->test_lib2inc( );

 =>    my ($vol,$dirs) = File::Spec->splitpath( cwd(), 'nofile');
 =>    my @dirs = File::Spec->splitdir( $dirs );
 =>    pop @dirs;
 =>    shift @dirs unless $dirs[0];
 =>    my @expected_lib = ();
 =>    my @t_root = @dirs;
 =>    pop @t_root;
 =>    unshift @expected_lib, File::Spec->catdir($vol, @t_root);
 =>    $dirs[-1] = 'lib';
 =>    unshift @expected_lib, File::Spec->catdir($vol, @dirs);
 =>    $dirs[-1] = 'tlib';
 =>    unshift @expected_lib, File::Spec->catdir($vol, @dirs);
 => join('; ', ($INC[0],$INC[1],$INC[2]))
 'E:\User\SoftwareDiamonds\installation\tlib; E:\User\SoftwareDiamonds\installation\lib; E:\User\SoftwareDiamonds\installation'

 => @INC = @restore_inc;
 =>    my $dir = File::Spec->catdir(cwd(),'lib');
 =>    $dir =~ s=/=\\=g if $^O eq 'MSWin32';
 =>    unshift @INC,$dir;
 =>    @t_path = $uut->find_t_roots( );
 =>    $dir = cwd();
 =>    $dir =~ s=/=\\=g if $^O eq 'MSWin32';
 => $t_path[0]
 'E:\User\SoftwareDiamonds\installation\t\File'

 => shift @INC

QUALITY ASSURANCE

Running the test script 'TestPath.t' found in the "File-TestPath-$VERSION.tar.gz" distribution file verifies the requirements for this module.

All testing software and documentation stems from the Software Test Description (STD) program module 't::File::TestPath', found in the distribution file "File-TestPath-$VERSION.tar.gz".

The 't::File::TestPath' STD POD contains a tracebility matix between the requirements established above for this module, and the test steps identified by a 'ok' number from running the 'TestPath.t' test script.

The t::File::TestPath' STD program module '__DATA__' section contains the data to perform the following:

  • to generate the test script 'TestPath.t'

  • generate the tailored STD POD in the 't::File::TestPath' module,

  • generate the 'TestPath.d' demo script,

  • replace the POD demonstration section herein with the demo script 'TestPath.d' output, and

  • run the test script using Test::Harness with or without the verbose option,

To perform all the above, prepare and run the automation software as follows:

  • Install "Test_STDmaker-$VERSION.tar.gz" from one of the respositories only if it has not been installed:

    • http://www.softwarediamonds/packages/

    • http://www.perl.com/CPAN-local/authors/id/S/SO/SOFTDIA/

  • manually place the script tmake.pl in "Test_STDmaker-$VERSION.tar.gz' in the site operating system executable path only if it is not in the executable path

  • place the 't::File::TestPath' at the same level in the directory struture as the directory holding the 'File::TestPath' module

  • execute the following in any directory:

     tmake -test_verbose -replace -run -pm=t::File::TestPath

NOTES

FILES

The installation of the "File-TestPath-$VERSION.tar.gz" distribution file installs the 'Docs::Site_SVD::File_TestPath' SVD program module.

The __DATA__ data section of the 'Docs::Site_SVD::File_TestPath' contains all the necessary data to generate the POD section of 'Docs::Site_SVD::File_TestPath' and the "File-TestPath-$VERSION.tar.gz" distribution file.

To make use of the 'Docs::Site_SVD::File_TestPath' SVD program module, perform the following:

  • install "ExtUtils-SVDmaker-$VERSION.tar.gz" from one of the respositories only if it has not been installed:

    • http://www.softwarediamonds/packages/

    • http://www.perl.com/CPAN-local/authors/id/S/SO/SOFTDIA/

  • manually place the script vmake.pl in "ExtUtils-SVDmaker-$VERSION.tar.gz' in the site operating system executable path only if it is not in the executable path

  • Make any appropriate changes to the __DATA__ section of the 'Docs::Site_SVD::File_TestPath' module. For example, any changes to 'File::TestPath' will impact the at least 'Changes' field.

  • Execute the following:

     vmake readme_html all -pm=Docs::Site_SVD::File_TestPath

AUTHOR

The holder of the copyright and maintainer is

<support@SoftwareDiamonds.com>

Copyrighted (c) 2002 Software Diamonds

All Rights Reserved

BINDING REQUIREMENTS NOTICE

Binding requirements are indexed with the pharse 'shall[dd]' where dd is an unique number for each header section. This conforms to standard federal government practices, 490A ("3.2.3.6" in STD490A). In accordance with the License, Software Diamonds is not liable for any requirement, binding or otherwise.

LICENSE

Software Diamonds permits the redistribution and use in source and binary forms, with or without modification, provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

SOFTWARE DIAMONDS, http::www.softwarediamonds.com, PROVIDES THIS SOFTWARE 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWARE DIAMONDS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING USE OF THIS SOFTWARE, EVEN IF ADVISED OF NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE POSSIBILITY OF SUCH DAMAGE.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 512:

=back doesn't take any parameters, but you said =back =for html <p><br> <!-- BLK ID="NOTICE" --> <!-- /BLK --> <p><br> <!-- BLK ID="OPT-IN" --> <!-- /BLK --> <p><br> <!-- BLK ID="EMAIL" --> <!-- /BLK --> <p><br> <!-- BLK ID="COPYRIGHT" --> <!-- /BLK --> <p><br> <!-- BLK ID="LOG_CGI" --> <!-- /BLK --> <p><br>

=back without =over