[Bps-public-commit] template-declare branch, master, updated. 1ee89a18f7cc6ee3e11ae8f729704e4704176fc6
Thomas Sibley
trs at bestpractical.com
Mon Jun 21 19:12:49 EDT 2010
The branch, master has been updated
via 1ee89a18f7cc6ee3e11ae8f729704e4704176fc6 (commit)
from e81dbf6acb4e3983e89f40f0abffe96af762f7ce (commit)
Summary of changes:
lib/Template/Declare/Tags.pm | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 1ee89a18f7cc6ee3e11ae8f729704e4704176fc6
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Jun 21 19:13:57 2010 -0400
Add a current_base_path() convenience function
diff --git a/lib/Template/Declare/Tags.pm b/lib/Template/Declare/Tags.pm
index 87d3ffc..10d521c 100644
--- a/lib/Template/Declare/Tags.pm
+++ b/lib/Template/Declare/Tags.pm
@@ -16,7 +16,7 @@ use Symbol 'qualify_to_ref';
our $self;
our @EXPORT = qw(
- template private current_template
+ template private current_template current_base_path
show show_page
attr with get_current_attr
outs outs_raw
@@ -726,6 +726,28 @@ sub current_template {
return $TEMPLATE_STACK[-1] || '';
}
+=head3 current_base_path
+
+ my $path = current_base_path();
+
+Returns the absolute base path of the current template
+
+=cut
+
+sub current_base_path {
+ # Rip it apart
+ my @parts = split('/', current_template());
+
+ # Remove the last element
+ pop @parts;
+
+ # Put it back together again
+ my $path = join('/', @parts);
+
+ # And serve
+ return $path;
+}
+
=head3 under
C<under> is a helper function providing semantic sugar for the C<mix> method
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list