Skip to content

Instantly share code, notes, and snippets.

@Cside
Created March 13, 2012 04:56
Show Gist options
  • Save Cside/2026856 to your computer and use it in GitHub Desktop.
Save Cside/2026856 to your computer and use it in GitHub Desktop.
Inheritance test on Perl
#!/usr/bin/env perl
use strict;
use warnings;
use lib './';
{
package Child;
use strict;
use warnings;
use parent qw(Parent); # => error
# use base qw(Parent); # => works
1;
}
my $child = Child->new;
# => Can't locate object method "new" via package "Child" at ...
package Parent;
use strict;
use warnings;
sub new { bless {}, $_[0] }
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment