[WindyCity-pm] || return a value?

Joshua McAdams joshua.mcadams at gmail.com
Fri Jun 27 22:24:02 PDT 2008


Try adding this after the connection statement:

  return 2 if $DBI::err;

On Fri, Jun 27, 2008 at 3:26 PM, Richard Reina
<richard at rushlogistics.com> wrote:
> I am trying to write a statement like:
>
> #!/usr/bin/perl5 -w
>
> sub display {
>
> my $dbh = DBI->connect(blah, blah, ...) || return 2; # return 2 means no connection possible
>
>
> snip...
>
> } # end of sub display
> 1;
>
> However, the value that is returned ( even if the connection fails ) is the one at the end of the sub.
>
> Does anyone know what I might be doing wrong?
> _______________________________________________
> WindyCity-pm mailing list
> WindyCity-pm at pm.org
> http://mail.pm.org/mailman/listinfo/windycity-pm
>


More information about the WindyCity-pm mailing list