man Test::Inline::IO::File () - Local Filesystem IO Handler

NAME

Test::Inline::IO::File - Local Filesystem IO Handler

DESCRIPTION

Test::Inline 2.00 was conceived in an enterprise setting, and retains the flexibilty, power, and bulk that this created.

The intent with the CWFileHandler system is to allow Test::Inline to be able to pull source data from anywhere, and write the resulting test scripts to anywhere.

Until a more powerful pure-OO file-system module comes along in the form of the FSI project, this serves as a minimalist implementation of the functionality that Test::Inline needs in order to work.

An alternative CWFileHandler class need not subclass this one, merely implement the same interface, taking whatever alternative arguments to the CWnew constructor that it wishes.

All methods in this class take unix-style paths, translating to the underlying filesystem if required.

METHODS

The CWnew constructor takes a root path on the local filesystem and returns a new CWTest::Inline::IO::File object to that location. The CWexists_file method checks to see if a particular file currently exists in the input handler.

Returns true if it exists, or false if not. The CWexists_dir method checks to see if a particular directory currently exists in the input handler.

Returns true if it exists, or false if not. The CWread method reads in the entire contents of a single file, returning it as a reference to a SCALAR. It also localises the newlines as it does this, so files from different operating systems should read as you expect.

Returns a SCALAR reference, or CWundef on error. The CWwrite method writes a string to a file in one hit, creating it and it's path if needed. Assuming your input FileHandler is pointing at the root directory of a lib path (meaning that My::Module will be located at My/Module.pm within it) the CWclass_file method will take a class name, and check to see if the file for that class exists in the FileHandler.

Returns a reference to an ARRAY containing the filename if it exists, or CWundef on error. The CWfind method takes as argument a directory root class, and then scans within the input FileHandler to find all files contained in that class or any other classes under it's namespace.

Returns a reference to an ARRAY containing all the files within the class, or CWundef on error.

TO DO

- Convert to using FSI::FileSystem objects, once they exist

SUPPORT

See the main SUPPORT section.

AUTHOR

Adam Kennedy <cpan@ali.as>, <http://ali.as/>

COPYRIGHT

Copyright (c) 2004 - 2005 Phase N Austalia. All rights reserved.

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

The full text of the license can be found in the LICENSE file included with this module.