From Fedora Project Wiki

(add first runthrough of table)
(add examples to Mo*se "with")
 
(11 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 Flaws=
== Current Status ==


= Needed =
<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.


# Understands "use base", "use parent", etc, constructs.
It's time for new autoprov/req scripts.
# Understands [[Moose]]
## "extends" - subclassing
## "with" - roles
## "metaclass" - metaclasses
## "traits" - metaclass roles
# Understands [[Catalyst]] plugin speficication syntax
#* This should be extensible to other module classes
# Doesn't generate duplicates.  e.g.: perl(Foo) and perl(Foo) >= 1.9
# Better able to deal with the wonders of Perl versioning; e.g.
#* 1.20a stays 1.20a
#* 1.20 becomes 1.020000 (version triplet)


= Questions =
== Questions ==


# Should we attempt to compile? (a la <code>perl -wc</code> or {{CPAN|Module::ScanDeps}})
#* PROS: highly accurate
#* CONS: may fail for a variety of reasons
# Should we try to normalize the versions?
# Should we try to normalize the versions?


== Requirements ==
Apologies to those of us without widescreen monitors :)


{|
{|
|'''Requirement'''||'''Example'''||'''Current'''||'''Target'''||'''Compat?'''||'''Comment'''
|'''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>|| ||Need also to correctly evaluate <code>use parent ...</code>, etc.
perl(XXX)</pre>
|-
|-
|''No duplicate provides''|| || || || ||We often see duplicate requires.  These are harmless, except in the case where one requires is versioned and another unversioned.<br><br>This might need to be addressed at a higher level than perl.prov.
|''No duplicate provides''|| || ||
|-
|-
|Mo*se subclassing||<pre>extends 'Some::Class';</pre>|| ||<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';</pre>|| ||<pre>perl(Some::Class)</pre>|| ||
|''Mo*se roles''||<pre>with 'Some::Class';
 
# multiple roles at once
with 'Role::A', 'Role::B';</pre>||None.||<pre>perl(Some::Class)
 
perl(Role::A)
perl(Role::B)</pre>
|-
|-
|Mo*se traits||...in an attribute specification:<pre>...
|''Mo*se traits''||...in an attribute specification:<pre>...
traits => [ 'X', 'Y' ]</pre>|| ||<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>|| ||This is going to be tricky.
perl(Moose::Meta::Custom::Trait::Y)</pre>
|-
|-
|Mo*se metaclasses|| || || || ||
|''Mo*se metaclasses''|| || ||
|-
|-
|Catalyst and other plugin syntax|| || || || ||
|''Catalyst and other plugin syntax''||<pre>use Catalyst qw/
  -Debug
  ConfigLoader
  Static::Simple/;</pre>||<pre>perl(Catalyst)</pre>||<pre>perl(Catalyst)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::Static::Simple)</pre>
|-
|-
|Ability to include/exclude|| || || || ||
|''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 <code>use base</code> and <code>use parent</code> style constructs need to be recognized and handled.  (They're basically the same thing, anyways.)
{|
|-
|'''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>||
|}
=== Mo*se syntax ===
Both {{CPAN|Moose}} and {{CPAN|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'''
|-
|<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 ====
* Multiple classes can be specified
* 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 ====
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 <code>use</code> statements.
{|
|-
|'''Example'''||'''Current'''||'''Target'''||'''Comment'''
|-
|<pre>use Catalyst qw/
  -Debug
  ConfigLoader
  Static::Simple/;</pre>||<pre>perl(Catalyst)</pre>||<pre>
perl(Catalyst)
perl(Catalyst::Plugin::ConfigLoader)
perl(Catalyst::Plugin::Static::Simple)
</pre>||
|-
|}
[[Category:Perl]]

Latest revision as of 19:26, 21 February 2009

Warning.png
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)