From Fedora Project Wiki

(add examples to Mo*se "with")
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Brain dump.  Comments welcome and appreciated, on the talk page.
{{admon/warning|This page is being actively worked on!|The contents of this page are still evolving, and likely to changePlease make any comments on the talk page, or on the fedora-perl-devel list.}}
Comments welcome and appreciated, on the talk page.


= Current Status =
== Current Status ==


<code>rpmbuild</code> has been able to automatically generate [[Perl]] requires and provides for some time now.  In most cases, it works just fine, but in many cases it fails us, and we end up having to filter them.  There have also been significant advances in Perl since the autoprov/req scripts were written, resulting in language constructs that are simply not recognized.  (Moose and other metaclass-oriented frameworks are a great example of this).  This has resulted in a disproportionately large percentage of Perl packages in Fedora having some sort of wrapper around the autoprov/req scripts.
<code>rpmbuild</code> has been able to automatically generate [[Perl]] requires and provides for some time now.  In most cases, it works just fine, but in many cases it fails us, and we end up having to filter them.  There have also been significant advances in Perl since the autoprov/req scripts were written, resulting in language constructs that are simply not recognized.  (Moose and other metaclass-oriented frameworks are a great example of this).  This has resulted in a disproportionately large percentage of Perl packages in Fedora having some sort of wrapper around the autoprov/req scripts.
Line 7: Line 8:
It's time for new autoprov/req scripts.
It's time for new autoprov/req scripts.


= Questions =
== Questions ==


# Should we try to normalize the versions?
# Should we try to normalize the versions?
Line 16: Line 17:


{|
{|
|'''Requirement'''||'''Example'''||'''Current Auto-Reqs'''||'''Target Auto-Reqs'''||'''Compat?'''
|'''Requirement'''||'''Brief Example'''||'''Current Auto-Reqs'''||'''Target Auto-Reqs'''
|-
|-
|''<code>use base</code> constructs correctly evaluated''||<pre>use base 'XXX';</pre>||<pre>perl(base)</pre>||<pre>perl(base)
|''<code>use base</code> constructs correctly evaluated''||<pre>use base 'XXX';</pre>||<pre>perl(base)</pre>||<pre>perl(base)
perl(XXX)</pre>||
perl(XXX)</pre>
|-
|-
|''No duplicate provides''|| || || ||  
|''No duplicate provides''|| || ||
|-
|-
|''Mo*se subclassing''||<pre>extends 'Some::Class';</pre>||None.||<pre>perl(Some::Class)</pre>||
|''Mo*se subclassing''||<pre>extends 'Some::Class';</pre>||None.||<pre>perl(Some::Class)</pre>
|-
|-
|''Mo*se roles''||<pre>with 'Some::Class';
|''Mo*se roles''||<pre>with 'Some::Class';
Line 31: Line 32:


perl(Role::A)
perl(Role::A)
perl(Role::B)</pre>||
perl(Role::B)</pre>
|-
|-
|''Mo*se traits''||...in an attribute specification:<pre>...
|''Mo*se traits''||...in an attribute specification:<pre>...
traits => [ 'X', 'Y' ]</pre>||None.||<pre>perl(Moose::Meta::Custom::Trait::X)
traits => [ 'X', 'Y' ]</pre>||None.||<pre>perl(Moose::Meta::Custom::Trait::X)
perl(Moose::Meta::Custom::Trait::Y)</pre>||
perl(Moose::Meta::Custom::Trait::Y)</pre>
|-
|-
|''Mo*se metaclasses''|| || || ||
|''Mo*se metaclasses''|| || ||
|-
|-
|''Catalyst and other plugin syntax''||<pre>use Catalyst qw/
|''Catalyst and other plugin syntax''||<pre>use Catalyst qw/
   -Debug  
   -Debug
   ConfigLoader  
   ConfigLoader
   Static::Simple/;</pre>||<pre>perl(Catalyst)</pre>||<pre>
   Static::Simple/;</pre>||<pre>perl(Catalyst)</pre>||<pre>perl(Catalyst)
perl(Catalyst)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::Static::Simple)
perl(Catalyst::Plugin::Static::Simple)</pre>
</pre>||
|-
|-
|''Ability to include/exclude''|| || || ||
|''Ability to exclude auto-generated requires w/o filtering''|| || ||
|}
|}


Line 63: Line 62:
{|
{|
|-
|-
|'''Example'''||'''Current'''||'''Target'''||'''Compat?'''||'''Comment'''
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|<pre>use base 'XXX';</pre>||<pre>perl(base)</pre>||<pre>perl(base)
perl(XXX)</pre>||
|-
|-
|<pre>use parent 'XXX';</pre>||<pre>perl(parent)</pre>||<pre>perl(parent)
perl(XXX)</pre>||
|}
|}


Line 75: Line 79:
* Multiple classes can be specified
* Multiple classes can be specified
* not possible to specify version with this syntax
* not possible to specify version with this syntax
{|
|-
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|<pre>extends 'Foo';</pre>||None.||<pre>perl(Foo)</pre>||
|-
|<pre>extends 'Foo', 'Bar', 'Baz';</pre>||None||<pre>perl(Foo)
perl(Bar)
perl(Baz)</pre>||
|-
|}


