Created
May 6, 2014 06:38
-
-
Save VladimirSaz/11554475 to your computer and use it in GitHub Desktop.
PERL - simple class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PackageName; | |
sub new { | |
my ($class, $args) = @_; | |
my $self = { | |
attr1 => $args->{attr1} || 'some_template_conent', | |
attr2 => $args->{attr2} || 1, | |
attr3 => $args->{attr3} || 1, | |
}; | |
#more code here if u want | |
return bless $self, $class; | |
} | |
sub multiplicate { | |
my $self = shift; | |
#any code here | |
return $self->{attr2} * $self->{attr3}; | |
} | |
###How to use: | |
# my $simple_usage = PackageName->new(attr1=>"example_text", attr2=>2, attr3=>4) | |
# my $result = $simple_usage->multiplicate() | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment