Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad symbol for filehandle ...error

Status
Not open for further replies.

alimumi

Programmer
Jan 10, 2002
5
0
0
US
The same piece of code works fine on Windows Env, but doesn't work on unix env (Solaris)
Can someone help as to why the filehandle give me a error.

This is the error i get "Bad symbol for filehandle"


# initialization
$Migrator::ERRORLOG_FILE_NAME = "$Migrator::BASE_DIR/migration/dyn/logfiles/sync_channel/synchannelsDB_error.log";


sub logerror{
my $t = time;
my $str = "[" . localtime(time) . "] ";
my $logdata = shift;
# this is where i get the error
error line: select($Migrator::ERRORLOG_FILE_HANDLE);

$| = 1;
if($Migrator::LOGGING){
print $Migrator::ERRORLOG_FILE_HANDLE $str . $logdata . "\n"
}
select(STDOUT);
$| = 1;
}

sub startLogging{

open(ERROR, ">>$Migrator::ERRORLOG_FILE_NAME") or die "Couldn't open log $Migrator::ERRORLOG_FILE_NAME $!";
#$Migrator::LOGGING = 0;
if($Migrator::LOGGING){
$Migrator::ERRORLOG_FILE_HANDLE = *ERROR;
}
}

sub stopLogging{
if($Migrator::LOGGING){
close($Migrator::ERRORLOG_FILE_HANDLE);
}
}


mir...
 
what versions of Perl on both systems? Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
it's the same version of perl 5.6 on win and unix...
 
I've never used that particular trick - setting a variable equal to a typeglob and then using the variable as a filehandle - so I can't help directly.

However -- it's pretty obviously an inconsistence between the versions of Perl running on each system.

I take it you're running ActivePerl on the Win32 system? I understand that ActivePerl is also available for Solaris; if you're not already using it you might consider downloading the binary install for Solaris from Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top