Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

mavericks' perl broken? seems to be missing ctime.pl

When I run:


perl -e 'require "ctime.pl"; print "Hello\n";'


..it works normally on all OSX machines (it prints 'hello'),

but on /all/ my new Mavericks machines (e.g. 10.9.2), it throws this error:


$ perl -e 'require "ctime.pl"; print "Hello\n";'
Can't locate ctime.pl in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at -e line 1.


Other people seem to be able to confirm this as well..


Is this a bug that should be reported?

Mac mini (Mid 2010), OS X Mavericks (10.9.2)

Posted on Mar 6, 2014 11:25 AM

Reply
3 replies

Mar 6, 2014 12:08 PM in response to erco77

I should add, as far as I know, ctime.pl has always been a part of perl.


ctime.pl seems to be located in:


$ locate ctime.pl
/System/Library/Perl/5.12/ctime.pl


..but this path is not shown in the above error message.


Perhaps the issue is Apple upgraded /usr/bin/perl to 5.16, but didn't bring over ctime.pl?


# which perl
/usr/bin/perl


# perl -v | grep v5
This is perl 5, version 16, subversion 2 (v5.16.2) built for darwin-thread-multi-2level



I checked again with find(1) for ctime.pl, just in case my locate database

is out of date after the recent upgrade to 10.9.2:


# find /System/Library/Perl/ -name ctime.pl -exec ls -la {} \;
-rw-r--r-- 1 root wheel 2081 Oct 30 07:26 /System/Library/Perl//5.12/ctime.pl <-- finds only 5.12 version


# find /Library/Perl -name ctime.pl -exec ls -la {} \;

<-- finds nothing


Seems like a bug in the OS version of perl, perhaps only in the 10.9.2 update.

(I no longer have 10.9 without the update)

Mar 6, 2014 1:16 PM in response to erco77

OK, so looked into this.

Not an Apple problem, but a perl issue; apparently comments in the perl ctime.pl header

have been warning since 5.12:


;# ctime.pl is a simple Perl emulation for the well known ctime(3C) function.
#

# This library is no longer being maintained, and is included for backward
# compatibility with Perl 4 programs which may require it.
# This legacy library is deprecated and will be removed in a future
# release of perl.


So its absence is not a bug, but a deprecation that has been planned for a while,

and has suddenly 'happened' somewhere between 5.12 and 5.16.


According to this page:

http://search.cpan.org/~rjbs/perl-5.16.0/pod/perldelta.pod#Removed_Modules_and_P ragmata


..it says:


Several old perl4-style libraries which have been deprecated with 5.14 are now removed:

abbrev.pl assert.pl bigfloat.pl bigint.pl bigrat.pl cacheout.pl complete.pl ctime.pl dotsh.pl exceptions.pl fastcwd.pl flush.pl getcwd.pl getopt.pl getopts.pl hostname.pl importenv.pl lib/find{,depth}.pl look.pl newgetopt.pl open2.pl open3.pl pwd.pl shellwords.pl stat.pl tainted.pl termcap.pl timelocal.pl


..ctime.pl being part of that list.


Oh, great. Pff, I hate when languages just drop old syntax.

I wouldn't mind if it was a jump from 5.xx to 6.0, but It isn't even a major release of perl.


Anyway, sounds like they want us to change our code to use POSIX::ctime instead,

which is what I'll do.


But if you absolutely don't want to change old code, a possible workaround

for the missing ctime.pl is to run as root (at least for Mavericks 10.9.2 anyway):


1) cp /System/Library/Perl/5.12/ctime.pl /System/Library/Perl/5.16/


2) Comment out this line in the 5.16 copy, because it generates an error:


local($[) = 0;


Regarding that $[ change, that variable is no longer changeable and is always zero

(according to 'man perlvar'), so that line shouldn't be needed in 5.16 anyway.


With the above change in place, old code's use of ctime() works normally again, e.g.


# sw_vers
ProductName: Mac OS X
ProductVersion: 10.9.2
BuildVersion: 13C64


# perl -e 'require "ctime.pl"; print ctime(time());'
Thu Mar 6 13:11:36 2014


# date
Thu Mar 6 13:11:38 PST 2014


In my case I'll change my code to use POSIX::ctime(), as I'd rather do that than hack the OS files..

mavericks' perl broken? seems to be missing ctime.pl

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.