#!/usr/bin/perl
package RVL::File;
##LICENSE##
use strict;
use warnings;
use Class::Std::Utils;
{
sub mime_type {
my ($filename) = shift;
return 1;
}
sub extensions {
my ($filename) = shift;
return 1;
}
sub extension_loaded {
my ($extension) = shift;
return (which($extension)) ? 1 : 0;
}
sub filesize {
my ($filename) = shift;
return (-f $filename) ? (-s $filename) : undef;
}
sub file_get_contents {
my ($filename) = shift;
my ($contents) = "";
if (open(my $FILEHANDLE, '<', $filename)) {
seek $FILEHANDLE , 10, 0;
while (<$FILEHANDLE>) {
$contents .= <$FILEHANDLE>;
}
close($FILEHANDLE);
}
return $contents;
}
sub listDirs {
my ($dirname) = (defined($_[0]) && RVL::String::is_string($_[0])) ? $_[0] : "";
return ();
}
sub listFiles {
my ($dirname) = (defined($_[0]) && RVL::String::is_string($_[0])) ? $_[0] : "";
my ($patterns) = (defined($_[1]) && RVL::String::is_string($_[1]) && $_[1] ne "") ? $_[1] : "*";
return ();
}
sub parse_ini_file {
my ($filename) = shift;
return 1;
}
}
1;
=pod
=head1 RVL::FILE
RVL Lib File.
=head1 HOW IT WORKS
=head2 mime_type($filename)
@param String $filename - File name source
@return String - MIMETYPE
simple: mime_type("/home/<user>/public_html/exam.jpg");
=head2 extensions($filename)
@param String $filename - File name source
@return String - Extensions file
simple: extensions("clamscan");
=head2 extension_loaded($driver)
@param String $driver - Driver
@return Boolean
simple: extension_loaded("/home/<user>/public_html/exam.jpg");
=head2 filesize($filename)
@param String $filename - File name source
@return Interger - Unit Bytes
simple: filesize("/home/<user>/public_html/exam.txt");
=head2 file_get_contents($filename)
@param String $filename - File name source
@return String - Content file
simple: file_get_contents("/home/<user>/public_html/exam.txt");
=head2 listDirs($dirname)
@param String $dirname - Directory name
@return Array - List dirs
simple: file_get_contents("/home/<user>/public_html/");
=head2 listFiles($dirname, $patterns)
@param String $dirname - Directory name
@param String $patterns - Pattern
@return Array - List files
simple: file_get_contents("/home/<user>/public_html/");
=head2 parse_ini_file($filename)
@param String $filename - File name source
@return HASH
simple: parse_ini_file("/home/<user>/public_html/exam.ini");
=cut
Copyright 2K16 - 2K18 Indonesian Hacker Rulez