Skip to content

Instantly share code, notes, and snippets.

@satomixx
Created March 25, 2013 09:38
Show Gist options
  • Save satomixx/5236000 to your computer and use it in GitHub Desktop.
Save satomixx/5236000 to your computer and use it in GitHub Desktop.
スゲい簡単なPerl入門 -2ndDay ref: http://qiita.com/items/43320da7c38813b805ce
my $pkg = shift;
package main;
use Stonge;
my $obj = Stone->new('brick','100');
$obj = Stone::new('Stone','brick','100');
# 1st argument of Stone module is inserted here.
my $pkg = shift;
# 2nd and 3rd arguments are inserted here.
my $hash = {
# 2nd argument
name => shift;
# 3rd argument
weight => shift;
};
bless $hash, $pkg;
#!/usr/bin/perl -w
package Stone;
sub new{
my $pkg = shift;
my $hash = {
name => shift,
weight => shift
};
bless $hash, $pkg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment