Perlito5
view release on metacpan or search on metacpan
lib/Perlito5/JavaScript3/IO.pm view on Meta::CPAN
use v5;
package Perlito5::JavaScript3::IO;
sub emit_javascript3 {
return <<'EOT';
//
//
// lib/Perlito5/JavaScript3/IO.js
//
// I/O functions for "Perlito" Perl5-in-JavaScript3
//
// AUTHORS
//
// Flavio Soibelmann Glock fglock@gmail.com
//
// COPYRIGHT
//
// Copyright 2009, 2010, 2011, 2012 by Flavio Soibelmann Glock and others.
//
// This program is free software; you can redistribute it and/or modify it
// under the same terms as Perl itself.
//
// See http://www.perl.com/perl/misc/Artistic.html
var isNode = typeof require != "undefined";
if (isNode) {
var fs = require("fs");
p5atime = function(s) {
s = p5str(s);
try {
var stat = fs.statSync(s); return stat["atime"];
}
catch(err) {
return '';
}
};
p5mtime = function(s) {
s = p5str(s);
try {
var stat = fs.statSync(s); return stat["mtime"];
}
catch(err) {
return '';
}
};
p5ctime = function(s) {
s = p5str(s);
try {
var stat = fs.statSync(s); return stat["ctime"];
}
catch(err) {
return '';
}
};
p5size = function(s) {
s = p5str(s);
try {
var stat = fs.statSync(s); return stat["size"];
}
catch(err) {
return '';
}
};
p5is_file = function(s) {
s = p5str(s);
try {
var stat = fs.statSync(s); return stat.isFile() ? 1 : 0;
}
catch(err) {
return '';
}
};
p5is_directory = function(s) {
s = p5str(s);
try {
var stat = fs.statSync(s); return stat.isDirectory() ? 1 : 0;
}
catch(err) {
return '';
}
};
p5file_exists = function(s) {
s = p5str(s);
return p5is_file(s) || p5is_directory(s);
};
( run in 0.530 second using v1.01-cache-2.11-cpan-39bf76dae61 )