my $isOpen = open($handle, $templateLocation); if (!-e $templateLocation || !$isOpen) { my $exception = MidTier::Exception->new("2", "Error opening file for reading: $templateLocation", $self); close($handle); $exception->sendLog(); } else { $logger->debug("File $templateLocation opened"); } $logger->info("Building template: $template"); while(my $line = readline($handle)) { if (!$line || $!) { $logger->error("Error reading line from file: $!"); } else { if ($line =~ s/#((:?\w|\d)+)#/$templateValuesHash{$1}/g) { $logger->debug("Replacing #$1# by $templateValuesHash{$1} on template"); } $compiledTemplate .= $line; } } return $compiledTemplate;