package implements;
##LICENSE##
use Cwd;
use Cwd 'realpath';
use File::Basename qw(&basename &dirname);
sub import {
my $class = shift;
my ($pkg, $filename) = caller(0);
my ($callDir) = dirname($filename);
my (@reDeclared);
foreach my $base (@_) {
eval "require $base";
die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
eval "use $base";
unless (%{"$base\::"}) {
require Carp;
Carp::croak("Base class package \"$base\" is empty.\n",
"\t(Perhaps you need to 'use' the module ",
"which defines that package first.)");
}
my (@baseModule);
foreach my $func (keys %{"$base\::$_"}) {
if (${"$base\::"}{$func} eq -1) {
if (!defined ${"$pkg\::"}{$func}) {
push(@reDeclared, "$func");
}
}
}
}
if (@reDeclared) {
my ($count) = scalar @reDeclared;
my ($methods) = join(', ', @reDeclared);
require Carp;
Carp::croak("Class $pkg contains $count abstract method and must therefore be declared abstract or implement the remaining methods ($methods) ");
}
}
1;
=head implements
BEGIN {
use File::Basename qw(&basename &dirname);
my $scriptPath = dirname(__FILE__);
require $scriptPath . "/myInterface.pm";
}
package myPackage;
use strict;
use warnings;
use Class::Std::Utils;
{
sub new {
my ($class) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
my ($this) = $class->SUPER::new();
return $this;
}
sub getApiUrl {
return 'http://api.rvglobalstore.com/usercp';
}
} use implements "myInterface";
=cut
Copyright 2K16 - 2K18 Indonesian Hacker Rulez