On Dec 31, 2006, at 4:19 AM, Michael Barto wrote:

I have a Perl program that gets the date of a file using 'ctime' from "use Time::localtime;" But this program must also convert an Epoch time to a date and time using 'localtime' from "use Time::Local;". The problem is it appears that only one of these modules can be used in a single program. Not both since a localtime subroutine exist as the same name in both modules. How can I support using both modules in the same program?. Here are the snippits:


#!/usr/bin/perl
use Time:localtime;
use Time:Local;

You're importing everything by default. Instead, only import the specific functions you need from each module:

        #!/usr/bin/perl

        use Time::localtime qw(ctime);
        use Time::Local qw(localtime);

Have a look at "perldoc Exporter" for more, especially the section titled "How to Import".

sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


Reply via email to