7

Is there a resource on the web that I can look to in order to find perl version (5.8.1 vs current_stable) specific language syntax without having to go to perldoc and switch between versions then search for the language item I'm looking for to see if it exists in the selected version?

This just seems like a crappy way and I figured I'd ask the hive to see if there's better.

For instance, if I search for 'say' I'd like to know that it appeared in perl 5.10+.

Thank you.

edit-- As a note, the reason I'm looking is often I find myself having to support old versions of perl that I "can't" upgrade, yet still need to write code for. This becomes a tedious task when certain things don't work as expected going from 5.12+ to 5.8- and I was just hoping to find a better way (and I figured I can't be the only one in this situation).

edit-- I was basically looking for an all in one reference area ideally available via the web. Click 'say' and find that it's available in v5.10 when the feature is enabled, or that some function learned how to take different arguments in version Z, etc. With many languages, if you go view a core class/lib/module you find a whole version history for its arguments, methods, functions, etc. As far as utilities and modules go, perlver looks nice, as well.

AndrewPK
  • 6,100
  • 3
  • 32
  • 36
  • 2
    [Perl code on different version](http://stackoverflow.com/questions/3301082/can-i-make-sure-perl-code-written-on-5-10-will-run-on-5-8) – tuxuday Jun 15 '12 at 05:35
  • 1
    Perl::MinimumVersion looks pretty awesome - it's just not available as any sort of 'reference' material and might not be a fool proof solution. Definitely something to think about using while writing new code though (maybe I'll add a debug mode to new code that runs all lines through MinimumVersion or something ) – AndrewPK Jun 15 '12 at 05:47
  • An online-validator which tells me the needed minimum version for the entered code would be nice. – sid_com Jun 15 '12 at 06:19
  • 1
    [How can I test when a feature was added to Perl?](http://stackoverflow.com/questions/2500892/how-can-i-test-when-a-feature-was-added-to-perl) – daxim Jun 15 '12 at 09:59
  • I just recently discovered [`Syntax::Construct`](https://metacpan.org/pod/Syntax::Construct), which is another helpful resource for questions like "when was `/r` added?" – cxw Jun 09 '19 at 12:42

4 Answers4

4

Another not that nice way is to go through deltas: http://perldoc.perl.org/index-history.html You could always try searching through them:

grep say perl*delta.pod

But yes, this is not nice and easy way.

Teftin
  • 846
  • 7
  • 7
  • I've used this method before as well via the web - the problem is: 1. The web method sucks. 2. The grep method requires the perl version be available locally in some fashion. :-/ – AndrewPK Jun 15 '12 at 05:13
  • Marking this as the answer, as it currently seems like the best option. – AndrewPK Jun 19 '12 at 20:07
1

The only keywords that are version-dependent are documented in the feature doc page:

perldoc feature

The individual keywords also mention when they were added; perldoc -f say includes this:

This keyword is available only when the "say" feature is enabled; see feature. Alternately, include a "use v5.10" or later to the current scope.

It's really a very short list, anyway. Almost everything that works in 5.14 works in 5.6, too.

Mark Reed
  • 91,912
  • 16
  • 138
  • 175
  • 3
    That doesn't address the features that didn't add keywords, such as three-arg-open (Perl 5.6.0), changes to what the `utf8` pragma does, named capture buffers (Perl 5.10.0), and so on.... it's really more complex than just the keywords, imho. – DavidO Jun 14 '12 at 22:51
  • This answer is useful for keywords and such, I've used this method before as well, but I agree with DavidO that this also sucks in its own regard. I'm surprised that it seems as though what I was looking for doesn't exist. – AndrewPK Jun 15 '12 at 05:16
0

Probably easiest is to pick the specific version of perl you want from CPAN and read its perlsyn documentation page. For example:

http://perldoc.perl.org/perlsyn.html

http://perldoc.perl.org/5.8.8/perlsyn.html

titanofold
  • 2,852
  • 1
  • 15
  • 21
LeoNerd
  • 8,344
  • 1
  • 29
  • 36
0

Every perl release includes a perlXXXdelta document explaining the changes introduced and as new features are (in theory, at last) not introduced in minor version releases, you have to read just perl5160delta, perl514delta, perl512delta, perl510delta and perl58delta...

In any case, you are right, it will be nice to have a document summarizing the important changes and the versions where they were introduced.

salva
  • 9,943
  • 4
  • 29
  • 57