Almost-minimal filesystem based blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
774 B

  1. package App::WRT::Mock::FileIO;
  2. # Partially mock FileIO (the write operations - reads are still done as
  3. # usual).
  4. use strict;
  5. use warnings;
  6. use Carp;
  7. use App::WRT::Util;
  8. sub new {
  9. my $class = shift;
  10. my %params = (
  11. 'io' => App::WRT::FileIO->new(),
  12. 'file_contents' => { },
  13. );
  14. my $self = \%params;
  15. bless $self, $class;
  16. }
  17. sub dir_list {
  18. my $self = shift;
  19. return $self->{io}->dir_list(@_);
  20. }
  21. sub file_put_contents {
  22. my $self = shift;
  23. my ($file, $contents) = @_;
  24. $self->{file_contents}->{$file} = $contents;
  25. }
  26. sub file_get_contents {
  27. my $self = shift;
  28. return $self->{io}->file_get_contents(@_);
  29. }
  30. sub file_copy {
  31. my ($self, $source, $dest) = @_;
  32. }
  33. sub dir_make {
  34. my ($self, $path) = @_;
  35. my $path_err;
  36. return 1;
  37. }
  38. 1;