NAME
Yeb - Yep! Yeb is for web! Yep Yep!
VERSION
version 0.003
SYNOPSIS
package MyApp::Web;
use Yeb;
BEGIN {
plugin 'Session';
plugin 'JSON';
}
r "/" => sub {
session->{test} = pa('test');
text "root";
};
r "/blub" => sub {
text "blub";
};
r "/test/..." => sub {
st->{stash_var} = 1;
chain 'Test';
};
1;
package MyApp::Web::Test;
use MyApp::Web;
r "/json" => sub {
json {
test => session->{test},
stash_var => st->{stash_var},
}
};
r "/" => sub {
text " test = ".session->{test}." and blub is ".st->{stash_var};
};
1;
Can then be started like (see Web::Simple):
plackup -MMyApp::Web -e'MyApp::Web->run_if_script'
Or a Text::Xslate example:
package MyApp::WebXslate;
use Yeb;
BEGIN {
plugin 'Session';
plugin 'JSON';
plugin 'Xslate';
}
xslate_path root('templates');
r "/" => sub {
st->{page} = 'root';
xslate 'index';
};
r "/test" => sub {
st->{page} = 'test';
xslate 'index/test', { extra_var => 'extra' };
};
1;
DESCRIPTION
FRAMEWORK FUNCTIONS
yeb
Gives back the Yeb::Application of the web application
chain
Return another class dispatcher chain, will be prepend with your main class name, this can be deactivated by using a + in front of the class name.
cfg
Access to the configuration hash
cc
Getting the current Yeb::Context of the request
env
Getting the Plack environment
req
Getting the current Plack::Request
root
Current directory or YEB_ROOT environment variable
cur
Current directory in the moment of start
plugin $yeb_plugin_name, { key => $value };
st
Access to the stash hash
pa
Access to the request parameters, gives back "" if is not set
has_pa
Check if some parameter is at all set
r
Adding a new dispatcher for this class (see Web::Simple)
middleware
Adding a Plack::Middleware to the flow
text
Make a simple text/plain response with the text given as parameter
SEE ALSO
* L<Yeb::Plugin::Session>
* L<Yeb::Plugin::Xslate>
* L<Yeb::Plugin::JSON>
SUPPORT
IRC
Join #web-simple on irc.perl.org. Highlight Getty for fast reaction :).
Repository
http://github.com/Getty/p5-yeb
Pull request and additional contributors are welcome
Issue Tracker
http://github.com/Getty/p5-yeb/issues
AUTHOR
Torsten Raudssus <torsten@raudss.us>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.