[Rt-commit] r15019 - rt/3.8/trunk/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Mon Aug 11 18:35:04 EDT 2008
Author: ruz
Date: Mon Aug 11 18:35:04 2008
New Revision: 15019
Modified:
rt/3.8/trunk/lib/RT/Plugin.pm
Log:
* add Path method in lib/RT/Plugin.pm
Modified: rt/3.8/trunk/lib/RT/Plugin.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Plugin.pm (original)
+++ rt/3.8/trunk/lib/RT/Plugin.pm Mon Aug 11 18:35:04 2008
@@ -60,7 +60,8 @@
=head2 new
-Instantiate a new RT::Plugin object. Takes a paramhash. currently the only key it cares about is 'name', the name of this plugin.
+Instantiate a new L<RT::Plugin> object. Takes a paramhash. currently the only key
+it cares about is 'name', the name of this plugin.
=cut
@@ -83,26 +84,37 @@
return $self->{name};
}
+=head2 Path
+
+Takes a name of sub directory and returns its full path, for example:
+
+ my $plugin_etc_dir = $plugin->Path('etc');
+
+See also L</ComponentRoot>, L</PoDir> and other shortcut methods.
+
+=cut
+
+sub Path {
+ my $self = shift;
+ my $sub = shift;
+ return $self->_BasePath ."/$sub";
+}
+
sub _BasePath {
my $self = shift;
my $base = $self->{'name'};
$base =~ s/::/-/g;
return $RT::LocalPluginPath."/".$base;
-
}
=head2 ComponentRoot
-Returns the directory this plugin has installed its HTML::Mason templates into
+Returns the directory this plugin has installed its L<HTML::Mason> templates into
=cut
-sub ComponentRoot {
- my $self = shift;
-
- return $self->_BasePath."/html";
-}
+sub ComponentRoot { return $_[0]->Path('html') }
=head2 PoDir
@@ -110,10 +122,6 @@
=cut
-sub PoDir {
- my $self = shift;
- return $self->_BasePath."/po";
-
-}
+sub PoDir { return $_[0]->Path('po') }
1;
More information about the Rt-commit
mailing list