in reply to Switch the odd/even elements of an array

And there is a second constraint: No CPAN. The corporate IT support for perl is "perl only" and is always a few years out-of-date. Thus natatime() is out of consideration :-(
So... it's ok to copy some code from PerlMonks which is probably thrown together in a few minutes and is untested and undocumented...

but it's not ok to copy code from a mature, well-documented, well-maintained, well-tested across multiple perl versions and OS's CPAN module which has an open license?

You better make sure no one copied the contents of the natatime sub (which is pure Perl) in any of the answers provided.

  • Comment on Re: Switch the odd/even elements of an array (OT: no CPAN constraint)

Replies are listed 'Best First'.
Re^2: Switch the odd/even elements of an array (OT: no CPAN constraint)
by AnomalousMonk (Archbishop) on Mar 04, 2011 at 23:56 UTC

      This is a wonderful link, thank you. I'm getting way more out of this question than I expected.

      Unfortunately, as I indicated in other replies, at my work the steel ball of perl destiny has fallen through the pachinko machine of corporate IT obstacles to land in the APATHY slot.

      If there is one thing I have learned when I was a programmer, it was that life is much easier when external dependencies are minimized. bellaire has a nice essay (found via your link), but I think the reasons given for why one doesn't want an external dependency is a false dichotomy. Here's a real reason: Support is a non-trivial concern with module/library use. All that happy hoo-ha about generality and testing becomes secondary when the module isn't there. If you can't think of at least three reasons why a module wouldn't be where you put it, then you either aren't sufficiently imaginative or your corporate IT isn't sufficiently stultifying.

        ... life is much easier when external dependencies are minimized.

        What external dependencies? In an earlier link in this thread, you rejected consideration of a function like  List::MoreUtils::natatime because it was part of a module on CPAN. But I don't understand what difference that makes. Just Use the Source, Luke! Whether  natatime is really appropriate to the problem at hand is another question, but I just checked and as toolic pointed out, it's about half a dozen lines of pure-Perl, standalone code; if you need it, just steal it for Heaven's sake, that's what it's there for! (Although an acknowledgement of provenance is always a nice touch.) A simple cut-and-paste and you're done. And there's a ton more code where that came from.

        If there is one thing I have learned when I was a programmer, it was that life is much easier when external dependencies are minimized.

        Perl is an external dependency, as is any code you copy/paste from here.

Re^2: Switch the odd/even elements of an array (OT: no CPAN constraint)
by jaredor (Priest) on Mar 05, 2011 at 04:24 UTC

    Sorry, I should have been more precise: The lack of CPAN is a fact at my place of employ, not a policy.

    The scripts I write are just for myself to get my work done. The maintenance problem happens when a friend asks to use one of my scripts. I could tell them to put my personal bin directory in the front of their PATH, but my conscience compels me instead to give them a script that works without any dependencies upon my environment. Why, hello perl5.8 with no CPAN. (Now when I get laid off, my friends' scripts will still keep on working :-)

    This was a request for an idiom, so I'm not that concerned about copying code and corresponding quality concerns.

    That being said, there are lot of excellent answers here.