Paul - The Programmer

simple & stupid
Use -prune to skip directory while finding file
find & insert new line with VIM

Have Perl modules all in one file

paul posted @ Thu, 16 Jul 2009 01:37:15 +0800 in coding life , 1304 readers

This is so good for me when I practise the OO concept in Perl. Do not need to switch among the module files anymore. :)

package Foo;  # start the class package

sub new {
    print "In Foo::new\n";
    my $self = bless {}, 'Foo';
    return $self;
}

package main;   # get back to the main package

my $bar = Foo->new; # this is the first line for interpreter to read
print "$bar\n";

 

 

 

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
  • No match
  • No match

Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter