Dist::Zilla::Role::File - something that can act like a file


Dist-Zilla documentation Contained in the Dist-Zilla distribution.

Index


Code Index:

NAME

Top

Dist::Zilla::Role::File - something that can act like a file

VERSION

Top

version 4.200008

DESCRIPTION

Top

This role describes a file that may be written into the shipped distribution.

ATTRIBUTES

Top

name

This is the name of the file to be written out.

added_by

This is a string describing when and why the file was added to the distribution. It will generally be set by a plugin implementing the FileInjector role.

mode

This is the mode with which the file should be written out. It's an integer with the usual chmod semantics. It defaults to 0644.

AUTHOR

Top

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

Top


Dist-Zilla documentation Contained in the Dist-Zilla distribution.

package Dist::Zilla::Role::File;
BEGIN {
  $Dist::Zilla::Role::File::VERSION = '4.200008';
}
# ABSTRACT: something that can act like a file
use Moose::Role;

use Moose::Util::TypeConstraints;

use namespace::autoclean;


has name => (
  is   => 'rw',
  isa  => 'Str', # Path::Class::File?
  required => 1,
);


has added_by => (
  is => 'ro',
);


my $safe_file_mode = subtype(
  as 'Int',
  where   { not( $_ & 0002) },
  message { "file mode would be world-writeable" }
);

has mode => (
  is      => 'rw',
  isa     => $safe_file_mode,
  default => 0644,
);

requires 'content';

no Moose::Role;
1;

__END__