On Nov 30, 2005, at 1:31 PM, Ted Zeng wrote:

I have been using
Time::localtime

Call.

Now I want to use POSIX module. But
There is also a
Lcoaltime
Call in this module.

What can I do to still use
Time::localtime
And also the POSIX module?

Use import lists.

From the Time::localtime module docs:

To access this functionality without the core overrides, pass the use an empty import list, and then access function functions with their full qualified names. On the other hand, the built-ins are still available via the CORE:: pseudo-package.

And, from the POSIX docs:

Everything is exported by default with the exception of any POSIX functions with the same name as a built-in Perl function, such as abs, alarm, rmdir, write, etc.., which will be exported only if you ask for them explicitly. This is an unfortunate backwards compatibility feature. You can stop the exporting by saying use POSIX () and then use the fully qualified names (ie. POSIX::SEEK_END).

So, in your code you could do something like this:

        use POSIX;    # Default imports
        use Time::localtime qw();    # Empty import list, so no overrides

        my $p_time = localtime();   # calls localtime() imported from POSIX
        my $time_object = Time::localtime::localtime();

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Reply via email to