1Test::Inline::Content::ULseegracCyo(n3t)ributed Perl DocTuemsetn:t:aItniloinne::Content::Legacy(3)
2
3
4
6 Test::Inline::Content::Legacy - Test::Inline 2 Content Handler for
7 legacy functions
8
10 Custom script content generation using Test::Inline 2.000+ with a
11 custom generator functions
12
13 my $header = "....";
14 my $function = sub {
15 my $Object = shift;
16 my $Script = shift;
17 return $header . $Script->merged_content;
18 };
19
20 my $Inline = Test::Inline->new(
21 ...
22 file_content => $function,
23 );
24
25 Migrating this same code to Test::Inline 2.100+ ContentHandler objects
26
27 my $header = "....";
28 my $function = sub {
29 my $Object = shift;
30 my $Script = shift;
31 return $header . $Script->merged_content;
32 };
33
34 my $ContentHandler = Test::Inline::Content::Legacy->new( $function );
35
36 my $Inline = Test::Inline->new(
37 ...
38 ContentHandler => $ContentHandler,
39 );
40
42 This class exists to provide a migration path for anyone using the
43 custom script generators in Test::Inline via the "file_content" param.
44
45 The synopsis above pretty much says all you need to know.
46
48 new $CODE_ref
49 The "new" constructor for "Test::Inline::Content::Legacy" takes a
50 single parameter of a "CODE" reference, as you would have previously
51 provided directly to "file_content".
52
53 Returns a new "Test::Inline::Content::Legacy" object, or "undef" if not
54 passed a "CODE" reference.
55
56 coderef
57 The "coderef" accessor returns the "CODE" reference for the object
58
59 process $Inline $Script
60 The "process" method works with the legacy function by passing the
61 Test::Inline and Test::Inline::Script arguments straight through to the
62 legacy function, and returning it's result as the return value.
63
65 See the main SUPPORT section.
66
68 Adam Kennedy <adamk@cpan.org>, <http://ali.as/>
69
71 Copyright 2004 - 2013 Adam Kennedy.
72
73 This program is free software; you can redistribute it and/or modify it
74 under the same terms as Perl itself.
75
76 The full text of the license can be found in the LICENSE file included
77 with this module.
78
79
80
81perl v5.28.0 2013-04-09 Test::Inline::Content::Legacy(3)