/usr/share/perl5/Scrappy/Project/Document.pm is in libscrappy-perl 0.94112090-2.
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 | package Scrappy::Project::Document;
BEGIN {
$Scrappy::Project::Document::VERSION = '0.94112090';
}
use Moose::Role;
has fields => (
is => 'ro',
isa => 'ArrayRef',
default => sub {
my $self = shift;
#die Data::Dumper::Dumper((shift->meta->get_all_methods)[1]);
my @fields = ();
for ($self->meta->get_all_methods) {
push @fields, $_->name
if $_->package_name eq ref $self
&& $_->name ne 'meta'
&& $_->name ne 'scraper'
&& $_->name ne 'fields'
&& $_->name ne 'parse'
&& $_->name ne 'records'
&& $_->name ne 'url';
##### NOTE !!!!!! The list above must always contain a list
##### of all attributes and function in this role
}
return [@fields];
}
);
has records => (
is => 'rw',
isa => 'ArrayRef',
default => sub { [] }
);
has scraper => (
is => 'rw',
isa => 'Scrappy'
);
sub parse {
my ($self, $vars) = @_;
my $record = {};
map { $record->{$_} = $self->$_($self->scraper, $vars) } @{$self->fields};
# $record->{url} = $self->scraper->url->as_string;
push @{$self->records}, $record;
return $record;
}
1;
|