My basic question is this. If I pass no parameters to my package -- DbIoFunc
's routine OpenIcsDB()
why is the pacakge name in @_
?
I am expecting @_ to be null when I pass no parameters to the following function, but instead the parameter contains the package name. I have tried calling with class ->
and ::
syntax, and there is no difference.
What should I test to determine if no parameter was passed other than the following?
my ($Temp, $DBPathLocal) = @_;
if(!defined $DBPathLocal)
{
$DBPathLocal = DBDEV;
}
I'm wondering two things. Why is the package name part of @_
and is what I've done the best way to get rid of the package name?
Here is the call:
my ($DBHand);
$DBHand = DbIoFunc->OpenIcsDb();
Here is the function:
sub OpenIcsDb
#
# DB Path Constant DBPROD or DBDEV.
#
{
# Path passed in, either DBPROD or DBDEV
my ($DBPathLocal);
my ($DBSuffix);
my ($DBHand); # ICS database handle
$DBPathLocal = shift;
#
# Make sure the database path exists.
#
if (length($DBPathLocal) <= 0)
{
if (!$Debugging)
{
$DBPathLocal= DBPROD;
}
else
{
$DBPathLocal = DBDEV;
}
}
else
{
$DBPathLocal = DBDEV;
}
my $DBSuffix = DBSUFFIX;
$! = 2;
die("Can't find database directory ".$DBPathLocal.".".$DBSuffix)
unless ((-e $DBPathLocal.".".$DBSuffix) && (-d $DBPathLocal.".".$DBSuffix));
#
# See if we can connect to the ICS database. We can't proceed without it.
#
$DBHand = DBI->connect("dbi:Informix:".$DBPathLocal, "", "")
or die("Can't connect to the ICS database ".$DBPathLocal);
return $DBHand;
}