1Test::Stream::Bundle(3)User Contributed Perl DocumentatioTnest::Stream::Bundle(3)
2
3
4
6 Test::Stream::Bundle - Tools to help you write custom bundles.
7
9 This distribution is deprecated in favor of Test2, Test2::Suite, and
10 Test2::Workflow.
11
12 See Test::Stream::Manual::ToTest2 for a conversion guide.
13
15 You can reduce your boilerplate by writing your own Test::Stream
16 bundles. A bundle is a set of plugins that get loaded all at once to
17 your specifications.
18
20 package Test::Stream::Bundle::MyBundle;
21 use strict;
22 use warnings;
23
24 # Gives us an 'import' method that allows this module to be used directly
25 # if desired.
26 use Test::Stream::Bundle qw/import/;
27
28 sub plugins {
29 return (
30 qw{
31 IPC
32 TAP
33 ExitSummary
34 Core
35 Context
36 Exception
37 Warnings
38 Compare
39 Mock
40 },
41 );
42 }
43
45 $class->import()
46 This "import()" method gets called when your plugin isused directly
47 "use Test::Stream::Bundle::MyBundle". Doing so will load all the
48 specified plugins.
49
51 @list = $class->plugins()
52 The "plugins()" method should return a list of plugins to load. It
53 can also return coderefs which will be run with the original caller
54 arrayref as their only argument.
55
56 sub plugins {
57 return (
58 qw/Core TAP .../,
59 sub {
60 my $caller = shift;
61
62 # Package, file, and line that requested the bundle be used.
63 my ($pkg, $file, $line) = @$caller;
64
65 ...
66 },
67 );
68 }
69
71 The source code repository for Test::Stream can be found at
72 http://github.com/Test-More/Test-Stream/.
73
75 Chad Granum <exodist@cpan.org>
76
78 Chad Granum <exodist@cpan.org>
79
81 Copyright 2015 Chad Granum <exodist7@gmail.com>.
82
83 This program is free software; you can redistribute it and/or modify it
84 under the same terms as Perl itself.
85
86 See http://dev.perl.org/licenses/
87
88
89
90perl v5.36.0 2022-07-22 Test::Stream::Bundle(3)