1Test::Inline::IO::File(U3s)er Contributed Perl DocumentatTieosnt::Inline::IO::File(3)
2
3
4
6 Test::Inline::IO::File - Test::Inline Local Filesystem IO Handler
7
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
33 new
34
35 # Simplified usage
36 $io_handler = Test::Inline::IO::File->new( $path );
37
38 # Full key/value usage
39 $io_handler = Test::Inline::IO::File->new(
40 path => $path,
41 readonly => 1,
42 );
43
44 The "new" constructor takes a root path on the local filesystem and
45 returns a new "Test::Inline::IO::File" object to that location.
46
47 exists_file $file
48
49 The "exists_file" method checks to see if a particular file currently
50 exists in the input handler.
51
52 Returns true if it exists, or false if not.
53
54 exists_dir $dir
55
56 The "exists_dir" method checks to see if a particular directory cur‐
57 rently exists in the input handler.
58
59 Returns true if it exists, or false if not.
60
61 read $file
62
63 The "read" method reads in the entire contents of a single file,
64 returning it as a reference to a SCALAR. It also localises the newlines
65 as it does this, so files from different operating systems should read
66 as you expect.
67
68 Returns a SCALAR reference, or "undef" on error.
69
70 write $file, $content
71
72 The "write" method writes a string to a file in one hit, creating it
73 and it's path if needed.
74
75 class_file $class
76
77 Assuming your input FileHandler is pointing at the root directory of a
78 lib path (meaning that My::Module will be located at My/Module.pm
79 within it) the "class_file" method will take a class name, and check to
80 see if the file for that class exists in the FileHandler.
81
82 Returns a reference to an ARRAY containing the filename if it exists,
83 or "undef" on error.
84
85 find $class
86
87 The "find" method takes as argument a directory root class, and then
88 scans within the input FileHandler to find all files contained in that
89 class or any other classes under it's namespace.
90
91 Returns a reference to an ARRAY containing all the files within the
92 class, or "undef" on error.
93
95 - Convert to using FSI::FileSystem objects, once they exist
96
98 See the main SUPPORT section.
99
101 Adam Kennedy <adamk@cpan.org>, <http://ali.as/>
102
104 Copyright 2004 - 2007 Adam Kennedy.
105
106 This program is free software; you can redistribute it and/or modify it
107 under the same terms as Perl itself.
108
109 The full text of the license can be found in the LICENSE file included
110 with this module.
111
112
113
114perl v5.8.8 2007-08-17 Test::Inline::IO::File(3)