134 lines
4.0 KiB
RPMSpec
134 lines
4.0 KiB
RPMSpec
![]() |
#
|
||
|
# spec file for package perl-CGI-Application-Plugin-Forward (Version 1.06)
|
||
|
#
|
||
|
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||
|
#
|
||
|
# All modifications and additions to the file contributed by third parties
|
||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||
|
# upon. The license for this file, and modifications and additions to the
|
||
|
# file, is the same license as for the pristine package itself (unless the
|
||
|
# license for the pristine package is not an Open Source License, in which
|
||
|
# case the license is the MIT License). An "Open Source License" is a
|
||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||
|
# published by the Open Source Initiative.
|
||
|
|
||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||
|
#
|
||
|
|
||
|
Name: perl-CGI-Application-Plugin-Forward
|
||
|
Version: 1.06
|
||
|
Release: 1
|
||
|
License: GPL+ or Artistic
|
||
|
%define cpan_name CGI-Application-Plugin-Forward
|
||
|
Summary: Pass control from one run mode to another
|
||
|
Url: http://search.cpan.org/dist/CGI-Application-Plugin-Forward/
|
||
|
Group: Development/Libraries/Perl
|
||
|
Source: http://www.cpan.org/authors/id/M/MG/MGRAHAM/%{cpan_name}-%{version}.tar.gz
|
||
|
BuildArch: noarch
|
||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||
|
BuildRequires: perl
|
||
|
BuildRequires: perl(Module::Build)
|
||
|
BuildRequires: perl-macros
|
||
|
BuildRequires: perl(CGI::Application)
|
||
|
BuildRequires: perl(Module::Build)
|
||
|
BuildRequires: perl(Test::More)
|
||
|
Requires: perl(CGI::Application)
|
||
|
Requires: perl(Test::More)
|
||
|
Recommends: perl(CGI::Application::Plugin::AutoRunmode)
|
||
|
%{perl_requires}
|
||
|
|
||
|
%description
|
||
|
The forward method passes control to another run mode and returns its
|
||
|
output. This is equivalent to calling '$self->$other_runmode', except that
|
||
|
the CGI::Application manpage's internal value of the current run mode is
|
||
|
updated.
|
||
|
|
||
|
This means that calling '$self->get_current_runmode' after calling
|
||
|
'forward' will return the name of the new run mode. This is useful for
|
||
|
modules that depend on the name of the current run mode such as the
|
||
|
CGI::Application::Plugin::AnyTemplate manpage.
|
||
|
|
||
|
For example, here's how to pass control to a run mode named 'other_action'
|
||
|
from 'start' while updating the value of 'current_run_mode':
|
||
|
|
||
|
sub setup {
|
||
|
my $self = shift;
|
||
|
$self->run_modes({
|
||
|
start => 'start',
|
||
|
other_action => 'other_method',
|
||
|
});
|
||
|
}
|
||
|
sub start {
|
||
|
my $self = shift;
|
||
|
return $self->forward('other_action');
|
||
|
}
|
||
|
sub other_method {
|
||
|
my $self = shift;
|
||
|
|
||
|
my $rm = $self->get_current_runmode; # 'other_action'
|
||
|
}
|
||
|
|
||
|
Note that forward accepts the _name_ of the run mode (in this case
|
||
|
_'other_action'_), which might not be the same as the name of the method
|
||
|
that handles the run mode (in this case _'other_method'_)
|
||
|
|
||
|
You can still call '$self->other_method' directly, but 'current_run_mode'
|
||
|
will not be updated:
|
||
|
|
||
|
sub setup {
|
||
|
my $self = shift;
|
||
|
$self->run_modes({
|
||
|
start => 'start',
|
||
|
other_action => 'other_method',
|
||
|
});
|
||
|
}
|
||
|
sub start {
|
||
|
my $self = shift;
|
||
|
return $self->other_method;
|
||
|
}
|
||
|
sub other_method {
|
||
|
my $self = shift;
|
||
|
|
||
|
my $rm = $self->get_current_runmode; # 'start'
|
||
|
}
|
||
|
|
||
|
Forward will work with coderef-based runmodes as well:
|
||
|
|
||
|
sub setup {
|
||
|
my $self = shift;
|
||
|
$self->run_modes({
|
||
|
start => 'start',
|
||
|
anon_action => sub {
|
||
|
my $self = shift;
|
||
|
my $rm = $self->get_current_runmode; # 'anon_action'
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
sub start {
|
||
|
my $self = shift;
|
||
|
return $self->forward('anon_action');
|
||
|
}
|
||
|
|
||
|
%prep
|
||
|
%setup -q -n %{cpan_name}-%{version}
|
||
|
|
||
|
%build
|
||
|
%{__perl} Build.PL installdirs=vendor
|
||
|
./Build build flags=%{?_smp_mflags}
|
||
|
|
||
|
%check
|
||
|
./Build test
|
||
|
|
||
|
%install
|
||
|
./Build install destdir=%{buildroot} create_packlist=0
|
||
|
%perl_gen_filelist
|
||
|
|
||
|
%clean
|
||
|
%{__rm} -rf %{buildroot}
|
||
|
|
||
|
%files -f %{name}.files
|
||
|
%defattr(-,root,root,755)
|
||
|
%doc Changes README
|
||
|
|
||
|
%changelog
|