mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
SMUtils.pm: update to version 1.20.0
git-svn-id: https://svn.fhem.de/fhem/trunk@23016 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1602ea563a
commit
5d61767b0c
@ -41,7 +41,7 @@ use FHEM::SynoModules::ErrCodes qw(:all); # Erro
|
||||
use GPUtils qw( GP_Import GP_Export );
|
||||
use Carp qw(croak carp);
|
||||
|
||||
use version; our $VERSION = version->declare('1.19.3');
|
||||
use version; our $VERSION = version->declare('1.20.0');
|
||||
|
||||
use Exporter ('import');
|
||||
our @EXPORT_OK = qw(
|
||||
@ -49,6 +49,7 @@ our @EXPORT_OK = qw(
|
||||
delClHash
|
||||
delReadings
|
||||
trim
|
||||
slurpFile
|
||||
moduleVersion
|
||||
sortVersion
|
||||
showModuleInfo
|
||||
@ -235,6 +236,31 @@ sub trim {
|
||||
return $str;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# File in einem Gang einlesen (schlürfen)
|
||||
###############################################################################
|
||||
sub slurpFile {
|
||||
my $name = shift // carp $carpnoname && return 417;
|
||||
my $file = shift // carp "got no filename to slurp" && return 417;
|
||||
|
||||
my $errorcode = 0;
|
||||
my $content = q{};
|
||||
my $fh;
|
||||
|
||||
open $fh, '<', "$file" or do { Log3($name, 2, qq{$name - cannot open local File "$file": $!});
|
||||
close ($fh) if($fh);
|
||||
$errorcode = 9002;
|
||||
};
|
||||
if(!$errorcode) {
|
||||
local $/ = undef; # enable slurp mode, locally
|
||||
$content = <$fh>;
|
||||
|
||||
close ($fh);
|
||||
}
|
||||
|
||||
return ($errorcode, $content);
|
||||
}
|
||||
|
||||
#############################################################################################
|
||||
# liefert die Versionierung des Moduls zurück
|
||||
# Verwendung mit Packages: use version 0.77; our $VERSION = moduleVersion ($params)
|
||||
|
Loading…
Reference in New Issue
Block a user