Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Writing for backwards compatibility

by Animator (Hermit)
on Nov 08, 2005 at 21:06 UTC ( [id://506895]=note: print w/replies, xml ) Need Help??


in reply to Writing for backwards compatibility

The following list is a (small) list of things that I know that work on 5.8 but not on 5.6.

  • An lvalue subroutine that ends with $obj->$sub("x") (the name of the method is a variable) does not work on 5.6.1. It does work fine on 5.8. (One of the many alternatives: $obj->can($sub)->($obj, "x");)
  • Using the internal PerlIO_close function (via XS/C) on an already closed file results in a segmentation fault on 5.6.
    Actually I consider this good... I experienced this with a module on CPAN. The module itself was doing the wrong thing (Closing files it didn't open, not incrementing the reference counter of the filehandle it was passed, ...). Yet noone using 5.8 noticed it...

To answer some of your other questions:

My default perl is 5.6.1. (I have others versions installed aswell). So when I write code it is (and I want it to be) backwards compatible with 5.6.1. And I will always do that. Even if I know for sure that it will be used only on 5.8.

Letting go of features... I guess most of the new features of 5.8. I definitely won't let go of the 3-args open or my.

The biggest thing that annoys me is a module that requires a specific version of Perl... Yes there might be a reason for it but atleast mention it somewhere in the POD... Someone might know an easy workaround... (Or a hard workaround if they really want to use it on an earlier version)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://506895]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-18 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found