--- Peter Cline <[EMAIL PROTECTED]> wrote:
> At 01:29 PM 5/23/01 -0700, you wrote:
> >I'm not sure what you mean by "multiple namespaces". Could you
> >elaborate?
> 
> I am writing a module.  This module has numerous packages which are
> what I am referring to (perhaps erroneously)  as namespaces. 

Nope, I think you got it right. =o)

> In this module file is a use pragma/function that tells the module to
> use another, which was written by some colleagues who get the big
> bucks for their know-how and experience, and therefore I'm sure they
> blessing objects :-)

lol... If you want to double-check then try

  print "$object\n";

Which should look like

  Classname=TYPE(hexaddress)

For example,
   use FileHandle;
   my $fh = new FileHandle;
   print "$fh\n";

yields
   FileHandle=GLOB(0x400483b0)

FileHandle is the Class name, and the object is a GLOB.


> (even I figured out how to do that and this is the first time I'm
> writing any object-oriented perl or modules).  I just checked up on
> them, and yes their code blesses the object.

Ok. =o)

> >Also, I'm prompted to ask exactly what is the code of Class::new()
> >What *exactly* is the object? Has it been bless()'d?
> >I'd have to see it.
> 
> Ok, so here is some code.

lol....well, I asked for it.
 
> #!/usr/local/bin/perl5 -w
> use strict;
> 
> require "request_sub.lib";  
>    #this is the file that contains the subroutine I will want to
>    #pass the object to

ok, so the routine is in main:: namespace?

[snip]
> use NYT::Cnxdb;
> my $cnxdb =
> Cnxdb->new($conf{cnxdbUser},$conf{cnxdbPort},$conf{cnxdbTimeout});
> die("Unable to connect to database: " . $cnxdb->getlasterror())
>     unless $cnxdb->getok();a
> #cnxdb is the object in question.  It is in the main package of the
> module file

You say "main package"....
Is there a package statement in the file?
It's a my() variable, but if it's a reference to some dataspace, then
returning the reference makes the dataspace accessible through the
reference.....

> sub new_request_form {
>     my $class = shift;
[snip]
>        @values = &select_people($cnxdb,$responsibility{$class}); 
> #here is where I pass the                                            
                
> #object to the subroutine, 
> #which lives in separate file
>     }

aha?
$cnxdb is a my() variable created in another function. It doesn't exist
here unless it was passed in, which it doesn't look like it was.
Does this file also have a "use strict;"?

> And in the other file (request_sub.lib):
> 
> sub select_people {
>    my ($cnxdb,$responsibility) = @_;  #lexical copies of parameters

Here you passed it in, so if you had it to pass, I think it'd work. =o)

> Thanks for all your help!

Trying. ;o]

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to