Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • by notbenh (7967) on 2008.12.17 17:50 (#66531)

          package My::Map;

          package My::City;
          use Moose;
          has [qw{longitude latitude}] => (
                is => 'rw',
                #could make your own type, though for consistency
                isa => 'Num',
          has name => (
                is => 'rw',
                isa => 'Str',
          has map => (
                is => 'rw',
                isa => 'My::Map',
                default => sub {
                      use My::Map;

          #needless, but here for consistency
          sub setMap { shift->map(@_) };
          sub routeTo {
                my ($self, $targetCity) = @_;

    So the code is not that much different, Though you gain one big plus, type checking for setMap.