Accepting request 332492 from devel:languages:perl:autoupdate
OBS-URL: https://build.opensuse.org/request/show/332492 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Text-MicroMason?expand=0&rev=5
This commit is contained in:
committed by
Git OBS Bridge
parent
de2e450cb8
commit
361b4767ac
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package perl-Text-MicroMason
|
||||
#
|
||||
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -16,27 +16,22 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
Name: perl-Text-MicroMason
|
||||
Version: 2.13
|
||||
Release: 1
|
||||
License: GPL+ or Artistic
|
||||
Version: 2.16
|
||||
Release: 0
|
||||
%define cpan_name Text-MicroMason
|
||||
Summary: Simple and Extensible Templating
|
||||
Url: http://search.cpan.org/dist/Text-MicroMason/
|
||||
License: Artistic-1.0 or GPL-1.0+
|
||||
Group: Development/Libraries/Perl
|
||||
#Source: http://www.cpan.org/authors/id/F/FE/FERRENCY/Text-MicroMason-%{version}.tar.gz
|
||||
Source: %{cpan_name}-%{version}.tar.gz
|
||||
BuildRequires: perl(Class::MixinFactory) >= 0.9
|
||||
BuildRequires: perl(Cwd) >= 2.21
|
||||
BuildRequires: perl(File::Spec) >= 0.9
|
||||
Url: http://search.cpan.org/dist/Text-MicroMason/
|
||||
Source0: http://www.cpan.org/authors/id/F/FE/FERRENCY/%{cpan_name}-%{version}.tar.gz
|
||||
Source1: cpanspec.yml
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: perl
|
||||
BuildRequires: perl-macros
|
||||
BuildRequires: perl(Class::MixinFactory) >= 0.9
|
||||
Requires: perl(Class::MixinFactory) >= 0.9
|
||||
Requires: perl(Cwd) >= 2.21
|
||||
Requires: perl(File::Spec) >= 0.9
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
%{perl_requires}
|
||||
|
||||
%description
|
||||
@@ -47,97 +42,6 @@ Each MicroMason object acts as a "template compiler," which converts
|
||||
templates from text-with-embedded-code formats into ready-to-execute Perl
|
||||
subroutines.
|
||||
|
||||
MicroMason Initialization
|
||||
Use the new() method to create a Text::MicroMason object with the
|
||||
appropriate mixins and attributes.
|
||||
|
||||
$mason = Text::MicroMason->new( %attribs );
|
||||
|
||||
You may pass attributes as key-value pairs to the new() method to save
|
||||
various options for later use by the compile() method.
|
||||
|
||||
Template Compilation
|
||||
To compile a text template, pass it to the compile() method to produce
|
||||
a new Perl subroutine to be returned as a code reference:
|
||||
|
||||
$code_ref = $mason->compile( $type => $source, %attribs );
|
||||
|
||||
Any attributes provided to compile() will temporarily override the
|
||||
persistent options defined by new(), for that template only.
|
||||
|
||||
You can provide the template as a text string, a file name, or an open
|
||||
file handle:
|
||||
|
||||
$code_ref = $mason->compile( text => $template );
|
||||
$code_ref = $mason->compile( text => \$template );
|
||||
$code_ref = $mason->compile( file => $filename );
|
||||
$code_ref = $mason->compile( handle => $fh );
|
||||
$code_ref = $mason->compile( handle => \*FILE );
|
||||
|
||||
Template files are just plain text files that contains the string to be
|
||||
parsed. The files may have any name and extension you wish. The
|
||||
filename specified can either be absolute or relative to the program's
|
||||
current directory.
|
||||
|
||||
Template Execution
|
||||
To execute the template and obtain the output, call a compiled
|
||||
function:
|
||||
|
||||
$result = $code_ref->( @arguments );
|
||||
|
||||
(Note that the $code_ref->() syntax is unavailable in older versions of
|
||||
Perl; use the equivalent &$code_ref() syntax instead.)
|
||||
|
||||
As a shortcut, the execute method compiles and runs the template one
|
||||
time:
|
||||
|
||||
$result = $mason->execute( $type => $source, @arguments );
|
||||
$result = $mason->execute( $type => $source, \%attribs, @arguments );
|
||||
|
||||
Argument Passing
|
||||
You can pass arguments to a template subroutine using positional or
|
||||
named arguments.
|
||||
|
||||
For positional arguments, pass the argument list and read from @_ as
|
||||
usual:
|
||||
|
||||
$mason->compile( text=>'Hello <% shift(@_) %>.' )->( 'Dave' );
|
||||
|
||||
For named arguments, pass in a hash of key-value pairs to be made
|
||||
accessible in an '%ARGS' hash within the template subroutine:
|
||||
|
||||
$mason->compile( text=>'Hello <% $ARGS{name} %>.' )->( name=>'Dave' );
|
||||
|
||||
Additionally, you can use named arguments with the %args block syntax:
|
||||
|
||||
$mason->compile( text=>'<%args>$name</%args>Hello <% $name %>.' )->( name=>'Dave' );
|
||||
|
||||
Mixin Selection
|
||||
Arguments passed to new() that begin with a dash will be added as mixin
|
||||
classes.
|
||||
|
||||
$mason = Text::MicroMason->new( -Mixin1, %attribs, -Mixin2 );
|
||||
|
||||
Every MicroMason object inherits from an abstract Base class and some
|
||||
set of mixin classes. By combining mixins you can create subclasses
|
||||
with the desired combination of features. See the
|
||||
Text::MicroMason::Base manpage for documentation of the base class,
|
||||
including private methods and extension mechanisms.
|
||||
|
||||
If you call the new method on Text::MicroMason, it automatically
|
||||
includes the HTMLMason mixin, which provides the standard template
|
||||
syntax. If you want to create an object without the default HTMLMason
|
||||
functionality, call Text::MicroMason::Base->new() instead.
|
||||
|
||||
Some mixins define the syntax for a particular template format. You
|
||||
will generally need to select one, and only one, of the mixins listed
|
||||
in the /"TEMPLATE SYNTAXES" manpage.
|
||||
|
||||
Other mixins provide optional functionality. Those mixins may define
|
||||
additional public methods, and may support or require values for
|
||||
various additional attributes. For a list of such mixin classes, see
|
||||
the /"MIXIN FEATURES" manpage.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{cpan_name}-%{version}
|
||||
|
||||
@@ -153,10 +57,8 @@ Mixin Selection
|
||||
%perl_process_packlist
|
||||
%perl_gen_filelist
|
||||
|
||||
%clean
|
||||
%{__rm} -rf %{buildroot}
|
||||
|
||||
%files -f %{name}.files
|
||||
%defattr(644,root,root,755)
|
||||
%defattr(-,root,root,755)
|
||||
%doc CHANGES README samples TODO
|
||||
|
||||
%changelog
|
||||
|
Reference in New Issue
Block a user