On Mon, 14 Oct 2002, Eric Frazier wrote:
> >That looks like voodoo code copied from a man page.  If you call this as
> >Holds->new(), you don't need that junk about ref.  (And most people
> >recommend against the "new Holds" syntax.)
>
> I wanted the DBH to be global since just about every sub in Holds does a
> query of some sort. I guess it doesn't matter either way if I do the connect
> in the new() vs  up top outside of a sub.

Boredom break:

As for your dbh, stick it whereever its scope applies, however I don't
like declaring globals, so I've found that if I make the dbh accessible
via an object, usually together with Apache::DBI in the background, I can
often do clean up stuff, such as closing the handle (incase Apache::DBI
isn't in place with a particular invokation of the package), last system
logging updates/inserts, or whatever the job requires in a DESTROY method.

> What is the problem with the my $holdcheck = new Holds() type of syntax?
> I never read anything about that either way.
It's in the book which I think should be called, 'the guy in the silly hat
book,' ie. Damien's OO book, pretty much saying that,

"The indirect object syntax does, however, suffer from the same type of
ambiguity problems that sometime befuddles print ....

        my $cd3 = new get_classname() (@data) #Compilation Error

...

        <parapharased type="badly">
        Assuming you have $cd="MyPackage" and:
        get_name $cd;

        This is usually equivalent to:
        $cd->get_name;

        However, let's say that you have a method in the invoking script
named 'get_name', then:

        get_name $cd;

        Gets interpreted as:

        get_name("MyPackage")

        Which is not what you're after.
        </paraphrase>
" - from the guy in the silly hat book

-- 
Senior Programmer
Bookings.nl
----------------------------------------------------------
Me::[EMAIL PROTECTED]||www.dreamthought.com
Budget hosting on my 10Mbit/backbone::[EMAIL PROTECTED]


Reply via email to