Skip to content

Instantly share code, notes, and snippets.

@jgrar
Created March 24, 2018 04:55
Show Gist options
  • Save jgrar/f610d125544c5f8a0e62d7ddec4d948a to your computer and use it in GitHub Desktop.
Save jgrar/f610d125544c5f8a0e62d7ddec4d948a to your computer and use it in GitHub Desktop.
Corrected week 6 basic OOP example
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin qw($RealBin);
use lib $RealBin;
use trivial;
my $obj1 = new trivial;
my $obj2 = trivial->new;
$obj1->printmsg;
printmsg $obj2;
package trivial;
use strict;
our $VERSION = 1.00;
sub new {
bless {};
}
sub printmsg {
print "I'm trivial!\n";
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment