Acme-CatFS

 view release on metacpan or  search on metacpan

lib/Acme/CatFS.pm  view on Meta::CPAN

use strict;
use warnings;
package Acme::CatFS;

# ABSTRACT: Fuse filesystem with a random pic of a cat

use feature qw(say state);
use Carp;
use Try::Tiny;
use LWP::Simple;
use Fuse::Simple;

use Moo;
use MooX::Options;
use Types::Path::Tiny qw(Dir);

option mountpoint => ( 

lib/Acme/CatFS.pm  view on Meta::CPAN

sub run {
  my ($self) = @_;

  if($self->forking){
    fork and exit  
  }

  my $mountpoint = $self->mountpoint;
  my $cat_file   = $self->cat_file;

  say "Initializing Fuse mountpoint '$mountpoint'... ";

  Fuse::Simple::main(
    mountpoint => $mountpoint,
    debug      => $self->debug,
    '/'        => {
      $cat_file => sub {
        $self->_get_cat_picture
      },
    },
  );
}

END {
   say "Don't forget run 'fusermount -u <mountpoint>'"
}

=head1 NAME

Acme::CatFS

=head1 SYNOPSIS

  Acme::CatFS->new(mountpoint => '/tmp/catfs', debug => 0, cat_file => 'kitten.jpg')->run();



( run in 0.676 second using v1.01-cache-2.11-cpan-b85c58fdc1d )