Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michal-josef-spacek/plack-app-directory-pyx
Plack PYX directory application.
https://github.com/michal-josef-spacek/plack-app-directory-pyx
plack-app
Last synced: 17 days ago
JSON representation
Plack PYX directory application.
- Host: GitHub
- URL: https://github.com/michal-josef-spacek/plack-app-directory-pyx
- Owner: michal-josef-spacek
- License: bsd-2-clause
- Created: 2020-04-29T23:31:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-21T22:31:26.000Z (over 1 year ago)
- Last Synced: 2024-05-02T01:28:37.482Z (9 months ago)
- Topics: plack-app
- Language: Perl
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
NAME
Plack::App::Directory::PYX - Plack PYX directory application.SYNOPSIS
use Plack::App::Directory::PYX;my $obj = Plack::App::Directory::PYX->new(%parameters);
my $psgi_ar = $obj->serve_path($env, $path_to_file_or_dir);
my $app = $obj->to_app;METHODS
"new"
my $obj = Plack::App::Directory::PYX->new(%parameters);Constructor.
Returns instance of object.
* "indent"
Set Tags::Output::* class for output serialization.
Default value is Tags::Output::Raw.
"serve_path"
my $psgi_ar = $obj->serve_path($env, $path_to_file_or_dir);Process file or directory on disk and serve it to application.
Returns reference to array (PSGI structure).
"to_app"
my $app = $obj->to_app;Creates Plack application.
Returns Plack::Component object.
EXAMPLE1
use strict;
use warnings;use File::Temp;
use IO::Barf;
use Plack::App::Directory::PYX;
use Plack::Runner;# Temporary file with PYX.
my $temp_pyx_file = File::Temp->new->filename;# PYX file.
my $pyx = <<'END';
(html
(head
(title
-Title
)title
)head
(body
(div
-Hello world
)div
)body
)html
END
barf($temp_pyx_file, $pyx);# Run application with one PYX file.
my $app = Plack::App::Directory::PYX->new('file' => $temp_pyx_file)->to_app;
Plack::Runner->new->run($app);# Output:
# HTTP::Server::PSGI: Accepting connections at http://0:5000/# > curl http://localhost:5000/
# TitleHello worldEXAMPLE2
use strict;
use warnings;use File::Temp;
use IO::Barf;
use Plack::App::Directory::PYX;
use Plack::Runner;# Temporary file with PYX.
my $temp_pyx_file = File::Temp->new->filename;# PYX file.
my $pyx = <<'END';
(html
(head
(title
-Title
)title
)head
(body
(div
-Hello world
)div
)body
)html
END
barf($temp_pyx_file, $pyx);# Run application with one PYX file.
my $app = Plack::App::Directory::PYX->new(
'file' => $temp_pyx_file,
'indent' => 'Tags::Output::Indent',
)->to_app;
Plack::Runner->new->run($app);# Output:
# HTTP::Server::PSGI: Accepting connections at http://0:5000/# > curl http://localhost:5000/
#
#
#
# Title
#
#
#
#
# Hello world
#
#
#DEPENDENCIES
English, Error::Pure, Plack::App::Directory, Plack::Util::Accessor,
PYX::SGML::Tags, Tags::Output::Raw, Unicode::UTF8,REPOSITORY
AUTHOR
Michal Josef Špaček
LICENSE AND COPYRIGHT
© 2016-2022 Michal Josef ŠpačekBSD 2-Clause License
VERSION
0.06