Devel-ModInfo
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Devel/ModInfo.pm view on Meta::CPAN
write_method => $item->getAttribute('write_method'),
data_type => _get_datatype(class_name=>$class, data_type=>$item->getAttribute('data_type')),
);
push(@properties, $item_obj);
}
#
# Get module-level info
#
my $mod_node = $xml_doc->getElementsByTagName('module')->[0];
return undef if !$mod_node;
my @deps;
foreach my $dep_node ($mod_node->getElementsByTagName('dependency')) {
my $dep_obj = Devel::ModInfo::Dependency->new(
type => $dep_node->getAttribute('type'),
target => $dep_node->getAttribute('target'),
);
push(@deps, $dep_obj);
}
my @parents;
foreach my $parent ($mod_node->getElementsByTagName('parent_class')) {
my $parent_obj = Devel::ModInfo::ParentClass->new(
name => $parent->getAttribute('name'),
);
push(@parents, $parent_obj);
}
my $mod_obj = Devel::ModInfo::Module->new(
name => $mod_node->getAttribute('name'),
display_name => $mod_node->getAttribute('display_name'),
short_description => $mod_node->getAttribute('short_description'),
version => $mod_node->getAttribute('version'),
class => $module,
dependencies => \@deps,
parent_classes => \@parents,
);
#
# Assign collections and other attributes to $self
#
my $self = {
module_name => $module,
mod_info_file => $mod_info_file,
methods => \@methods,
constructors => \@constructors,
functions => \@functions,
properties => \@properties,
module => $mod_obj,
};
#print Dumper $self;
#
# Return object
#
return bless $self => $class;
}
# MODINFO function properties
# MODINFO retval ARRAYREF
sub properties{$_[0]->{properties}}
# MODINFO function methods
# MODINFO retval ARRAYREF
sub methods{$_[0]->{methods}}
# MODINFO function functions
# MODINFO retval ARRAYREF
sub functions{$_[0]->{functions}}
# MODINFO function constructors
# MODINFO retval ARRAYREF
sub constructors{$_[0]->{constructors}}
# MODINFO function module Returns the Module object for this Package
# MODINFO retval Devel::ModInfo::Module
sub module{$_[0]->{module}}
# MODINFO function is_oo Returns 1 if this is an object-oriented package, 0 if not
# MODINFO retval INTEGER
sub is_oo{
my($self) = @_;
if ($self->constructors) {return 1}
else {return 0}
}
# MODINFO function icon Returns the path to an icon for this module (relative to the module file itself)
# MODINFO retval STRING
sub icon{$_[0]->{icon}}
sub _findINC {
my $file = join('/',@_);
my $dir;
$file =~ s,::,/,g;
foreach $dir (@INC) {
my $path;
return $path if (-e ($path = "$dir/$file"));
}
return undef;
}
#sub _check_module_version {
# my($version, $module) = @_;
# my $module_file = $module . ".pm";
# $module_file =~ s/::/\//g;
# open(MOD, _findINC($module_file)) or warn "Couldn't open $module_file for verification of version: $!";
# while(my $line = <MOD>) {
# if($line =~ /^package\s+(.);/ && $1 eq $module)
# }
#
# print "Version for $module is: $module_version\n";
# return $module_version;
#
#}
sub _extract_function_data {
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.462 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )