Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > API for import?

Reply
Thread Tools

API for import?

 
 
kj
Guest
Posts: n/a
 
      02-13-2004



Where can one find good documetation on the API for the import
function and whatever other information one must know to write
one's own import function? (Neither 'perldoc -f import' and pointers
therein, nor reading the Export.pm source code were particularly
illuminating on this question.)

Thanks!

kj
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      02-13-2004

kj <(E-Mail Removed)> wrote:
>
> Where can one find good documetation on the API for the import
> function and whatever other information one must know to write
> one's own import function? (Neither 'perldoc -f import' and pointers
> therein, nor reading the Export.pm source code were particularly

^^ er
> illuminating on this question.)


perldoc -f use
perldoc perlmod

Think carefully before you start though: is it *really* necessary to
write your own? Exporter covers most cases...

Ben

--
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else * http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Brian McCauley
Guest
Posts: n/a
 
      02-13-2004
kj <(E-Mail Removed)> writes:

> Where can one find good documetation on the API for the import
> function


When you write your own import() you get to define your own API!

In older versions of Perl you needed to do version checking but
this is now handled by a separate VERSION method.

Old modules' import() still may need keep the legacy version checking
code to support the legacy syntax:

use Module VERSION, LIST

New modules don't need to worry about this as new code will use one of:

use Module VERSION LIST
use Module VERSION

This means you have a completely free hand in your import's API.

> and whatever other information one must know to write
> one's own import function?


You need to know what you want it to do. You have to supply that
information yourself.

> (Neither 'perldoc -f import' and pointers
> therein, nor reading the Export.pm source code were particularly
> illuminating on this question.)


I'm not quite sure what "this question" is. I suspect it doesn't
really exist, you only imagine it does. Getting answers to questions
whose existanve you are imagining is often very difficult.

That said you may also want to consult:

perldoc -f use
perldoc perlmod

The only bit I found unclear was how Perl manages to DWIM for both:

use Module VERSION
use Module LIST [where LIST contains a single element]

From experimentation it seems that if the abiguous argument is a
number literal or a version literal it is seen as VERSION otherwise
it's seen as LIST. Which seems right from a DWIM standpoint.

If you want to force something that would usually
be treated as a VERSION to be treated as sigle element LIST the
parentheses or a unary plus seem to do the trick.

--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
platform specific API or C standard API George2 C Programming 13 11-13-2007 06:29 PM
.Net Profiler API in 64 bit windows -FunctionMapper callback API =?Utf-8?B?TGVv?= Windows 64bit 0 09-05-2007 06:10 PM
Profiling API or Membership API John123 ASP .Net 0 10-20-2006 03:18 PM
Calling the C API from Python and Python program from same C API -bidirectional Praveen, Tayal (IE10) Python 0 03-17-2005 06:33 AM
What API replaces the unlock API that existed in gcc 2.9.3? Shlomo Anglister C++ 1 08-02-2004 06:50 PM



Advertisments