Hi folks

I'm presuming all of you have had a chance to read Rob's perl.com article.

http://www.perl.com/pub/a/2005/04/14/cpan_guidelines.html

I for one noticed a few interesting/odd points. :)

Firstly, I disagree with Rob's idea of excluding all operating systems until you get reports from users. Most of the time, 90% of people don't report. They just don't use the module.

Better in my mind to ship anyway, but make sure your tests relating to the filesystem are extra paranoid. That way modules just simply fail to install on unusual things like VMS.

But what I most wanted to speak about was minimum Perl versions for code, relating his Rob's "gotchas" stuff.

It should be possible (and it's been in the mental roadmap for a long time) to create with PPI a package that can tell you what the minimum version of Perl is to run any chunk of Perl code.

All the module would need to be would be a collection of PPI &wanted functions which search for a particular thing...

sub has_our_variables {
    $_[1]->isa('PPI::Statement::Variable')
    and $_[1]->type eq 'our';
}

sub has_use_warnings {
    $_[1]->isa('PPI::Statement::Include')
    and $_[1]->pragma eq 'warnings';
}

... and a small register mapping each feature detector to the version in which it first appeared.

my %register = (
    has_our_variables => '5.6.0',
    has_use_warnings  => '5.6.0',
    etc...
    );

To find the minimum version you simple run some sort of...

# (pseudocode)
$Document = PPI::Document->load( file );
@versions = grep { $Document->find_any(function) } %register;

Then find the maximum version, and you've got your "required Perl version" for each bit of Perl.

Of course, there's some WAY more efficient algorithms I can see for speeding up the searching, and you would also have to trace down into included modules, but the above would get you a "naive minimum version", which you would then compared against the same for all the needed modules.

I keep meaning to get around to just implementing it, but I'm stretched for time as it is...

Rob, anyone? Interested? :)

Adam K


_______________________________________________ sw-design mailing list [email protected] http://metaperl.com/cgi-bin/mailman/listinfo/sw-design

Reply via email to