You didn't include an accessor in dstatenorm to fetch the NAME.
package dstatenorm; ... sub name { my $self = shift @_; return $self->{NAME}; }
Then in your code, request the name of the state.
print $driver->alertness->namePS: don't use prototypes especially when writing object oriented code.
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: Implementing State pattern
by diotalevi
in thread Implementing State pattern
by Justin_BSI
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |