/usr/share/perl5/Graphics/Primitive/Insets.pm is in libgraphics-primitive-perl 0.67-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | package Graphics::Primitive::Insets;
use Moose;
use MooseX::Storage;
with 'Geometry::Primitive::Equal';
with 'MooseX::Clone';
with Storage (format => 'JSON', io => 'File');
use Moose::Util::TypeConstraints;
coerce 'Graphics::Primitive::Insets'
=> from 'ArrayRef'
=> via {
Graphics::Primitive::Insets->new(
top => $_->[0], right => $_->[1],
bottom => $_->[2], left => $_->[3]
)
};
coerce 'Graphics::Primitive::Insets'
=> from 'Num'
=> via {
Graphics::Primitive::Insets->new(
top => $_, right => $_,
bottom => $_, left => $_
)
};
has 'top' => ( is => 'rw', isa => 'Num', default => 0 );
has 'bottom' => ( is => 'rw', isa => 'Num', default => 0 );
has 'left' => ( is => 'rw', isa => 'Num', default => 0 );
has 'right' => ( is => 'rw', isa => 'Num', default => 0 );
sub as_array {
my ($self) = @_;
return ($self->top, $self->right, $self->bottom, $self->left);
}
sub equal_to {
my ($self, $other) = @_;
return ($self->top == $other->top) && ($self->bottom == $other->bottom)
&& ($self->left == $other->left) && ($self->right == $other->right);
}
sub width {
my ($self, $width) = @_;
$self->top($width); $self->bottom($width);
$self->left($width); $self->right($width);
}
sub zero {
my ($self) = @_;
$self->width(0);
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=head1 NAME
Graphics::Primitive::Insets - Space between things
=head1 DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds
something. This object can be used to represent either padding or margins
(in the CSS sense, one being inside the bounding box, the other being outside)
=head1 SYNOPSIS
use Graphics::Primitive::Insets;
my $insets = Graphics::Primitive::Insets->new({
top => 5,
bottom => 5,
left => 5,
right => 5
});
=head1 METHODS
=head2 Constructor
=over 4
=item I<new>
Creates a new Graphics::Primitive::Insets.
=back
=head2 Instance Methods
=over 4
=item I<as_array>
Return these insets as an array in the form of top, right, bottom and left.
=item I<bottom>
Set/Get the inset from the bottom.
=item I<equal_to>
Determine if these Insets are equal to another.
=item I<left>
Set/Get the inset from the left.
=item I<right>
Set/Get the inset from the right.
=item I<top>
Set/Get the inset from the top.
=item I<zero>
Sets all the insets (top, left, bottom, right) to 0.
=back
=head1 AUTHOR
Cory Watson, C<< <gphat@cpan.org> >>
=head1 SEE ALSO
perl(1)
=head1 COPYRIGHT & LICENSE
Copyright 2008-2010 by Cory G Watson.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|