Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michal-josef-spacek/plack-app-data-printer
Plack Data::Printer application.
https://github.com/michal-josef-spacek/plack-app-data-printer
plack-app
Last synced: 29 days ago
JSON representation
Plack Data::Printer application.
- Host: GitHub
- URL: https://github.com/michal-josef-spacek/plack-app-data-printer
- Owner: michal-josef-spacek
- License: bsd-2-clause
- Created: 2022-04-06T22:58:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-26T11:00:01.000Z (over 1 year ago)
- Last Synced: 2024-05-02T01:28:37.589Z (9 months ago)
- Topics: plack-app
- Language: Perl
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
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
AUTHOR
Michal Josef Špaček
LICENSE AND COPYRIGHT
© 2022 Michal Josef ŠpačekBSD 2-Clause License
VERSION
0.05