2010-04-29 14:44:44 +00:00
|
|
|
#
|
2011-11-18 11:34:45 +00:00
|
|
|
# spec file for package perl-Perl-Tidy
|
2010-04-29 14:44:44 +00:00
|
|
|
#
|
2015-08-23 14:13:26 +00:00
|
|
|
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
2010-04-29 14:44:44 +00:00
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
|
2010-10-13 23:13:00 +00:00
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
|
#
|
|
|
|
|
|
2010-12-19 13:07:54 +00:00
|
|
|
|
2010-10-13 23:13:00 +00:00
|
|
|
Name: perl-Perl-Tidy
|
2015-08-23 14:13:26 +00:00
|
|
|
Version: 20150815
|
2013-07-27 12:44:22 +00:00
|
|
|
Release: 0
|
2010-10-13 23:13:00 +00:00
|
|
|
%define cpan_name Perl-Tidy
|
|
|
|
|
Summary: Parses and beautifies perl source
|
2015-08-23 14:13:26 +00:00
|
|
|
License: This package is free software and you can redistribute it and/or modify it under the terms of the "GNU General Public License". Please refer to the file "COPYING" for details.
|
2010-10-13 23:13:00 +00:00
|
|
|
Group: Development/Libraries/Perl
|
|
|
|
|
Url: http://search.cpan.org/dist/Perl-Tidy/
|
2015-08-23 14:13:26 +00:00
|
|
|
Source0: http://www.cpan.org/authors/id/S/SH/SHANCOCK/%{cpan_name}-%{version}.tar.gz
|
|
|
|
|
Source1: cpanspec.yml
|
2010-10-13 23:13:00 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
|
BuildRequires: perl
|
|
|
|
|
BuildRequires: perl-macros
|
2013-07-27 12:44:22 +00:00
|
|
|
%{perl_requires}
|
2010-04-29 14:44:44 +00:00
|
|
|
|
|
|
|
|
%description
|
2010-10-13 23:13:00 +00:00
|
|
|
This module makes the functionality of the perltidy utility available to
|
|
|
|
|
perl scripts. Any or all of the input parameters may be omitted, in which
|
|
|
|
|
case the @ARGV array will be used to provide input parameters as described
|
|
|
|
|
in the perltidy(1) man page.
|
2010-04-29 14:44:44 +00:00
|
|
|
|
2013-07-27 12:44:22 +00:00
|
|
|
For example, the perltidy script is basically just this:
|
|
|
|
|
|
|
|
|
|
use Perl::Tidy;
|
|
|
|
|
Perl::Tidy::perltidy();
|
|
|
|
|
|
|
|
|
|
The call to *perltidy* returns a scalar *$error_flag* which is TRUE if an
|
|
|
|
|
error caused premature termination, and FALSE if the process ran to normal
|
|
|
|
|
completion. Additional discuss of errors is contained below in the the
|
|
|
|
|
ERROR HANDLING manpage section.
|
|
|
|
|
|
2015-08-23 14:13:26 +00:00
|
|
|
The module accepts input and output streams by a variety of methods. The
|
|
|
|
|
following list of parameters may be any of the following: a filename, an
|
|
|
|
|
ARRAY reference, a SCALAR reference, or an object with either a *getline*
|
|
|
|
|
or *print* method, as appropriate.
|
|
|
|
|
|
|
|
|
|
source - the source of the script to be formatted
|
|
|
|
|
destination - the destination of the formatted output
|
|
|
|
|
stderr - standard error output
|
|
|
|
|
perltidyrc - the .perltidyrc file
|
|
|
|
|
logfile - the .LOG file stream, if any
|
|
|
|
|
errorfile - the .ERR file stream, if any
|
|
|
|
|
dump_options - ref to a hash to receive parameters (see below),
|
|
|
|
|
dump_options_type - controls contents of dump_options
|
|
|
|
|
dump_getopt_flags - ref to a hash to receive Getopt flags
|
|
|
|
|
dump_options_category - ref to a hash giving category of options
|
|
|
|
|
dump_abbreviations - ref to a hash giving all abbreviations
|
|
|
|
|
|
|
|
|
|
The following chart illustrates the logic used to decide how to treat a
|
|
|
|
|
parameter.
|
|
|
|
|
|
|
|
|
|
ref($param) $param is assumed to be:
|
|
|
|
|
----------- ---------------------
|
|
|
|
|
undef a filename
|
|
|
|
|
SCALAR ref to string
|
|
|
|
|
ARRAY ref to array
|
|
|
|
|
(other) object with getline (if source) or print method
|
|
|
|
|
|
|
|
|
|
If the parameter is an object, and the object has a *close* method, that
|
|
|
|
|
close method will be called at the end of the stream.
|
|
|
|
|
|
|
|
|
|
* source
|
|
|
|
|
|
|
|
|
|
If the *source* parameter is given, it defines the source of the input
|
|
|
|
|
stream. If an input stream is defined with the *source* parameter then no
|
|
|
|
|
other source filenames may be specified in the @ARGV array or *argv*
|
|
|
|
|
parameter.
|
|
|
|
|
|
|
|
|
|
* destination
|
|
|
|
|
|
|
|
|
|
If the *destination* parameter is given, it will be used to define the
|
|
|
|
|
file or memory location to receive output of perltidy.
|
|
|
|
|
|
|
|
|
|
* stderr
|
|
|
|
|
|
|
|
|
|
The *stderr* parameter allows the calling program to redirect the stream
|
|
|
|
|
that would otherwise go to the standard error output device to any of the
|
|
|
|
|
stream types listed above. This stream contains important warnings and
|
|
|
|
|
errors related to the parameters passed to perltidy.
|
|
|
|
|
|
|
|
|
|
* perltidyrc
|
|
|
|
|
|
|
|
|
|
If the *perltidyrc* file is given, it will be used instead of any
|
|
|
|
|
_.perltidyrc_ configuration file that would otherwise be used.
|
|
|
|
|
|
|
|
|
|
* errorfile
|
|
|
|
|
|
|
|
|
|
The *errorfile* parameter allows the calling program to capture the
|
|
|
|
|
stream that would otherwise go to either a .ERR file. This stream
|
|
|
|
|
contains warnings or errors related to the contents of one source file or
|
|
|
|
|
stream.
|
|
|
|
|
|
|
|
|
|
The reason that this is different from the stderr stream is that when
|
|
|
|
|
perltidy is called to process multiple files there will be up to one .ERR
|
|
|
|
|
file created for each file and it would be very confusing if they were
|
|
|
|
|
combined.
|
|
|
|
|
|
|
|
|
|
However if perltidy is called to process just a single perl script then
|
|
|
|
|
it may be more convenient to combine the *errorfile* stream with the
|
|
|
|
|
*stderr* stream. This can be done by setting the *-se* parameter, in
|
|
|
|
|
which case this parameter is ignored.
|
|
|
|
|
|
|
|
|
|
* logfile
|
|
|
|
|
|
|
|
|
|
The *logfile* parameter allows the calling program to capture the log
|
|
|
|
|
stream. This stream is only created if requested with a *-g* parameter.
|
|
|
|
|
It contains detailed diagnostic information about a script which may be
|
|
|
|
|
useful for debugging.
|
|
|
|
|
|
|
|
|
|
* argv
|
|
|
|
|
|
|
|
|
|
If the *argv* parameter is given, it will be used instead of the *@ARGV*
|
|
|
|
|
array. The *argv* parameter may be a string, a reference to a string, or
|
|
|
|
|
a reference to an array. If it is a string or reference to a string, it
|
|
|
|
|
will be parsed into an array of items just as if it were a command line
|
|
|
|
|
string.
|
|
|
|
|
|
|
|
|
|
* dump_options
|
|
|
|
|
|
|
|
|
|
If the *dump_options* parameter is given, it must be the reference to a
|
|
|
|
|
hash. In this case, the parameters contained in any perltidyrc
|
|
|
|
|
configuration file will be placed in this hash and perltidy will return
|
|
|
|
|
immediately. This is equivalent to running perltidy with --dump-options,
|
|
|
|
|
except that the perameters are returned in a hash rather than dumped to
|
|
|
|
|
standard output. Also, by default only the parameters in the perltidyrc
|
|
|
|
|
file are returned, but this can be changed (see the next parameter). This
|
|
|
|
|
parameter provides a convenient method for external programs to read a
|
|
|
|
|
perltidyrc file. An example program using this feature,
|
|
|
|
|
_perltidyrc_dump.pl_, is included in the distribution.
|
|
|
|
|
|
|
|
|
|
Any combination of the *dump_* parameters may be used together.
|
|
|
|
|
|
|
|
|
|
* dump_options_type
|
|
|
|
|
|
|
|
|
|
This parameter is a string which can be used to control the parameters
|
|
|
|
|
placed in the hash reference supplied by *dump_options*. The possible
|
|
|
|
|
values are 'perltidyrc' (default) and 'full'. The 'full' parameter causes
|
|
|
|
|
both the default options plus any options found in a perltidyrc file to
|
|
|
|
|
be returned.
|
|
|
|
|
|
|
|
|
|
* dump_getopt_flags
|
|
|
|
|
|
|
|
|
|
If the *dump_getopt_flags* parameter is given, it must be the reference
|
|
|
|
|
to a hash. This hash will receive all of the parameters that perltidy
|
|
|
|
|
understands and flags that are passed to Getopt::Long. This parameter may
|
|
|
|
|
be used alone or with the *dump_options* flag. Perltidy will exit
|
|
|
|
|
immediately after filling this hash. See the demo program
|
|
|
|
|
_perltidyrc_dump.pl_ for example usage.
|
|
|
|
|
|
|
|
|
|
* dump_options_category
|
|
|
|
|
|
|
|
|
|
If the *dump_options_category* parameter is given, it must be the
|
|
|
|
|
reference to a hash. This hash will receive a hash with keys equal to all
|
|
|
|
|
long parameter names and values equal to the title of the corresponding
|
|
|
|
|
section of the perltidy manual. See the demo program _perltidyrc_dump.pl_
|
|
|
|
|
for example usage.
|
|
|
|
|
|
|
|
|
|
* dump_abbreviations
|
|
|
|
|
|
|
|
|
|
If the *dump_abbreviations* parameter is given, it must be the reference
|
|
|
|
|
to a hash. This hash will receive all abbreviations used by Perl::Tidy.
|
|
|
|
|
See the demo program _perltidyrc_dump.pl_ for example usage.
|
|
|
|
|
|
|
|
|
|
* prefilter
|
|
|
|
|
|
|
|
|
|
A code reference that will be applied to the source before tidying. It is
|
|
|
|
|
expected to take the full content as a string in its input, and output
|
|
|
|
|
the transformed content.
|
|
|
|
|
|
|
|
|
|
* postfilter
|
|
|
|
|
|
|
|
|
|
A code reference that will be applied to the tidied result before
|
|
|
|
|
outputting. It is expected to take the full content as a string in its
|
|
|
|
|
input, and output the transformed content.
|
|
|
|
|
|
|
|
|
|
Note: A convenient way to check the function of your custom prefilter and
|
|
|
|
|
postfilter code is to use the --notidy option, first with just the
|
|
|
|
|
prefilter and then with both the prefilter and postfilter. See also the
|
|
|
|
|
file *filter_example.pl* in the perltidy distribution.
|
|
|
|
|
|
2010-04-29 14:44:44 +00:00
|
|
|
%prep
|
2010-10-13 23:13:00 +00:00
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
2010-04-29 14:44:44 +00:00
|
|
|
|
|
|
|
|
%build
|
2010-10-13 23:13:00 +00:00
|
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
|
|
|
|
%{__make} %{?_smp_mflags}
|
2010-04-29 14:44:44 +00:00
|
|
|
|
|
|
|
|
%check
|
2010-10-13 23:13:00 +00:00
|
|
|
%{__make} test
|
2010-04-29 14:44:44 +00:00
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
%perl_make_install
|
2013-07-27 12:44:22 +00:00
|
|
|
%perl_process_packlist
|
2010-04-29 14:44:44 +00:00
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
2013-07-27 12:44:22 +00:00
|
|
|
%defattr(-,root,root,755)
|
2015-08-23 14:13:26 +00:00
|
|
|
%doc BUGS CHANGES COPYING docs examples Makefile.npm pm2pl README TODO
|
2010-04-29 14:44:44 +00:00
|
|
|
|
|
|
|
|
%changelog
|