extract path from full_path if missing
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 18 Dec 2013 15:10:11 +0000 (16:10 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 18 Dec 2013 15:10:11 +0000 (16:10 +0100)
lib/MojoFacets/Import/File.pm

index 503be1d..926937f 100644 (file)
@@ -19,6 +19,10 @@ sub data {
        my $self = shift;
 
        my $path = $self->path;
+       if ( ! $path ) {
+               $path = $self->full_path || die "no path or full_path";
+               $path =~ s{^.+/([^/]+)$}{$1};
+       }
 
        # we could use Mojo::JSON here, but it's too slow
 #      $data = from_json read_file $path;