Subdomain Posts
None | 30 days ago
Perl | 42 days ago
Perl | 42 days ago
None | 44 days ago
Perl | 48 days ago
Perl | 48 days ago
Perl | 48 days ago
None | 106 days ago
None | 250 days ago
None | 371 days ago
Recent Posts
None | 44 sec ago
None | 2 min ago
Java | 2 min ago
C++ | 2 min ago
None | 2 min ago
C++ | 2 min ago
PHP | 2 min ago
Java | 2 min ago
C# | 3 min ago
XML | 3 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By mhg on the 28th of Jan 2010 03:24:33 PM Download | Raw | Embed | Report
  1. #==================== code ===============================
  2.  
  3. use MooseX::Declare;
  4.  
  5. class TestMoose {
  6.     has p1  => (
  7.         is      => 'rw',
  8.         default => '111',
  9.     );
  10.     has p3  => (
  11.         is          => 'rw',
  12.         lazy        => 1,
  13.         default     => sub { '333' . $_[0]->p2 },
  14.     );
  15.     has p2  => (
  16.         is          => 'rw',
  17.         lazy        => 1,
  18.         default     => sub { '222' . $_[0]->p1 },
  19.     );
  20. }
  21.  
  22. my $t = TestMoose->new;
  23.  
  24. print join ' ', $t->p1, $t->p2, $t->p3, "\n";
  25.  
  26. $t->p2( 'xxx' );
  27.  
  28. print join ' ', $t->p1, $t->p2, $t->p3, "\n";
  29.  
  30.  
  31. #============================== result ===========================
  32.  
  33. $ perl testMoose.pl
  34. 111 222111 333222111
  35. 111 xxx 333222111
  36.  
  37. # but what i want is:
  38.  
  39. 111 222111 333222111
  40. 111 xxx 333xxx
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: