Day 1377: perlver - The Perl Minimum Version Analyzer

Alias on 2005-09-13T08:58:24

I don't get much time to work on PPI these days, since apparently my grant application missed the window by a week :(

So I'm trying to put what little time I have into things that are going to be immediately useful for me personally.

As a result, I just uploaded a very experimental application called perlver, which will provide an easy to use front-end to the functionality provided by Perl::MinimumVersion, analyzing a directory full of code (or a single file) to see which version of perl you'll need to run it.

Of course being PPI-based, it will never be perfect, but because it is based on syntax, not functionality, it works without needing to run the code.

And you can be sure that although you may get some falsely low values, you won't get any falsely high ones.

This means that your code might still fail with a higher version because of some subtle reason that can't be gleaned from reading the code, but it will DEFINATELY fail below the version that perlver identifies.

So to sum up, while it may be no substitute for actually hunting down a working perl 5.005 and running the test scripts, it will provide you with a great first sweep and identify everything that can be checked just from reading the code.

A worthy addition to the Perl toolkit.

adam@red:~/parseperl$ perlver PPI

------------------------------------------------------------------------ | file | explicit | syntax | external | | ------------------------------------------------------------------------ | | PPI/Makefile.PL | ~ | ~ | n/a | | PPI/lib/PPI.pm | v5.5.0 | ~ | n/a | | PPI/lib/PPI/Cache.pm | ~ | ~ | n/a | | PPI/lib/PPI/Document.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Dumper.pm | ~ | ~ | n/a | | PPI/lib/PPI/Find.pm | ~ | ~ | n/a | | PPI/lib/PPI/Lexer.pm | ~ | ~ | n/a | | PPI/lib/PPI/Node.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Normal.pm | ~ | ~ | n/a | | PPI/lib/PPI/Statement.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Tokenizer.pm | ~ | ~ | n/a | | PPI/lib/PPI/Transform.pm | ~ | ~ | n/a | | PPI/lib/PPI/Util.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Element.pm | ~ | ~ | n/a | | PPI/lib/PPI/Document/Fragment.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Document/Normalized.pm | ~ | ~ | n/a | | PPI/lib/PPI/Normal/Standard.pm | ~ | ~ | n/a | | PPI/lib/PPI/Statement/Break.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Compound.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Data.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/End.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Expression.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Include.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Null.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Package.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Scheduled.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Sub.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Unknown.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/UnmatchedBrace.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Statement/Variable.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/Block.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/Condition.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/Constructor.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/ForLoop.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/List.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/Subscript.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Structure/Unknown.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/ArrayIndex.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Attribute.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Cast.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Comment.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/DashedWord.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Data.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/End.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/HereDoc.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Label.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Magic.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Number.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Operator.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Pod.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Prototype.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Quote.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/QuoteLike.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Regexp.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Separator.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Symbol.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Unknown.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Whitespace.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Word.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/_QuoteEngine.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Structure.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Quote/Double.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Quote/Interpolate.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Quote/Literal.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Quote/Single.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/QuoteLike/Backtick.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/QuoteLike/Command.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/QuoteLike/Readline.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/QuoteLike/Regexp.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/QuoteLike/Words.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Regexp/Match.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Regexp/Substitute.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/Regexp/Transliterate.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/_QuoteEngine/Full.pm | ~ | v5.5.0 | n/a | | PPI/lib/PPI/Token/_QuoteEngine/Simple.pm | ~ | v5.5.0 | n/a | | PPI/t/01_compile.t | ~ | ~ | n/a | | PPI/t/02_api.t | ~ | ~ | n/a | | PPI/t/03_empiric.t | ~ | ~ | n/a | | PPI/t/05_lexer_practical.t | ~ | ~ | n/a | | PPI/t/06_round_trip.t | ~ | ~ | n/a | | PPI/t/07_token.t | ~ | ~ | n/a | | PPI/t/09_normal.t | ~ | ~ | n/a | | PPI/t/10_statement.t | ~ | ~ | n/a | | PPI/t/11_util.t | ~ | ~ | n/a | | PPI/t/12_location.t | ~ | ~ | n/a | | PPI/t/13_data.t | ~ | ~ | n/a | | PPI/t/14_charsets.t | ~ | ~ | n/a | | PPI/t/15_transform.t | ~ | v5.5.0 | n/a | | PPI/t/16_xml_compatibility.t | ~ | ~ | n/a | | PPI/t/17_storable.t | ~ | ~ | n/a | | PPI/t/99_pod.t | ~ | ~ | n/a | | PPI/t/ppi_element.t | ~ | ~ | n/a | | PPI/t/ppi_token__quoteengine_full.t | ~ | v5.5.0 | n/a | | PPI/t/ppi_token_quote_double.t | ~ | ~ | n/a | | PPI/t/ppi_token_quote_interpolate.t | ~ | ~ | n/a | | PPI/t/ppi_token_quote_literal.t | ~ | ~ | n/a | | PPI/t/ppi_token_quote_single.t | ~ | ~ | n/a | | PPI/t/04_element.t | ~ | v5.6.0 | n/a | | PPI/t/08_regression.t | ~ | ~ | n/a | | PPI/t/18_cache.t | ~ | ~ | n/a | | PPI/t.data/basic.pl | ~ | ~ | n/a | | PPI/t.data/11_util/test.pm | ~ | ~ | n/a | | PPI/t.data/13_data/Foo.pm | ~ | ~ | n/a | | PPI/t.data/15_transform/sample1.pm | ~ | ~ | n/a | | ------------------------------------------------------------------------ | | Minimum explicit version : v5.5.0 | | Minimum syntax version : v5.6.0 | | Minimum version of perl : v5.6.0 | | ------------------------------------------------------------------------ | | ERROR DETECTED : ACTUAL DEPENDENCY HIGHER THAN SPECIFIED | ------------------------------------------------------------------------

adam@red:~/parseperl$


Which Version

n1vux on 2005-09-13T19:24:03

I like it. This looks way cool. I need to find uses for this ... besides validating use 5.004; statements in modules ...

Cool

bart on 2005-09-15T21:52:22

I've not tried it out, just read your journal, but I have to say it: this sounds way cool.

I should try it out on MP3::Tag. At some places, it relies on the module Encode, which only works on perl 5.8.x and above. I hope your version checker captures that, as a minimal version requirement?