example of new() and BUILD() together Revision 623034633066 (Tue Jul 17 2012 at 00:37) - Diff Link to this snippet: https://friendpaste.com/53MKnWboUIKj7JwCqIi4tx Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 12345678910111213141516171819202122232425262728293031323334class Term::Curses { has $.y is rw; has $.x is rw; has $!stdscr; method new( :$cbreak = True, :$echo = False, :$nl = False, :$intrflush = False, :$keypad = True, :$use_default_colors = True, :$start_color = True ) { #setlocale(0, ""); # TODO: use newterm() instead of initscr()? my $stdscr = initscr(); cbreak() if $cbreak; noecho() unless $echo; nonl() unless $nl; intrflush($stdscr, 0) unless $intrflush; keypad($stdscr, 1) if $keypad; if ($start_color and has_colors()) { use_default_colors() if $use_default_colors; start_color(); } self.bless(*, :$stdscr); } submethod BUILD(:$!stdscr) {}