2011-05-03 06:05:34 +00:00
|
|
|
#
|
2012-05-30 07:56:03 +00:00
|
|
|
# spec file for package perl-B-Generate
|
2011-05-03 06:05:34 +00:00
|
|
|
#
|
2024-07-16 21:21:28 +00:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2011-05-03 06:05:34 +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.
|
|
|
|
|
2024-07-16 21:21:28 +00:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2011-05-03 06:05:34 +00:00
|
|
|
#
|
|
|
|
|
2012-05-30 07:56:03 +00:00
|
|
|
|
2024-07-16 21:21:28 +00:00
|
|
|
%define cpan_name B-Generate
|
2011-05-03 06:05:34 +00:00
|
|
|
Name: perl-B-Generate
|
2024-07-16 21:21:28 +00:00
|
|
|
Version: 1.560.0
|
2012-05-30 07:56:03 +00:00
|
|
|
Release: 0
|
2024-07-16 21:21:28 +00:00
|
|
|
# 1.56 -> normalize -> 1.560.0
|
|
|
|
%define cpan_version 1.56
|
2015-04-17 17:40:13 +00:00
|
|
|
#Upstream: This module is available under the same licences as perl, the Artistic license and the GPL.
|
2024-07-16 21:21:28 +00:00
|
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
2015-04-17 17:40:13 +00:00
|
|
|
Summary: Create your own op trees
|
2024-07-16 21:21:28 +00:00
|
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
|
|
Source0: https://cpan.metacpan.org/authors/id/R/RU/RURBAN/%{cpan_name}-%{cpan_version}.tar.gz
|
2015-04-17 17:40:13 +00:00
|
|
|
Source1: cpanspec.yml
|
2025-08-12 18:11:56 +02:00
|
|
|
Source100: README.md
|
2011-05-03 06:05:34 +00:00
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
|
|
|
BuildRequires: perl(ExtUtils::CBuilder)
|
|
|
|
Requires: perl(ExtUtils::CBuilder)
|
2024-07-16 21:21:28 +00:00
|
|
|
Provides: perl(B::Generate) = %{version}
|
|
|
|
%undefine __perllib_provides
|
2011-05-03 06:05:34 +00:00
|
|
|
%{perl_requires}
|
|
|
|
|
|
|
|
%description
|
2012-05-30 07:56:03 +00:00
|
|
|
The 'B' module allows you to examine the Perl op tree at runtime, in Perl
|
|
|
|
space; it's the basis of the Perl compiler. But what it doesn't let you do
|
|
|
|
is manipulate that op tree: it won't let you create new ops, or modify old
|
|
|
|
ones. Now you can.
|
2011-05-03 06:05:34 +00:00
|
|
|
|
|
|
|
Well, if you're intimately familiar with Perl's internals, you can.
|
|
|
|
|
|
|
|
'B::Generate' turns 'B''s accessor methods into get-set methods. Hence,
|
|
|
|
instead of merely saying
|
|
|
|
|
|
|
|
$op2 = $op->next;
|
|
|
|
|
|
|
|
you can now say
|
|
|
|
|
|
|
|
$op->next($op2);
|
|
|
|
|
|
|
|
to set the next op in the chain. It also adds constructor methods to create
|
|
|
|
new ops. This is where it gets really hairy.
|
|
|
|
|
|
|
|
new B::OP ( type, flags )
|
|
|
|
new B::UNOP ( type, flags, first )
|
|
|
|
new B::BINOP ( type, flags, first, last )
|
|
|
|
new B::LOGOP ( type, flags, first, other )
|
|
|
|
new B::LISTOP ( type, flags, first, last )
|
2012-05-30 07:56:03 +00:00
|
|
|
new B::SVOP ( type, flags, sv )
|
2011-05-03 06:05:34 +00:00
|
|
|
new B::COP ( flags, name, first )
|
|
|
|
|
|
|
|
In all of the above constructors, 'type' is either a numeric value
|
2012-05-30 07:56:03 +00:00
|
|
|
representing the op type ('62' is the addition operator in certain perl
|
|
|
|
versions, for instance) or the name of the op. ('"add"')
|
2011-05-03 06:05:34 +00:00
|
|
|
|
2012-05-30 07:56:03 +00:00
|
|
|
Incidentally, if you know about custom ops and have registed them properly
|
2011-05-03 06:05:34 +00:00
|
|
|
with the interpreter, you can create custom ops by name: 'new
|
2012-05-30 07:56:03 +00:00
|
|
|
B::OP("mycustomop",0)', or whatever.
|
2011-05-03 06:05:34 +00:00
|
|
|
|
|
|
|
'first', 'last' and 'other' are ops to be attached to the current op; these
|
|
|
|
should be 'B::OP' objects. If you haven't created the ops yet, don't worry;
|
|
|
|
give a false value, and fill them in later:
|
|
|
|
|
|
|
|
$x = new B::UNOP("negate", 0, undef);
|
|
|
|
# ... create some more ops ...
|
|
|
|
$x->first($y);
|
|
|
|
|
|
|
|
In addition, one may create a new 'nextstate' operator with
|
|
|
|
|
|
|
|
newstate B::op ( flags, label, op)
|
|
|
|
|
|
|
|
in the same manner as 'B::COP::new' - this will also, however, add the
|
|
|
|
'lineseq' op.
|
|
|
|
|
|
|
|
Finally, you can set the main root and the starting op by passing ops to
|
|
|
|
the 'B::main_root' and 'B::main_start' functions.
|
|
|
|
|
|
|
|
This module can obviously be used for all sorts of fun and optimizational
|
|
|
|
purposes. One example will be in conjuction with source filters; have your
|
|
|
|
source filter parse an input file in a foreign language, create an op tree
|
|
|
|
for it and get Perl to execute it. Then email me and tell me how you did
|
|
|
|
it. And why.
|
|
|
|
|
|
|
|
%prep
|
2024-07-16 21:21:28 +00:00
|
|
|
%autosetup -n %{cpan_name}-%{cpan_version}
|
2011-05-03 06:05:34 +00:00
|
|
|
|
|
|
|
%build
|
2024-07-16 21:21:28 +00:00
|
|
|
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
|
|
|
|
%make_build
|
2011-05-03 06:05:34 +00:00
|
|
|
|
|
|
|
%check
|
2024-07-16 21:21:28 +00:00
|
|
|
make test
|
2011-05-03 06:05:34 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
|
|
|
%perl_process_packlist
|
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
2017-02-28 14:21:21 +00:00
|
|
|
%doc Changes README
|
|
|
|
%license Artistic Copying
|
2011-05-03 06:05:34 +00:00
|
|
|
|
|
|
|
%changelog
|