1Test::Inline::IO::File(U3s)er Contributed Perl DocumentatTieosnt::Inline::IO::File(3)
2
3
4

NAME

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

DESCRIPTION

9       Test::Inline::IO::File is the default IO handler for Test::Inline.
10
11       Test::Inline 2.0 was conceived in an enterprise setting, and retains
12       the flexibilty, power, and bulk that this created, although for most
13       users the power and complexity that is available is largely hidden away
14       under multiple layers of sensible defaults.
15
16       The intent with the "InputHandler" and "OutputHandle" parameters is to
17       allow Test::Inline to be able to pull source data from anywhere, and
18       write the resulting test scripts to anywhere.
19
20       Until a more powerful pure-OO file-system API comes along, this module
21       serves as a minimalist implementation of the subset of functionality
22       that Test::Inline needs in order to work.
23
24       An alternative IO Handler class need not subclass this one (although it
25       is recommended), merely implement the same interface, taking whatever
26       alternative arguments to the "new" constructor that it wishes.
27
28       All methods in this class are provided with unix-style paths, and
29       should do the translating to the underlying filesystem themselves if
30       required.
31

METHODS

33   new
34         # Simplified usage
35         $io_handler = Test::Inline::IO::File->new( $path );
36
37         # Full key/value usage
38         $io_handler = Test::Inline::IO::File->new(
39                 path     => $path,
40                 readonly => 1,
41         );
42
43       The "new" constructor takes a root path on the local filesystem and
44       returns a new "Test::Inline::IO::File" object to that location.
45
46   exists_file $file
47       The "exists_file" method checks to see if a particular file currently
48       exists in the input handler.
49
50       Returns true if it exists, or false if not.
51
52   exists_dir $dir
53       The "exists_dir" method checks to see if a particular directory
54       currently exists in the input handler.
55
56       Returns true if it exists, or false if not.
57
58   read $file
59       The "read" method reads in the entire contents of a single file,
60       returning it as a reference to a SCALAR. It also localises the newlines
61       as it does this, so files from different operating systems should read
62       as you expect.
63
64       Returns a SCALAR reference, or "undef" on error.
65
66   write $file, $content
67       The "write" method writes a string to a file in one hit, creating it
68       and it's path if needed.
69
70   class_file $class
71       Assuming your input FileHandler is pointing at the root directory of a
72       lib path (meaning that My::Module will be located at My/Module.pm
73       within it) the "class_file" method will take a class name, and check to
74       see if the file for that class exists in the FileHandler.
75
76       Returns a reference to an ARRAY containing the filename if it exists,
77       or "undef" on error.
78
79   find $class
80       The "find" method takes as argument a directory root class, and then
81       scans within the input FileHandler to find all files contained in that
82       class or any other classes under it's namespace.
83
84       Returns a reference to an ARRAY containing all the files within the
85       class, or "undef" on error.
86

TO DO

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

SUPPORT

91       See the main SUPPORT section.
92

AUTHOR

94       Adam Kennedy <adamk@cpan.org>, <http://ali.as/>
95
97       Copyright 2004 - 2013 Adam Kennedy.
98
99       This program is free software; you can redistribute it and/or modify it
100       under the same terms as Perl itself.
101
102       The full text of the license can be found in the LICENSE file included
103       with this module.
104
105
106
107perl v5.28.0                      2013-04-09         Test::Inline::IO::File(3)
Impressum