Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created July 1, 2012 18:05
Show Gist options
  • Save ynonp/3029139 to your computer and use it in GitHub Desktop.
Save ynonp/3029139 to your computer and use it in GitHub Desktop.
package Starship;
use Moose;
has 'captain', is => 'ro', isa => 'Str', required => 1;
has 'crew', is => 'rw', isa => 'ArrayRef[Str]', required => 1;
package main;
# Pass a hash ref to prevent copying
my $enterprise = Starship->new( {
captain => 'James T Kirk',
crew => ['Dr. McCoy', 'Scott', 'Lt. Uhura'],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment