Convert useless die to error+return in Plugin.pm
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
* Convert useless die to error+return in Plugin.pm
|
||||||
* Documentation fixups
|
* Documentation fixups
|
||||||
|
|
||||||
2.006000 - 2013-03-07
|
2.006000 - 2013-03-07
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ sub _load_web_plugins {
|
|||||||
unless $plugin =~ m/^\+/;
|
unless $plugin =~ m/^\+/;
|
||||||
$plugin =~ s/^\+//;
|
$plugin =~ s/^\+//;
|
||||||
|
|
||||||
|
debug "loading Netdisco plugin $plugin";
|
||||||
eval "require $plugin";
|
eval "require $plugin";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ config->{engines}->{template_toolkit}->{INCLUDE_PATH} ||= [ setting('views') ];
|
|||||||
register 'register_template_path' => sub {
|
register 'register_template_path' => sub {
|
||||||
my ($self, $path) = plugin_args(@_);
|
my ($self, $path) = plugin_args(@_);
|
||||||
|
|
||||||
die "bad template path to register_template_paths\n"
|
if (!length $path) {
|
||||||
unless length $path;
|
error "bad template path to register_template_paths";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unshift
|
unshift
|
||||||
@{ config->{engines}->{template_toolkit}->{INCLUDE_PATH} },
|
@{ config->{engines}->{template_toolkit}->{INCLUDE_PATH} },
|
||||||
@@ -26,10 +28,13 @@ register 'register_template_path' => sub {
|
|||||||
register 'register_navbar_item' => sub {
|
register 'register_navbar_item' => sub {
|
||||||
my ($self, $config) = plugin_args(@_);
|
my ($self, $config) = plugin_args(@_);
|
||||||
|
|
||||||
die "bad config to register_navbar_item\n"
|
if (!length $config->{id}
|
||||||
unless length $config->{id}
|
or !length $config->{path}
|
||||||
and length $config->{path}
|
or !length $config->{label}) {
|
||||||
and length $config->{label};
|
|
||||||
|
error "bad config to register_navbar_item";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $item (@{ setting('navbar_items') }) {
|
foreach my $item (@{ setting('navbar_items') }) {
|
||||||
if ($item->{id} eq $config->{id}) {
|
if ($item->{id} eq $config->{id}) {
|
||||||
@@ -45,9 +50,12 @@ sub _register_tab {
|
|||||||
my ($nav, $config) = @_;
|
my ($nav, $config) = @_;
|
||||||
my $stash = setting("${nav}_tabs");
|
my $stash = setting("${nav}_tabs");
|
||||||
|
|
||||||
die "bad config to register_${nav}_tab\n"
|
if (!length $config->{id}
|
||||||
unless length $config->{id}
|
or !length $config->{label}) {
|
||||||
and length $config->{label};
|
|
||||||
|
error "bad config to register_${nav}_item";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $item (@{ $stash }) {
|
foreach my $item (@{ $stash }) {
|
||||||
if ($item->{id} eq $config->{id}) {
|
if ($item->{id} eq $config->{id}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user