==== with ====
==== with ====
Line 80: Line 96:
* Multiple classes can be specified
* Multiple classes can be specified
* not possible to specify version with this syntax
* not possible to specify version with this syntax
{|
|-
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|<pre>with 'Foo::Role';</pre>||None.||<pre>perl(Foo::Role)</pre>||
|-
|<pre>with 'Foo::Role', 'Bar', 'Baz';</pre>||None||<pre>perl(Foo::Role)
perl(Bar)
perl(Baz)</pre>||
|-
|}


==== metaclasses ====
==== metaclasses ====
Line 87: Line 115:
{|
{|
|-
|-
|'''Example'''||'''Current'''||'''Target'''||'''Compat?'''||'''Comment'''
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|-
|}
|}
Line 97: Line 125:
{|
{|
|-
|-
|'''Example'''||'''Current'''||'''Target'''||'''Compat?'''||'''Comment'''
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|-
|}
|}
Line 107: Line 135:
{|
{|
|-
|-
|'''Example'''||'''Current'''||'''Target'''||'''Compat?'''||'''Comment'''
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|-
|<pre>use Catalyst qw/
|<pre>use Catalyst qw/
Line 116: Line 144:
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::Static::Simple)
perl(Catalyst::Plugin::Static::Simple)
</pre>|| ||Note that it is quite common for a [[Catalyst]] app to have a multi-line "use Catalyst" statement; we need to be able to deal with multi-line
</pre>||
|-
|-
|}
|}
[[Category:Perl]]

Latest revision as of 19:26, 21 February 2009

This page is being actively worked on!
The contents of this page are still evolving, and likely to change. Please make any comments on the talk page, or on the fedora-perl-devel list.

Comments welcome and appreciated, on the talk page.

Current Status

rpmbuild has been able to automatically generate Perl requires and provides for some time now. In most cases, it works just fine, but in many cases it fails us, and we end up having to filter them. There have also been significant advances in Perl since the autoprov/req scripts were written, resulting in language constructs that are simply not recognized. (Moose and other metaclass-oriented frameworks are a great example of this). This has resulted in a disproportionately large percentage of Perl packages in Fedora having some sort of wrapper around the autoprov/req scripts.

It's time for new autoprov/req scripts.

Questions

  1. Should we try to normalize the versions?

Requirements

Apologies to those of us without widescreen monitors :)

Requirement Brief Example Current Auto-Reqs Target Auto-Reqs
use base constructs correctly evaluated
use base 'XXX';
perl(base)
perl(base)
perl(XXX)
No duplicate provides
Mo*se subclassing
extends 'Some::Class';
None.
perl(Some::Class)
Mo*se roles
with 'Some::Class';

# multiple roles at once
with 'Role::A', 'Role::B';
None.
perl(Some::Class)

perl(Role::A)
perl(Role::B)
Mo*se traits ...in an attribute specification:
...
traits => [ 'X', 'Y' ]
None.
perl(Moose::Meta::Custom::Trait::X)
perl(Moose::Meta::Custom::Trait::Y)
Mo*se metaclasses
Catalyst and other plugin syntax
use Catalyst qw/
  -Debug
  ConfigLoader
  Static::Simple/;
perl(Catalyst)
perl(Catalyst)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::Static::Simple)
Ability to exclude auto-generated requires w/o filtering

No duplicate requires

We often see duplicate requires. These are harmless, except in the case where one requires is versioned and another unversioned.

This might need to be addressed at a higher level than perl.prov... Maybe some sort of RPM-level Lua script? (see, e.g. RPM_scripting_with_Lua)

use base syntax

Both use base and use parent style constructs need to be recognized and handled. (They're basically the same thing, anyways.)

Example Current Target Comment
use base 'XXX';
perl(base)
perl(base)
perl(XXX)
use parent 'XXX';
perl(parent)
perl(parent)
perl(XXX)

Mo*se syntax

Both Moose and Mouse have similar subclassing and roles syntax; only Moose has metaclasses and traits (metaclass roles).

extends

  • Multiple classes can be specified
  • not possible to specify version with this syntax
Example Current Target Comment
extends 'Foo';
None.
perl(Foo)
extends 'Foo', 'Bar', 'Baz';
None
perl(Foo)
perl(Bar)
perl(Baz)

with

  • Multiple classes can be specified
  • not possible to specify version with this syntax
Example Current Target Comment
with 'Foo::Role';
None.
perl(Foo::Role)
with 'Foo::Role', 'Bar', 'Baz';
None
perl(Foo::Role)
perl(Bar)
perl(Baz)

metaclasses

Class, attribute, methods.

Example Current Target Comment

traits

Class, attribute, methods.

Example Current Target Comment

Catalyst and other plugin syntax

Note that it is quite common for a Catalyst app to have a multi-line "use Catalyst" statement; we need to be able to deal with multi-line use statements.

Example Current Target Comment
use Catalyst qw/
  -Debug 
  ConfigLoader 
  Static::Simple/;
perl(Catalyst)
perl(Catalyst)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::Static::Simple)