From 14cd9fc2fb53401255228035ec9fca590d28408f Mon Sep 17 00:00:00 2001 From: hjp Date: Sat, 10 Feb 2007 22:05:25 +0000 Subject: [PATCH] metastr needs to be called with unquoted filename. --- lib/Simba/DA.pm | 12 +++++++++++- t/00_da.t | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Simba/DA.pm b/lib/Simba/DA.pm index 03eede2..ec5745d 100644 --- a/lib/Simba/DA.pm +++ b/lib/Simba/DA.pm @@ -105,7 +105,7 @@ sub list { $fn = quote($fn); $fh_out->print($fn); - $fh_out->print($self->metastr($fn, $st)); + $fh_out->print($self->metastr($File::Find::name, $st)); $fh_out->print("\n"); }, @@ -220,6 +220,16 @@ sub get { } +=head2 metastr($fn, $st) + +Return a string with meta information for File $fn. +The filename must be in native (unquoted) format. +Most meta information is taken from the File::stat object $st, but metastr may +also get other meta information from the filename (for example, it will call +readlink($fn) if it is a symlink). If $st is omitted, metastr will call lstat. + +=cut + sub metastr { my ($self, $fn, $st) = @_; $st = lstat($fn) unless defined($st); diff --git a/t/00_da.t b/t/00_da.t index b09e9d1..bbf7823 100644 --- a/t/00_da.t +++ b/t/00_da.t @@ -2,7 +2,7 @@ use warnings; use strict; -use Test::More tests => 21; +use Test::More tests => 22; BEGIN { use_ok( 'Simba::DA' ); } @@ -19,6 +19,7 @@ cmp_ok($list, '=~', qr{^\. .* t=d }m, 'root is a directory'); cmp_ok($list, '=~', qr{^\./test.txt .* t=f s=14 }m, 'text file found'); cmp_ok($list, '=~', qr{^\./test.bin .* t=f s=1024 }m, 'binary file found'); cmp_ok($list, '=~', qr{^\./test.link .* t=l .* lt=test.bin( |$)}m, 'symlink found'); +cmp_ok($list, '=~', qr{^\./ABAecom_=sub.__Am._Bankers_Assn.=_Root_CA.pem .* t=l .* lt=/usr/share/ca-certificates/mozilla/ABAecom_=sub.__Am._Bankers_Assn.=_Root_CA.crt( |$)}m, 'symlink found'); my $result; open($fh, '>', \$result);