-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
91 lines (63 loc) · 1.77 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
NAME
Plack::App::Data::Printer - Plack Data::Printer application.
SYNOPSIS
use Plack::App::Data::Printer;
my $obj = Plack::App::Data::Printer->new(%parameters);
my $psgi_ar = $obj->call($env);
my $app = $obj->to_app;
METHODS
Class inherites Plack::Component.
"new"
my $obj = Plack::App::Data::Printer->new(%parameters);
Constructor.
Returns instance of object.
* "data"
Data structure to print out.
Parameter is required.
"call"
my $psgi_ar = $obj->call($env);
Implementation of Data::Printer in plack.
Returns reference to array (PSGI structure).
"to_app"
my $app = $obj->to_app;
Creates Plack application.
Returns Plack::Component object.
EXAMPLE
use strict;
use warnings;
use Plack::App::Data::Printer;
use Plack::Runner;
# Run application.
my $app = Plack::App::Data::Printer->new(
'data' => {
'example' => [1, 2, {
'foo' => 'bar',
}, 5],
},
)->to_app;
Plack::Runner->new->run($app);
# Output:
# HTTP::Server::PSGI: Accepting connections at http://0:5000/
# > curl http://localhost:5000/
# {
# example [
# [0] 1,
# [1] 2,
# [2] {
# foo "bar"
# },
# [3] 5
# ]
# }
DEPENDENCIES
Data::Printer, Error::Pure, Plack::Component, Plack::Util::Accessor.
REPOSITORY
<https://github.com/michal-josef-spacek/Plack-App-Data-Printer>
AUTHOR
Michal Josef Špaček <mailto:skim@cpan.org>
<http://skim.cz>
LICENSE AND COPYRIGHT
© 2022 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.05