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

VERSION

9       version 2.214
10

DESCRIPTION

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

METHODS

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

TO DO

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

SUPPORT

94       See the main SUPPORT section.
95
96       Bugs may be submitted through the RT bug tracker
97       <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Inline> (or
98       bug-Test-Inline@rt.cpan.org <mailto:bug-Test-Inline@rt.cpan.org>).
99

AUTHOR

101       Adam Kennedy <adamk@cpan.org>
102
104       This software is copyright (c) 2003 by Adam Kennedy.
105
106       This is free software; you can redistribute it and/or modify it under
107       the same terms as the Perl 5 programming language system itself.
108
109
110
111perl v5.32.1                      2021-04-27         Test::Inline::IO::File(3)
Impressum