version 1.5, 2016/12/13 21:37:35
|
version 1.6, 2023/08/23 20:43:34
|
Line 28
|
Line 28
|
### |
### |
|
|
package Apache::daxesave; |
package Apache::daxesave; |
|
use strict; |
|
|
use Apache::Constants; |
use Apache::Constants qw(:common); |
use Apache::lonnet; |
use Apache::lonnet; |
use Try::Tiny; |
use Try::Tiny; |
use File::Copy; |
use File::Copy; |
Line 99 sub handler {
|
Line 100 sub handler {
|
if (-e $newpath) { |
if (-e $newpath) { |
copy($newpath, $filebak); # errors ignored |
copy($newpath, $filebak); # errors ignored |
} |
} |
open my $out, $mode, $newpath; |
if (open(my $out, $mode, $newpath)) { |
print $out $contents; |
print $out $contents; |
close $out; |
close $out; |
|
$request->print("ok\n"); |
$request->print("ok\n"); |
} else { |
|
$request->print("error\nFailed to open file to save $path"); |
|
} |
return OK; |
return OK; |
} |
} |
|
|