azp74 has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Windows/Solaris Difference
by almut (Canon) on Oct 29, 2009 at 00:13 UTC | |
by azp74 (Novice) on Oct 29, 2009 at 00:18 UTC | |
|
Re: Windows/Solaris Difference
by ikegami (Patriarch) on Oct 29, 2009 at 00:48 UTC | |
|
Re: Windows/Solaris Difference
by aufflick (Deacon) on Oct 29, 2009 at 02:42 UTC | |
by Anonymous Monk on Oct 29, 2009 at 06:06 UTC | |
by aufflick (Deacon) on Oct 30, 2009 at 04:16 UTC | |
by clp (Friar) on Nov 01, 2009 at 18:43 UTC |