Perl example of inside-out object number 2 # object oriented example - inside out # tags #perl #programming #objectoriented # http://perldoc.perl.org/perlobj.html#Inside-Out-objects ##### test-time.pl #!/usr/bin/perl -wT use Hash::Util::FieldHash 'fieldhash'; require '../lib/Time.pm'; my $time = Time->new; print $time->epoch . "\n"; ################ # Time.pm package Time; use strict; use warnings; use Hash::Util::FieldHash 'fieldhash'; fieldhash my %time_for; sub new { my $class = shift; my $self = bless \( my $object ), $class; $time_for{$self} = time; return $self; } sub epoch { my $self = shift; return $time_for{$self}; } 1; From JR's : articles 79 words - 684 chars created on Jul 08, 2013 at 12:16:19 pm import date 2013-08-12 21:50:48 - # source - versions - backlinks