#use strict;
####
if ($imagefile =~ m/src=\"\//i) {
$imagefile = "\/" . $';
}
elsif ($imagefile =~ m/src=\"/i) {
$imagefile = $';
}
####
$imagefile =~ s|src="/?||;
####
$imagefile =~ s|src="/?(.*)"$|/$1|;
####
# check to see if this image file is in the eMedSample path
if ($path =~ m/([a-zA-Z0-9\_\-\/])+MMS-Apps\/eMedSample/i) {
$ImageFilePath = "MMS-Apps/eMedSample/WwwRoot" . $imagefile;
}
####
$path =~ m{[\w/-]+MMS-Apps/eMedSample}i
####
use List::Util qw( first );
my @pattern_prefix = ( { pat => qr{{[\w/-]+MMS-Apps/eMedSample}i,
pre => 'MMS-Apps/eMedSample/WwwRoot', },
{ pat => qr{...}i,
pre => '...' }, );
my $match = first { $path =~ $_->{pat} } @pattern_prefix;
$ImageFilePath = $match ? $match->{pre} . $imagefile
: "Not sure what the path is here: $path\n";
####
# This function in addition to
sub ReportFileFound {
my ($filename, $imagefile, $linenum, $bBuildFilePath) = @_;
####
# call as ReportFileFound({ filename => $fn,
# imagefile => $if,
# linenum => $ln,
# bBuildFilePath => $bBFP, });
sub ReportFileFound {
my $args_ref = shift;
# use $args_ref->{filename} for $filename
####
my $aLength = $#FinalImageFileList + 1;
####
my $aLength = scalar @FinalImageFileList;
####
foreach $tmpImageFile (@FinalImageFileList) {
#its not here so lets insert it...
if ($tmpImageFile eq $ImagePath) {
$bFound = 1;
last;
}
####
$bFound = scalar first { $_ eq $imagePath } @FinalImageFileList;
####
open hFile, $filename or die "Failed to open $filename\n";
####
open hFile, '<', $filename
or die "Can't read '$filename': $!\n";
####
if ($line =~ m/src="([a-zA-Z0-9\_\-\/])+\.(gif|jp[e]?g|bmp)"/i) {
$line = $&;
ReportFileFound($saved_name, $line, $linenum, 1);
}
####
if ($line =~ m{(src="[\w/-]+\.(?:gif|jp[e]?g|bmp)")/i) {
$line = $1;
ReportFileFound($saved_name, $line, $linenum, 1);
}
####
sub CheckForImageReferencesInSQL {
my($server, $username, $password, $DB) = @_;
use MSSQL::Sqllib;
####
foreach $QueryResult (@QueryResult) {
foreach $row (keys %$QueryResult) {
####
@ARGV = (".") unless @ARGV;
####
unlink $g_logfile;
####
or die "Can't unlink '$g_logfile': $!";
####
open hLOGFILE, ">>$g_logfile" or die "Could not open the file $g_logfile\n";
####
open hLOGFILE, '>>', $g_logfile
or die "Could not append to '$g_logfile': $!\n";