root/trunk/PluginManager/plugins/PluginManager/lib/PluginManager/Util.pm @ 1

Revision 1, 0.8 kB (checked in by breese, 4 years ago)

added PluginManager?

Line 
1package PluginManager::Util;
2
3use strict;
4use vars qw(@EXPORT_OK @ISA);
5require Exporter;
6@EXPORT_OK = qw(debug scrub_path);
7@ISA = qw(Exporter);
8
9#####################################################################
10# UTILITY SUBROUTINES
11#####################################################################
12
13sub debug {
14    my $err = shift;
15    my $mark = shift || '>';
16    print STDERR "$mark $err\n" if $MT::Plugin::PluginManager::DEBUG;
17}
18
19sub scrub_path {
20    my ($path) = @_;
21    require File::Spec;
22    my @dirs = File::Spec->splitdir($path);
23    my @newdirs;
24    foreach (@dirs) {
25        if ($_ eq '..') {
26            pop @newdirs;
27        } elsif ($_ eq '.') {
28            # do nothing
29        } else {
30            push @newdirs,$_;
31        }
32    }
33    return File::Spec->catdir(@newdirs);
34}
35
361;
Note: See TracBrowser for help on using the browser.