S
Sophie Miron
My web host just upgraded from 5.6 to 5.8.1 and a series of scripts
I'd written are no longer working.
I'm using Class::Struct qw(struct) in my object modules. A Schedule
object contains 6 Station objects (among other things). A Station
contains 4 CurrItem objects...
These are defined globally:
@days = ('tue', 'wed', 'thu', 'fri');
@stations = ('art', 'outside', 'puzzles', 'cooking', 'science',
'floater');
In many places I use the following type of loop to access the object
data:
foreach my $class ($AM, $PM) {
foreach my $station (@stations) {
foreach my $day (@days) {
print $class->$station->$day->parent() ; # for example
}}}
I'm now getting an error, cannot perform method XXX on an undefined
value.
Is there a way around this problem, or a better way to code it? I'm
thinking of putting in an extra level of indirection (putting the 6
Station objects in a hash in the struct definition and calling "new"
explicitly).
Is what I'm doing using symbolic references? (the books show that as
using a variable to access a method, here I'm wanting it to see the
variable as a string)
I checked the documentation on deprecations in 5.8 and didn't find
what's causing the problem.
Any help for this newbie would be much appreciated.
Sophie Miron
(e-mail address removed)
I'd written are no longer working.
I'm using Class::Struct qw(struct) in my object modules. A Schedule
object contains 6 Station objects (among other things). A Station
contains 4 CurrItem objects...
These are defined globally:
@days = ('tue', 'wed', 'thu', 'fri');
@stations = ('art', 'outside', 'puzzles', 'cooking', 'science',
'floater');
In many places I use the following type of loop to access the object
data:
foreach my $class ($AM, $PM) {
foreach my $station (@stations) {
foreach my $day (@days) {
print $class->$station->$day->parent() ; # for example
}}}
I'm now getting an error, cannot perform method XXX on an undefined
value.
Is there a way around this problem, or a better way to code it? I'm
thinking of putting in an extra level of indirection (putting the 6
Station objects in a hash in the struct definition and calling "new"
explicitly).
Is what I'm doing using symbolic references? (the books show that as
using a variable to access a method, here I'm wanting it to see the
variable as a string)
I checked the documentation on deprecations in 5.8 and didn't find
what's causing the problem.
Any help for this newbie would be much appreciated.
Sophie Miron
(e-mail address removed)