Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awncorp/mojo-component
Module-based Component Renderer
https://github.com/awncorp/mojo-component
component mojo mojolicious perl perl5 templating
Last synced: 25 days ago
JSON representation
Module-based Component Renderer
- Host: GitHub
- URL: https://github.com/awncorp/mojo-component
- Owner: awncorp
- License: other
- Created: 2021-01-06T02:12:38.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-20T09:34:40.000Z (about 4 years ago)
- Last Synced: 2024-11-08T16:09:45.405Z (3 months ago)
- Topics: component, mojo, mojolicious, perl, perl5, templating
- Language: Perl
- Homepage: https://metacpan.org/release/Mojolicious-Plugin-Component
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGES
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
NAME
Mojolicious::Plugin::Component - Module-based Component Rendering
ABSTRACT
Module-based Component Rendering Plugin
SYNOPSIS
package App;
use Mojo::Base 'Mojolicious';
package App::Component::Image;
use Mojo::Base 'Mojolicious::Component';
has alt => 'random';
has height => 126;
has width => 145;
has src => '/random.gif';
1;
# __DATA__
#
# @@ component
#
#
package main;
my $app = App->new;
my $component = $app->plugin('component');
my $image = $app->component->use('image');
my $rendered = $image->render;DESCRIPTION
This package provides Mojolicious module-based component rendering
plugin.INHERITS
This package inherits behaviors from:
Mojolicious::Plugin
METHODS
This package implements the following methods:
register
register(InstanceOf["Mojolicious"] $app, Maybe[HashRef] $config) : Object
The register method registers one or more component builders in the
Mojolicious application. The configuration information can be provided
when registering the plugin by calling plugin during setup, or by
specifying the data in the application configuration under the key
component. By default, if no configuration information is provided the
plugin will register a builder labeled use which will load components
under the application's Component namespace.register example #1
package main;
use Mojolicious::Plugin::Component;
my $app = Mojolicious->new;
my $component = Mojolicious::Plugin::Component->new;
$component = $component->register($app);register example #2
package main;
use Mojolicious::Plugin::Component;
my $app = Mojolicious->new;
my $component = Mojolicious::Plugin::Component->new;
$component = $component->register($app, {
v1 => 'App::V1::Component',
v2 => 'App::V2::Component',
});
# my $v1 = $app->component->v1('image');
# my $v2 = $app->component->v2('image');register example #3
package main;
use Mojolicious::Plugin::Component;
my $app = Mojolicious->new;
my $component = Mojolicious::Plugin::Component->new;
$component = $component->register($app, {
v1 => 'App::V1::Component',
v2 => 'App::V2::Component',
});
# my $v1 = $app->component->v1('image' => (
# src => '/random-v1.gif',
# ));
# my $v2 = $app->component->v2('image' => (
# src => '/random-v2.gif',
# ));AUTHOR
Al Newkirk, [email protected]
LICENSE
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under
the terms of the The Apache License, Version 2.0, as elucidated in the
"license file"
.PROJECT
Wiki
Project
Initiatives
Milestones
Contributing
Issues