App-orgdaemon

 view release on metacpan or  search on metacpan

bin/org-daemon  view on Meta::CPAN

		delete $ref->{$k};
	    }
	}
    }
}

sub check_for_updates {
    my $changes = 0;
    for my $org_file (keys %org_files) {
	my $org_data = $org_files{$org_file};
	my($modtime) = (stat($org_file))[9];
	if (!defined $modtime) {
	    # non-existing file
	    $org_data->{modified} = $modtime;
	    $org_data->{dates} = [];
	    open_warning($org_file);
	    $changes++;
	    next;
	}
	delete $open_warning{$org_file};
	if (!$org_data->{modified} || $org_data->{modified} < $modtime) {

bin/org2ical  view on Meta::CPAN

		    }
		    $current_uid = $1;
		}
		$current_event .= $_;
	    }
	}
    }

    my $ofh = File::Temp->new(TEMPLATE => 'org2ical-XXXXXXXX', DIR => dirname($out_ics), SUFFIX => '.ics');
    if (-e $out_ics) {
	copy_stat($out_ics, $ofh->filename);
    }
    binmode $ofh, ':encoding(utf-8)';
    print $ofh <<EOF;
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//Slaven Rezic//NONSGML rezic.de org2ical $VERSION//EN
EOF

    my $hostname = defined $domain_id ? $domain_id : _hostname();

    for my $todo_file (@todo_files) {
	my $todo_mtime = (stat($todo_file))[9];
	my @todo_dates = App::orgdaemon::find_dates_in_org_file($todo_file, include_timeless => 1, time_fallback => '00:00');
    HANDLE_TODO_ITEM: for my $todo_date (reverse @todo_dates) {
	    if ($include_tags_rx) {
		if ($todo_date->{text} !~ $include_tags_rx) {
		    next HANDLE_TODO_ITEM;
		}
	    }
	    if ($exclude_tags_rx) {
		if ($todo_date->{text} =~ $exclude_tags_rx) {
		    next HANDLE_TODO_ITEM;

bin/org2ical  view on Meta::CPAN

	"$url ($link_title)";
    } else {
	$url;
    }
}

# REPO BEGIN
# REPO NAME copy_stat /home/eserte/src/srezic-repository 
# REPO MD5 f567def1f7ce8f3361e474b026594660

#=head2 copy_stat($src, $dest)
#
#=for category File
#
#Copy stat information (owner, group, mode and time) from one file to
#another. If $src is an array reference, then this is used as the
#source stat information.
#
#=cut

sub copy_stat {
    my($src, $dest) = @_;
    my @stat = ref $src eq 'ARRAY' ? @$src : stat($src);
    die "Can't stat $src: $!" if !@stat;

    chmod $stat[2], $dest
	or warn "Can't chmod $dest to " . sprintf("0%o", $stat[2]) . ": $!";
    chown $stat[4], $stat[5], $dest
	or do {
	    my $save_err = $!; # otherwise it's lost in the get... calls
	    warn "Can't chown $dest to " .
		 (getpwuid($stat[4]))[0] . "/" .
                 (getgrgid($stat[5]))[0] . ": $save_err";



( run in 0.502 second using v1.01-cache-2.11-cpan-49f99fa48dc )