App-orgdaemon
view release on metacpan or search on metacpan
bin/org2ical view on Meta::CPAN
}
sub _get_old_or_new {
my($new_vcal, $old_vcal) = @_;
my($new_vcal_cmp, $old_vcal_cmp);
for my $def (
[$new_vcal, \$new_vcal_cmp],
[$old_vcal, \$old_vcal_cmp],
) {
my($src, $destref) = @$def;
for my $l (split /\n/, $src) {
if ($l !~ m{^(CREATED|DTSTAMP|LAST-MODIFIED):}) {
$$destref .= $l;
$$destref .= "\n";
}
}
}
if ($new_vcal_cmp eq $old_vcal_cmp) {
$old_vcal;
} else {
$new_vcal;
}
}
sub geo_to_url {
my($lat,$lon,$zoom,$link_title) = @_;
$zoom = 15 if !defined $zoom;
my $url = sprintf "https://www.openstreetmap.org/?mlat=%s&mlon=%s#map=%s/%s/%s", $lat, $lon, $zoom, $lat, $lon;
if (defined $link_title) {
"$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";
};
utime $stat[8], $stat[9], $dest
or warn "Can't utime $dest to " .
scalar(localtime $stat[8]) . "/" .
scalar(localtime $stat[9]) .
": $!";
}
# REPO END
# REPO BEGIN
# REPO NAME is_in_path /home/eserte/src/srezic-repository
# REPO MD5 4be1e368fea0fa9af4e89256a9878820
#=head2 is_in_path($prog)
#
#=for category File
#
#Return the pathname of $prog, if the program is in the PATH, or undef
#otherwise.
#
#=cut
sub is_in_path {
my($prog) = @_;
require File::Spec;
if (File::Spec->file_name_is_absolute($prog)) {
if ($^O eq 'MSWin32') {
return $prog if (-f $prog && -x $prog);
return "$prog.bat" if (-f "$prog.bat" && -x "$prog.bat");
return "$prog.com" if (-f "$prog.com" && -x "$prog.com");
return "$prog.exe" if (-f "$prog.exe" && -x "$prog.exe");
return "$prog.cmd" if (-f "$prog.cmd" && -x "$prog.cmd");
} else {
return $prog if -f $prog and -x $prog;
}
}
require Config;
%Config::Config = %Config::Config if 0; # cease -w
my $sep = $Config::Config{'path_sep'} || ':';
foreach (split(/$sep/o, $ENV{PATH})) {
if ($^O eq 'MSWin32') {
# maybe use $ENV{PATHEXT} like maybe_command in ExtUtils/MM_Win32.pm?
return "$_\\$prog" if (-f "$_\\$prog" && -x "$_\\$prog");
return "$_\\$prog.bat" if (-f "$_\\$prog.bat" && -x "$_\\$prog.bat");
return "$_\\$prog.com" if (-f "$_\\$prog.com" && -x "$_\\$prog.com");
return "$_\\$prog.exe" if (-f "$_\\$prog.exe" && -x "$_\\$prog.exe");
return "$_\\$prog.cmd" if (-f "$_\\$prog.cmd" && -x "$_\\$prog.cmd");
} else {
return "$_/$prog" if (-x "$_/$prog" && !-d "$_/$prog");
}
}
undef;
}
# REPO END
return 1 if caller;
require Getopt::Long;
( run in 2.225 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )