Files
perl-Module-Extract-Namespaces/perl-Module-Extract-Namespaces.spec

143 lines
4.3 KiB
RPMSpec

#
# spec file for package perl-Module-Extract-Namespaces
#
# Copyright (c) 2011 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-Module-Extract-Namespaces
Version: 0.14
Release: 1
License: GPL+ or Artistic
%define cpan_name Module-Extract-Namespaces
Summary: extract the package declarations from a module
Url: http://search.cpan.org/dist/Module-Extract-Namespaces/
Group: Development/Libraries/Perl
#Source: http://www.cpan.org/authors/id/B/BD/BDFOY/Module-Extract-Namespaces-%{version}.tar.gz
Source: %{cpan_name}-%{version}.tar.gz
BuildRequires: perl(PPI)
BuildRequires: perl
BuildRequires: perl-macros
Requires: perl(PPI)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%{perl_requires}
%description
This module extracts package declarations from Perl code without running
the code.
It does not extract:
* * packages declared dynamically (e.g. in 'eval')
* * packages created as part of a fully qualified variable name
Class methods
* from_module( MODULE )
****NOT YET IMPLEMENTED****
Extract the namespaces declared in MODULE. In list context, it
returns all of the namespaces, including possible duplicates. In
scalar context it returns the first declared namespace.
If it cannot find MODULE in @INC, it returns undef in scalar context
and the empty list in list context.
On failure it returns nothing, but you have to check with 'error' to
see if that is really an error or a file with no namespaces in it.
* from_file( FILENAME )
Extract the namespaces declared in FILENAME. In list context, it
returns all of the namespaces, including possible duplicates. In
scalar context it returns the first declared namespace.
If FILENAME does not exist, it returns undef in scalar context and
the empty list in list context.
On failure it returns nothing, but you have to check with 'error' to
see if that is really an error or a file with no namespaces in it.
Subclassable hooks
* $class->pdom_base_class()
Return the base class for the PDOM. This is 'PPI' by default. If you
want to use something else, you'll have to change all the other PDOM
methods to adapt to the different interface.
This is the class name to use with 'require' to load the module that
while handle the parsing.
* $class->pdom_document_class()
Return the class name to use to create the PDOM object. This is
'PPI::Document'.
* get_pdom( FILENAME )
Creates the PDOM from FILENAME. This depends on calls to
'pdom_base_class' and 'pdom_document_class'.
* $class->pdom_preprocess( PDOM )
Override this method to play with the PDOM before extracting the
package declarations.
By default, it strips Pod and comments from the PDOM.
* $class->pdom_strip_pod( PDOM )
Strips Pod documentation from the PDOM.
* $class->pdom_strip_comments( PDOM )
Strips comments from the PDOM.
* $class->get_namespaces_from_pdom( PDOM )
Extract the namespaces from the PDOM. It returns a list of package
names in the order that it finds them in the PDOM. It does not remove
duplicates (do that later if you like).
* $class->error
Return the error from the last call to 'get_modules'.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%clean
%{__rm} -rf %{buildroot}
%files -f %{name}.files
%defattr(644,root,root,755)
%doc Changes LICENSE README
%changelog