Re: Checking to see if a variable is a DBH
Michael Peppler <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase |
|---|---|
| Message-ID | <[email protected]> |
I've seen the following idiom used:
sub foo {
my $arg = shift;
if(!ref($arg)) {
$arg = DBI->connect("dbi:Sybase:server=$arg", ...);
...
}
etc...
}
Michael
On 1/6/06, Wechsler, Steven <[email protected]> wrote:
>
> Sorry, this is not a sybase-specific question, but DBI…
>
> I'm writing a function that I want to be able to pass either a Sybase
> server name or a DBI dbhandle; if the former, it will establish a connection
> to the server; if the latter, it will use the extant connection. Is there a
> straightforward way to check to see if the value passed to the function is a
> DBH or not?
>
> Thanks,
>
> Steve
>
> Steve Wechsler | [email protected]
> Sybase/SQL Server Database Administrator
> 212-846-5683
>
> [image: Picture (Metafile)]MTV Networks****
>
>
ole0.bmp
(image/bmp, 5.1 KB) - not displayed