Zapp::Util - General utilities for Zapp
version 0.005
Build a data structure from the parameters in the given request, optionally with the given prefix. Parameter names are paths in the resulting data structure.
# ?name.first=Turanga&name.last=Leela { name => { first => 'Turanga', last => 'Leela' } } # ?crew[0]=Fry&crew[1]=Leela&crew[2]=Zoidberg%20Why%20Not { crew => [ 'Fry', 'Leela', 'Zoidberg Why Not' ] } # ?[0].name=Hubert&[0].age=160&[1].name=Cubert&[1].age=12 [ { name => 'Hubert', age => 160 }, { name => 'Cubert', age => 12 } ]
Get a reference to the given path in the given data. Can be used to set values at paths.
Get the value for a given path out of the given data.
Get the schema for a given path out of the given JSON Schema. Will traverse object properties and array items to find the schema.
properties
items
Add a prefix to any field in the given HTML or Mojo::DOM object. Prefixes are added to the name and id attributes of any form inputs, and the for attribute of any labels.
name
id
for
Rename any form fields in the given HTML or Mojo::DOM object using the provided mapping. This changes the field name and id attributes, and also the corresponding label for attribute.
Parse special data-zapp attributes in the given HTML or Mojo::DOM object. These attributes add dynamic features to templates for Zapp::Task, Zapp::Type, or Zapp::Trigger.
data-zapp
Display this element if the given <expression> is true. The expression can contain string literals, data paths, and the following operators:
<expression>
== != > < >= <= eq ne gt lt ge le
If the expression is true, the element is given the zapp-visible class and will appear. Expressions are evaluated in Perl when rendering the template and in JavaScript when the user is modifying the form.
zapp-visible
Apply ANSI coloring and formatting to the given text. This is used to render output from a program that uses ANSI escape sequences.
my $html = ansi_colorize( $stdout );
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2021 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
To install Zapp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zapp
CPAN shell
perl -MCPAN -e shell install Zapp
For more information on module installation, please visit the detailed CPAN module installation guide.