Skip to content

Instantly share code, notes, and snippets.

@prakashk
Last active December 24, 2015 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prakashk/6734791 to your computer and use it in GitHub Desktop.
Save prakashk/6734791 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use v5.14;
use mop;
class Foo {
has $!sentence is ro;
method new($class: @words) {
$class->next::method(words => \@words);
}
submethod BUILD($args) {
$!sentence = join " ", @{$args->{words}};
}
}
say Foo->new(qw<mop is cool>)->sentence;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment