Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: McAfee False Positive

by SavannahLion (Pilgrim)
on Apr 08, 2010 at 13:03 UTC ( [id://833528] : note . print w/replies, xml ) Need Help??


in reply to Re: McAfee False Positive
in thread McAfee False Positive

That's kind of what I'm doing now, but I'll modify the code not to reference $0 and use some other name and see if that stops triggering McAfee. It's worth a looksee

Replies are listed 'Best First'.
Re^3: McAfee False Positive
by Marshall (Canon) on Apr 13, 2010 at 12:02 UTC
    You can "read yourself" and write a newfile with perhaps modified contents of yourself, but you cannot write over yourself. I am running McAfee and the below works.
    #!/usr/bin/perl -w use strict; my $path = $0; print "reading: $path\n"; open (my $in, '<', $path) or die "cannot open $path"; open (my $out, '>', "$path.new") or die "cannot open \"$path.new\""; while (<$in>) { print; print $out $_; } __END__ from STDOUT: reading: C:\TEMP\scratch.pl #!/usr/bin/perl -w use strict; my $path = $0; print "reading: $path\n"; open (my $in, '<', $path) or die "cannot open $path"; open (my $out, '>', "$path.new") or die "cannot open \"$path.new\""; while (<$in>) { print; print $out $_; } __END__ from cat, i.e. type in Win lingo: C:\TEMP>cat scratch.pl.new #!/usr/bin/perl -w use strict; my $path = $0; print "reading: $path\n"; open (my $in, '<', $path) or die "cannot open $path"; open (my $out, '>', "$path.new") or die "cannot open \"$path.new\""; while (<$in>) { print; print $out $_; } __END__