aboutsummaryrefslogtreecommitdiff
path: root/samples/Perl/oo2.pl
diff options
context:
space:
mode:
Diffstat (limited to 'samples/Perl/oo2.pl')
-rw-r--r--samples/Perl/oo2.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/samples/Perl/oo2.pl b/samples/Perl/oo2.pl
new file mode 100644
index 0000000..82f2bdf
--- /dev/null
+++ b/samples/Perl/oo2.pl
@@ -0,0 +1,27 @@
+#! perl
+
+# Copyright (C) 2004-2006, Parrot Foundation.
+
+use strict;
+use warnings;
+
+for my $i ( 1 .. 500000 ) {
+ my $o = new Foo();
+}
+my $o = new Foo();
+print $o->[0], "\n";
+
+package Foo;
+
+sub new {
+ my $self = ref $_[0] ? ref shift : shift;
+ return bless [ 10, 20 ], $self;
+}
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4: