I recently wrote some code which worked fine on my development machine (Windows, developed in Eclipse using Epic plugin, Perl v5.10.0) but failed (in production, of course) on a Solaris box, Perl v5.8.8. There are various reasons the code wasn't tested prior to production in an as-live scenario ...
I'd like to understand why this failed so I don't make the same (or similar) mistake in future.
I wrote:On the Solaris box this failed with: Can't use an undefined value as a HASH reference On Windows ... not a whimper. I am using strict and warnings and had run the code through perlcritic (-3).my $self->{_dbh} = $dbh; $self->{_sth} = $sth; bless $self, "xxx"; return $self;
I resolved this by ...
my $self = {}; ... $self->{_dbh} = $dbh; $self->{_sth} = $sth; bless $self, "xxx"; return $self;
I'm new to Perl but not programming & I get the idea of the error message but I don't understand why it should work on one platform and not the other.
Is it a platform issue? And if so, where can I do some reading on cross platform issues (& how to avoid them)?
Is it a version of Perl issue?
And is my solution acceptable or have I done something bad/wrong here too?In reply to Windows/Solaris Difference by azp74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |