Skip to content
Snippets Groups Projects
Commit ec182cf8 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

perlovy modul pro ziskavani struktur z konfiguracnich soouboru

parent b2b212fb
No related branches found
No related tags found
No related merge requests found
# perlCommon.pm
#
# Copyright (C) 2011-2014 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
package perlCommon;
use warnings;
use strict;
################################################################################
# VARIABLES
################################################################################
our $VERSION = "2.2";
################################################################################
# FUNCTIONS
################################################################################
sub getConfHash {
my $arg = shift;
my $hash;
our %VALID_STRINGS;
require $arg;
while (my ($key, $value_ref) = each %VALID_STRINGS) {
$hash .= " \"$key\" => [\"$value_ref->[0]\"";
shift($value_ref);
foreach my $element (@$value_ref) {
$hash .= ", \"$element\"";
}
$hash .= "],\n";
}
print $hash;
}
sub getConfArrayPre {
my $arg = shift;
my $array;
our @SQL_PRECONDITION;
require $arg;
foreach my $element (@SQL_PRECONDITION) {
$array .= "'$element', ";
}
print $array;
}
sub getConfArrayPost {
my $arg = shift;
my $array;
our @SQL_POSTCONDITION;
require $arg;
foreach my $element (@SQL_POSTCONDITION) {
$array .= "'$element', ";
}
print $array;
}
sub getConfArrayQueries {
my $arg = shift;
my $array;
our @SQL_QUERIES;
require $arg;
foreach my $hash_ref (@SQL_QUERIES) {
$array .= "{";
while (my ($key, $value_ref) = each $hash_ref) {
$array .= "$key => \"$value_ref\", ";
}
$array .= "},\n";
}
print $array;
}
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment