> [EMAIL PROTECTED] wrote:
> > You are in fact using the DBI module. The DB handle is 
> probably (I think it 
> > is) a bless reference that will send you straight to the 
> DBI module that's 
> > called in the function you've created. Although you're not 
> using the DBI module in 
> > your code, you're indirectly using it without ever knowing 
> it if you made a 
> > good enough class. 

> 
> Generally you are correct, though there is a little "and then 
> in step 3 
> black magic happens and..." to your answer.
> 
> Presumably the 'use DBI' is still in the top of the personal 
> module.  It 

A blessed reference knows which *NAMESPACE* to find its methods in.
If you have called 'use X;'  *anywhere* in your code, or in a module
or sub module, the namespace 'X' has been populated with the
methods available.

You will find that when you open a db with DBI, or get a select handle
it is a blessed reference to the package which is handling the query.

You can easily identify a blessed reference by converting it to scalar:
(easily done with print!)

print $db

prints
DBI=HASH(0xDEADBEEF)

Here the variable $db is a HASH reference, and btw, is 'blessed' to the
DBI namespace.  Hence any attempt to refer to methods via $db will start

searching from the DBI namespace, and traverse parent namespaces (via
the
@ISA inheritance implementation) as required.

This is entirely different to being able to *call* module functions
as if they in your local namespace.  If you 'use POSIX' in your main
code, it will by default export symbols to the main:: namespace.

If you 'use POSIX' inside a module, after the 'package X;' declaration
it will export symbols to namespace X::, and not to main::.

So, while $obj->method() will work if the module to which OBJ is blessed
is
loaded, calling a function such as POSIX's 'strftime()' will only work
if
the function names have been exported to your namespace.

'strftime()' for example, is only accessible as 'POSIX::strftime'
unless the 'use POSIX' declaration occurred inside your code within the
current
namespace or module, in which case the function 'strftime' will have
been
exported to your current namespace.

Oh, then step 3 kicks in.

BTW, if you want parts of this explained in english, feel free to ask
:-)


Regards,

David le Blanc

--              
Senior Technical Specialist             
I d e n t i t y   S o l u t i o n s     
        
Level 1, 369 Camberwell Road, Melbourne, Vic 3124       
Ph 03 9813 1388 Fax 03 9813 1688 Mobile 0417 595 550
Email [EMAIL PROTECTED] 
 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to