Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Assigning default values to function arguments which may be “empty”

by hippo (Bishop)
on Aug 19, 2016 at 08:58 UTC ( [id://1170046]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Assigning default values to function arguments which may be “empty”
in thread Assigning default values to function arguments which may be “empty”

use 5.007003; # perl v5.7.3; required for List::Util to be available in CORE

I must be missing something but I fail to see the advantage of this. You are deliberately disallowing users with perl 5.7.0 (say) the opportunity to run this script even if they have List::Util installed. Why would you do that?

  • Comment on Re^3: Assigning default values to function arguments which may be “empty”
  • Download Code

Replies are listed 'Best First'.
Re^4: Assigning default values to function arguments which may be “empty”
by Wyrdweaver (Beadle) on Aug 19, 2016 at 16:01 UTC

    It was included to guarantee that there would be no error from a missing dependency. I take your point though, and will re-think how to express it with more flexibility for the case where the module is already installed.

    Thanks for the comment.

      There are actually 2 problems with this approach. The first is the one I mentioned above where a perhaps pointless error is thrown for users with older perls. The second is that just because a module is in core for a certain perl version does not guarantee that it is installed. RHEL does this a lot, for example: if I were to run your code on a stock RHEL5 machine it would pass the version test (5.8.8) but then throw the compiler error because the module isn't actually installed.

      FWIW, I think it would be considered fine to use a module which has been in core that long anyway. Folks running really old perls or those without core modules present will mostly be used to installing such dependencies. Your choice, of course.

        Thanks for that information. I was making the assumption that being in CORE actually meant guaranteed to be packaged with that distribution.

        What does being in perl CORE actually mean then?

Log In?
Username:
Password:

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

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

    No recent polls found