On Tuesday 24 June 2003 03:51 pm, Andy Lester wrote: > >Whether you use the "indirect object" form of method call as you're doing > >above, or the "object-oriented" form, the class name determines where Perl > >will find the new() method. Since there isn't a class named literally > >"ILLString", Perl will complain about the latter call above (as you've no > >doubt discovered). > > That's true, but what we're talking about isn't necessarily objects. > Please see my previous message about using the Exporter module to > export function names into the caller's namespace.
Hi Andy, Yes, I see your point about Exporter. I'll grant that David might not need oop for his purposes. However, he did say "perl OOP question", he does mention "classes" and the subroutine he's using is new(), which typically returns an object, i.e., a reference to a blessed thingy. So I answered the oop part of the question--at least, I think I did. :-) I'm not saying he shouldn't use Exporter, but I do think it's important to realize that Exporter is typically not used in object oriented programming, but rather that objects and class names provide access to the subroutines outside of the current name space. I'm also not extolling the virtues of one over the other--I use oop when it works best and Exporter when oop isn't necessary. Cheers, Brad On Mon, 23 Jun 2003, David Christensen wrote: > I've built a some classes (eg: ILLString) which live in ./ISO/types > The class "header" is: Package ISO::types::ILLString > > Everything in my test program works fine if (in the top-level directory) I > say: > > use ISO::types::ILLString; > my $s = new ISO::types::ILLString("This is a string"); > > Is there any way I can just say: > > use ISO::types::ILLString; > my $s = new ILLString("This is a string");