diff options
Diffstat (limited to 'lib/URI/sbo.pm')
-rw-r--r-- | lib/URI/sbo.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/URI/sbo.pm b/lib/URI/sbo.pm index 883d659..6594c99 100644 --- a/lib/URI/sbo.pm +++ b/lib/URI/sbo.pm @@ -1,5 +1,6 @@ package URI::sbo; use parent 'URI::_generic'; +use File::Spec::Unix; sub branch { my $self = shift; @@ -15,6 +16,16 @@ sub path { return $ret; } +sub _pathcomp { + my ($self, $n) = @_; + # The array layout is: + # ($category, $package, @path) + return (File::Spec::Unix->splitdir($self->path))[$n]; +} + +sub category { shift->_pathcomp(0) } +sub package { shift->_pathcomp(1) } + 1; __END__ |