Aion-Annotation
view release on metacpan or search on metacpan
lib/Aion/Annotation.pm view on Meta::CPAN
use Aion::Fs qw/find erase mkpath path mtime from_pkg to_pkg/;
use POSIX qw/strftime/;
use Time::Local qw/timelocal/;
use Aion;
with qw/Aion::Run/;
# ÐÐ¾Ð´Ð¾Ð²Ð°Ñ Ð±Ð°Ð·Ð° Ð´Ð»Ñ ÑканиÑованиÑ
has lib => (is => 'ro', isa => ArrayRef[Str], arg => '-l', default => LIB);
# ÐиÑекÑоÑÐ¸Ñ ÐºÑда ÑоÑ
ÑанÑÑÑ ÑÐ°Ð¹Ð»Ñ Ð°Ð½Ð½Ð¾ÑаÑий
has ini => (is => 'ro', isa => Str, arg => '-i', default => INI);
# ÐÑоÑÑо ÑÑиÑаÑÑ Ð°Ð½Ð½Ð¾ÑаÑии
has force => (is => 'ro', isa => Bool, arg => '-f', default => 0);
# ÐнноÑаÑии: annotation_name.pkg.sub_or_has_name => [[line, annotation_desc]...]
has ann => (is => 'ro', isa => HashRef[HashRef[HashRef[ArrayRef[Tuple[Int, Str]]]]], default => sub {
my $self = shift;
my %ann;
return \%ann if $self->force;
return \%ann if !-d(my $ini = $self->ini);
while(<$ini/*.ann>) {
my $path = $_;
my $annotation_name = path()->{name};
open my $f, "<:utf8", $_ or do { warn "$_ not opened: $!"; next };
lib/Aion/Annotation.pm view on Meta::CPAN
close $f;
}
\%ann
});
# ÐÑÑÑ Ðº ÑÐ°Ð¹Ð»Ñ Ñ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑаÑиÑми
has remark_path => (is => 'ro', isa => Str, default => sub { shift->ini . "/remarks.ini" });
# ÐомменÑаÑии: pkg.sub_or_has_name => [[line, remark]...]
has remark => (is => 'ro', isa => HashRef[HashRef[Tuple[Int, ArrayRef[Str]]]], default => sub {
my ($self) = @_;
my %remark;
return \%remark if $self->force;
my $remark_path = $self->remark_path;
return \%remark if !-e $remark_path;
open my $f, "<:utf8", $remark_path or do { warn "$remark_path not opened: $!"; return \%remark };
while(<$f>) {
warn "$remark_path corrupt on line $.!" unless /^([\w:]+)#(\w*),(\d+)=(.*)$/;
lib/Aion/Annotation.pm view on Meta::CPAN
}
close $f;
\%remark
});
# ÐÑÑÑ Ðº ÑÐ°Ð¹Ð»Ñ Ñ Ð²Ñеменем поÑледнего доÑÑÑпа к модÑлÑм
has modules_mtime_path => (is => 'ro', isa => Str, default => CACHE . "/modules.mtime.ini");
# ÐÑÐµÐ¼Ñ Ð¿Ð¾Ñледнего доÑÑÑпа к модÑлÑм: pkg => unixtime
has modules_mtime => (is => 'ro', isa => HashRef[Int], default => sub {
my ($self) = @_;
my %mtime;
return \%mtime if $self->force;
my $mtime_path = $self->modules_mtime_path;
return \%mtime if !-e $mtime_path;
open my $f, "<:utf8", $mtime_path or do { warn "$mtime_path not opened: $!"; return 0 };
while(<$f>) {
( run in 0.402 second using v1.01-cache-2.11-cpan-54c9f92691d )