Bigtop
view release on metacpan or search on metacpan
lib/Bigtop/Parser.pm view on Meta::CPAN
my $app_configs = $self->walk_postorder( 'get_app_configs' );
my %retval;
foreach my $config_type ( @{ $app_configs } ) {
$retval{ $config_type->{ type } } = $config_type->{ statements };
}
return \%retval;
}
sub get_controller_configs {
my $self = shift;
my $app_configs = $self->walk_postorder( 'get_controller_configs' );
my %retval;
foreach my $config_type ( @{ $app_configs } ) {
$retval{ $config_type->{ controller } } = $config_type->{ configs };
}
return \%retval;
}
sub get_app_config_types {
my $self = shift;
return $self->walk_postorder( 'get_app_config_types' );
}
sub get_lookup {
my $self = shift;
return $self->{application}{lookup};
}
sub get_authors {
my $self = shift;
if ( defined $self->{application}{lookup}{app_statements}{authors} ) {
my $authors = $self->{application}{lookup}{app_statements}{authors};
my $retval = [];
foreach my $author ( @{ $authors } ) {
if ( ref( $author ) eq 'HASH' ) {
push @{ $retval }, [ %{ $author } ];
}
else {
push @{ $retval }, [ $author, '' ];
}
}
$retval;
}
else { # fall back on password file or local equivalent
my $retval = [];
# this eval was stolen from h2xs, but has been reformatted
eval {
my ( $username, $author_gcos ) = ( getpwuid($>) )[0,6];
if ( defined $username && defined $author_gcos ) {
$author_gcos =~ s/,.*$//; # in case of sub fields
my $domain = $Config{ mydomain };
$domain =~ s/^\.//;
push @{ $retval }, [ $author_gcos, "$username\@$domain" ];
}
};
return $retval;
}
}
sub get_contact_us {
my $self = shift;
my $statements = $self->{application}{lookup}{app_statements};
if ( defined $statements->{contact_us} ) {
return $statements->{contact_us}[0];
}
elsif ( defined $statements->{email} ) {
return $statements->{email}[0];
}
else {
return '';
}
}
sub get_copyright_holder {
my $self = shift;
my $statements = $self->{application}{lookup}{app_statements};
if ( defined $statements->{copyright_holder} ) {
return $statements->{copyright_holder}[0];
}
else {
my $first_author = $self->get_authors->[0];
return $first_author->[0] || '';
}
}
sub get_license_text {
my $self = shift;
return $self->{application}{lookup}{app_statements}{license_text}[0];
}
sub get_config {
my $tree = shift;
return $tree->{configuration};
}
sub get_app {
my $tree = shift;
return $tree->{application};
}
( run in 2.757 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )