Skip to content

Instantly share code, notes, and snippets.

@dblackdblack
Created July 8, 2013 22:53
Show Gist options
  • Save dblackdblack/5953172 to your computer and use it in GitHub Desktop.
Save dblackdblack/5953172 to your computer and use it in GitHub Desktop.
Index: Userdoc.pm
===================================================================
--- Userdoc.pm (revision 38023)
+++ Userdoc.pm (working copy)
@@ -68,7 +68,7 @@
}
for my $file (files($user)) {
- my $data = File::Slurp::read_file($file);
+ my $data = File::Slurp::read_file($file); # BP-1806 ok
# parse out =head2 ... blocks.
my @list = $data =~ /^=head2\s*(.*?)(?=^=)/gms;
for my $str (@list) {
@@ -108,7 +108,7 @@
my $infile = "${dir}/pod${unique}.in";
my $outfile = "${dir}/pod${unique}.out";
- File::Slurp::write_file($infile, "=pod\n$str\n=cut\n");
+ File::Slurp::write_file($infile, "=pod\n$str\n=cut\n"); # BP-1806 ok
# XXX: warning are supressed with --quiet
Pod::Html::pod2html( qw( --noindex --quiet ), "--infile=${infile}", "--outfile=${outfile}" );
Index: ContextUtils.pm
===================================================================
--- ContextUtils.pm (revision 38023)
+++ ContextUtils.pm (working copy)
@@ -47,7 +47,7 @@
my ($id, %args) = @_;
my $context = ContextUtils::getcontext($id) if($id);
- usage() unless($context);
+ be::Ex::ProgrammerError->throw("no \$context") unless($context);
my $contextindex = ContextIndex->get();
my $dryrun = $args{DRYRUN};
@@ -162,7 +162,7 @@
############################################################
if (-e $dir && ! $args{DRYRUN}) {
unlink($dir);
- `rm -rf $dir`;
+ `rm -rf $dir`; # BP-1806 ok
}
};
if ($@) {
@@ -245,7 +245,7 @@
chdir($assetdir);
`tar -cpf $archive_name .`;
- $data = File::Slurp::read_file($archive_name);
+ $data = File::Slurp::read_file($archive_name); # BP-1806 ok
unlink($archive_name);
unlink($object_file);
}
@@ -351,7 +351,7 @@
sub get_fields
{
my($context, %args) = @_;
-
+
if( $context->isa('Article') ) {
$context = $context->get_journal();
}
@@ -486,4 +486,4 @@
die "invalid id: $id" unless $context;
return $context;
}
-1;
+1;
\ No newline at end of file
Index: Incfile.pm
===================================================================
--- Incfile.pm (revision 38023)
+++ Incfile.pm (working copy)
@@ -18,7 +18,7 @@
confess "context is not a ref" unless(ref($context));
for my $td ($context->assetdirs()) {
if (-e "$td/$file") {
- return scalar(read_file("$td/$file"));
+ return scalar(read_file("$td/$file")); # BP-1806 ok
}
}
return undef;
Index: Preview.pm
===================================================================
--- Preview.pm (revision 38023)
+++ Preview.pm (working copy)
@@ -96,7 +96,7 @@
return;
}
- my $text = read_file($template);
+ my $text = read_file($template); # BP-1806 ok
my $m = Magic::do_magic($text,
'FILE' => $template,
@@ -112,9 +112,9 @@
my $buf;
$buf .= ("&&$wrappertag:HEADERFOOTER:0:$wrappertag&&\n");
- $buf .= (read_file(Wrapper::findheader($article))) if $h;
+ $buf .= (read_file(Wrapper::findheader($article))) if $h; # BP-1806 ok
$buf .= ($m);
- $buf .= (read_file(Wrapper::findfooter($article))) if $h;
+ $buf .= (read_file(Wrapper::findfooter($article))) if $h; # BP-1806 ok
my ($body, $header);
#from Wrapper.
Index: M_generate_userdoc.pm
===================================================================
--- M_generate_userdoc.pm (revision 38023)
+++ M_generate_userdoc.pm (working copy)
@@ -37,7 +37,7 @@
my $all;
for my $file (@files) {
- $all .= File::Slurp::read_file($file);
+ $all .= File::Slurp::read_file($file); # BP-1806 ok
}
my $tmp_dir = $Globals::global_temporary_directory;
Index: PDFUtils.pm
===================================================================
--- PDFUtils.pm (revision 38023)
+++ PDFUtils.pm (working copy)
@@ -407,7 +407,7 @@
Log->error("append failed: msg: $msg; error: $?");
die "append failed; appendpdf failed code: $?; msg: $msg";
}
- my $log = read_file($logfile);
+ my $log = read_file($logfile); # BP-1806 ok
Log->debug($log);
Log->debug($xml_params);
unlink($appendfile);
Index: Object/Transaction.pm
===================================================================
--- Object/Transaction.pm (revision 38023)
+++ Object/Transaction.pm (working copy)
@@ -607,7 +607,7 @@
confess("write failed on $file.tmp") unless -s "$file.tmp";
- rename("$file.tmp", $file)
+ rename("$file.tmp", $file) # BP-1806 ok
or die "rename $file.tmp -> $file: $!";
die unless -e $file;
Index: SelectedWorks.pm
===================================================================
--- SelectedWorks.pm (revision 38023)
+++ SelectedWorks.pm (working copy)
@@ -795,7 +795,7 @@
my $subject_area_file = "$assetdir/sw_subject_areas.txt";
my (%final_subject_areas, @old_subject_areas);
if (-s $subject_area_file) {
- my $data = File::Slurp::read_file($subject_area_file);
+ my $data = File::Slurp::read_file($subject_area_file); # BP-1806 ok
@old_subject_areas = Utils::parselines($data, TRIM => 1);
}
Index: Sending.pm
===================================================================
--- Sending.pm (revision 38023)
+++ Sending.pm (working copy)
@@ -106,7 +106,7 @@
return 'To view this mailer, please visit '.$sending->{MESSAGE_CONTEXT_URL}.' .';
}
- return scalar(read_file($sending->dir('body.txt')));
+ return scalar(read_file($sending->dir('body.txt'))); # BP-1806 ok
}
sub get_html_body
{
@@ -128,12 +128,12 @@
my $fname=$announce_context->static_dir().'/index.html';
- if(! -f $fname) {
+ if(! -f $fname) { # BP-1806 ok
confess "$fname does not exist";
}
- copy($fname,$sending->dir('body.html'));
- return scalar(read_file($sending->dir('body.html')));
+ copy($fname,$sending->dir('body.html')); # BP-1806 ok
+ return scalar(read_file($sending->dir('body.html'))); # BP-1806 ok
}
# do this basically for bookkeeping ... write a 'url' file to the sending directory so we know what this sending's URL was
@@ -142,15 +142,15 @@
{
my($sending)=@_;
my $url=$sending->{MESSAGE_CONTEXT_URL};
- Mkdir::rmkdir($sending->dir());
- write_file($sending->dir('url'),"$url\n");
+ Mkdir::rmkdir($sending->dir()); # BP-1806 ok
+ write_file($sending->dir('url'),"$url\n"); # BP-1806 ok
}
sub write_text_body
{
my($sending,$body)=(@_);
- Mkdir::rmkdir($sending->dir());
- write_file($sending->dir('body.txt'), $body);
+ Mkdir::rmkdir($sending->dir()); # BP-1806 ok
+ write_file($sending->dir('body.txt'), $body); # BP-1806 ok
}
sub enqueue
@@ -159,7 +159,7 @@
my $list = MailingList->load($sending->{LIST});
#write out the body.txt file
- Mkdir::rmkdir($sending->dir());
+ Mkdir::rmkdir($sending->dir()); # BP-1806 ok
#$body='body';
#write_file($sending->dir('body.txt'), $body);
@@ -215,7 +215,7 @@
for my $sln (keys %{$l->{'SUBLISTS'}}) {
next unless $l->{'SUBLISTS'}{$sln}{'USE'};
- open(SL, $l->dir("$sln.sublist"))
+ open(SL, $l->dir("$sln.sublist")) # BP-1806 ok
or die qq'open @{[ $l->dir("$sln.sublist")]}: $!';
while(<SL>) {
s/\r?\n$//;
@@ -250,7 +250,7 @@
#we need to normalize up here, because the sort happens between here and the next file.
$addr = TextUtils::trim(lc($addr));
- printf ML "%s %03d%d %s/%s %s\n",
+ printf ML "%s %03d%d %s/%s %s\n", # BP-1806 ok
$addr, ($sln eq 'selfsub' ? '0' : '1'), $listcount, $ln, $sln, $_;
}
close(SL);
@@ -267,15 +267,15 @@
# + sort -o /main/alevinroot/doc/data/sendings/9313/addresses /main/alevinroot/doc/data/sendings/9313/addresses
# to the apache error log -scm 2/11/2005
#system("set -x;sort -o $ml $ml");
- system("sort -o $ml $ml");
+ system("sort -o $ml $ml"); # BP-1806 ok
die "size of list changed during sort" unless $ps == -s $ml;
- open(OLD, "<$ml") or die "open $ml: $!";
- open(NEW, ">$ml.tmp") or die "open $ml.tmp: $!";
+ open(OLD, "<$ml") or die "open $ml: $!"; # BP-1806 ok
+ open(NEW, ">$ml.tmp") or die "open $ml.tmp: $!"; # BP-1806 ok
my $last;
my $buf;
my $best;
- while (<OLD>) {
+ while (<OLD>) { # BP-1806 ok
chomp;
m,^(\S+) (\d+) (\S+)/(\S+) (.*)$,
or die "could not parse $_";
@@ -283,13 +283,13 @@
# XXXX Larry thinks we can do the is_subscribed logic here and just print the $addr to the address file.
# do de-duping here.
next if $addr eq $last;
- print NEW "$addr $rlistid/$sublist $original\n";
+ print NEW "$addr $rlistid/$sublist $original\n"; # BP-1806 ok
$count++;
$last = $addr;
}
close(OLD);
close(NEW);
- rename("$ml.tmp", $ml) or die "rename $ml.tmp $ml: $!";
+ rename("$ml.tmp", $ml) or die "rename $ml.tmp $ml: $!"; # BP-1806 ok
Log->debug("count=$count");
$sending->lockobj(BEGIN_WORK => 1);
@@ -354,10 +354,10 @@
my $sqldb = SQLDb->get();
my $af = $sending->dir('addresses');
- open(AD, "<$af") || die "open $af: $!";
- seek(AD, $upos, 0)
+ open(AD, "<$af") || die "open $af: $!"; # BP-1806 ok
+ seek(AD, $upos, 0) # BP-1806 ok
or die "cannot seek to $af $upos: $!";
- my $x = <AD>;
+ my $x = <AD>; # BP-1806 ok
$x =~ m,^(\S+) (\S+)/(\S+) (.*)$,
or die "could not parse $af at $upos";
my ($addr, $list, $sublist, $original) = ($1, $2, $3, $4);
@@ -422,7 +422,7 @@
my $from = $sending->{FROM} || $sender->name();
my $slist = MailingList->load($sending->{'LIST'});
my $sid = $sending->{'ID'};
- my $template = read_file("$topassetdir/letterWrapper.txt");
+ my $template = read_file("$topassetdir/letterWrapper.txt"); # BP-1806 ok
my $slistid = $slist->{'ID'};
my $context = $sending->context();
my $maildomain = $context->maildomain;
@@ -437,13 +437,13 @@
my $sleepcount = $args{SLEEPCOUNT}; # number of messages to send before sleeping
my $sleeptime = $args{SLEEPTIME}; # number of seconds to sleep
- open(AD, "<$af") || die "open $af: $!";
- seek(AD, $sendpos, 0)
+ open(AD, "<$af") || die "open $af: $!"; # BP-1806 ok
+ seek(AD, $sendpos, 0) # BP-1806 ok
or die "seek $af $sendpos: $!";
while ($sendpos < $al) {
- my $oldpos = tell(AD);
+ my $oldpos = tell(AD); # BP-1806 ok
die "oldpos is undef, that probably means the addresses file went away" unless defined $oldpos;
- my $x = <AD>;
+ my $x = <AD>; # BP-1806 ok
last unless $x;
# pause the sending (and return) when we've realeased as many mails as we should
@@ -479,7 +479,7 @@
# this increments sendpos and examinedcount to next line before sending
# mail so it doesn't get stuck on a user if the message fails -al 2-8-05
- $sendpos = tell(AD);
+ $sendpos = tell(AD); # BP-1806 ok
die "sendpos is less than oldpos" if($sendpos < $oldpos);
$examinedcount++;
if(!$args{DRYRUN}) {
Index: FileUtils.pm
===================================================================
--- FileUtils.pm (revision 38023)
+++ FileUtils.pm (working copy)
@@ -133,7 +133,7 @@
my @data_rows; # list of array refs of data
my @errors; # list of strings outlining errors, if any
- my @data = File::Slurp::read_file($filename);
+ my @data = File::Slurp::read_file($filename); # BP-1806 ok
my $counter = 0;
my $text_csv = Text::CSV_XS->new({binary => 1});
Index: Import.pm
===================================================================
--- Import.pm (revision 38023)
+++ Import.pm (working copy)
@@ -1694,11 +1694,11 @@
}
my $file_data_ref = $response->content_ref();
- if(! scalar(File::Slurp::write_file($tmp_filename, { binmode => ':raw' }, $file_data_ref))) {
+ if(! scalar(File::Slurp::write_file($tmp_filename, { binmode => ':raw' }, $file_data_ref))) { # BP-1806 ok
Log->logconfess("unable to write to file $tmp_filename");
}
- Log->debug("Import fetched $fulltext_url; ".(-s $tmp_filename)." bytes");
+ Log->debug("Import fetched $fulltext_url; ".(-s $tmp_filename)." bytes"); # BP-1806 ok
my($is_image) = Mime::is_image_file($tmp_filename);
my $journal = $article->get_journal();
my $journal_cttype = $journal->{CTTYPE};
@@ -1711,7 +1711,7 @@
my($mime_type) = $response->content_type();
my $f = $mime_type eq 'application/pdf' ? 'text.pdf' : 'text.native';
- my $dest_filename = $article->getfile($f, $now);
+ my $dest_filename = $article->getfile($f, $now); # BP-1806 ok
my $is_word_2007 = Mime::is_word_2007_file(FILENAME => $tmp_filename );
my $is_word_2003 = $is_word_2007 ? 0 : Mime::is_word_2003_file(FILENAME => $tmp_filename);
@@ -1754,7 +1754,7 @@
mime_type => $mime_type,
);
}else{
- FileUtils::cp($tmp_filename, $dest_filename);
+ FileUtils::cp($tmp_filename, $dest_filename); # BP-1806 ok
if(! -f $dest_filename) {
Log->logconfess("copy did not succeed to $dest_filename");
}
@@ -3271,7 +3271,7 @@
# stuff between the <value>...</value> tags.
my(@values);
- my(@xml_file_contents) = File::Slurp::read_file($path_to_file);
+ my(@xml_file_contents) = File::Slurp::read_file($path_to_file); # BP-1806 ok
# this is a multitier multiselect .xml file if "</children>" appears anywhere in the file
my($is_multitier_multiselect) = scalar(grep { $_ =~ m,</children>,i } @xml_file_contents) ? 1 : 0;
@@ -3284,7 +3284,7 @@
}
else { # "normal" dropdown .xml -- do it the right way which is to parse the XML
- my($fh) = IO::File->new($path_to_file)
+ my($fh) = IO::File->new($path_to_file) # BP-1806 ok
|| Log->logconfess("unable to open handle to file $path_to_file");
my($xml) = XML::Simple::XMLin($fh, ForceArray => 1)
@@ -3302,7 +3302,7 @@
return @values;
} else { # is text file
- my(@lines) = File::Slurp::read_file($path_to_file);
+ my(@lines) = File::Slurp::read_file($path_to_file); # BP-1806 ok
chomp(@lines);
@lines = map { TextUtils::trim($_) } @lines;
Index: StampPDF.pm
===================================================================
--- StampPDF.pm (revision 38023)
+++ StampPDF.pm (working copy)
@@ -720,12 +720,12 @@
}
# MAIN-3781 Do not bomb if file is not in search path
- if(-s $cover_template_name) {
+ if(-s $cover_template_name) { # BP-1806 ok
if($args{COVER_TYPE} eq 'tex') {
# MAIN-9790 add in the utf8 package
$cover_magic = '\usepackage[utf8]{inputenc}' . "\n" . File::Slurp::read_file($cover_template_name);
} else {
- $cover_magic = File::Slurp::read_file($cover_template_name);
+ $cover_magic = File::Slurp::read_file($cover_template_name); # BP-1806 ok
}
}
}
@@ -789,7 +789,7 @@
# MAIN-3781 Do not bomb if file is not in search path
if(-s $pagenum_template_name) {
- $pagenum_magic = File::Slurp::read_file($pagenum_template_name);
+ $pagenum_magic = File::Slurp::read_file($pagenum_template_name); # BP-1806
}
}
@@ -832,7 +832,7 @@
}
if(-s $css_template_name) {
- $css_magic = File::Slurp::read_file($css_template_name);
+ $css_magic = File::Slurp::read_file($css_template_name); # BP-1806 ok
} else {
# this is not fatal for TeX title pages
# MAIN-5889 this isn't fatal for prince anymore either. Serving up a PDF
@@ -845,7 +845,7 @@
$bp_log->warn("get_coverpage_css ($local_css_template) preview failure: $error");
}
if(-s $local_css_template_name) {
- $css_magic .= File::Slurp::read_file($local_css_template_name);
+ $css_magic .= File::Slurp::read_file($local_css_template_name); # BP-1806 ok
} else {
# this is not fatal for TeX title pages
# MAIN-5889 this isn't fatal for prince anymore either. Serving up a PDF
@@ -1118,9 +1118,9 @@
print $LOG "\n========== BEGIN FILE\n $filename\n==========\n";
if($args{ENCODING}) {
# currently the stamp command file is cp1252 encoded so we need to be able to log it without bombing
- print $LOG Encode::decode( $args{ENCODING}, scalar(File::Slurp::read_file($filename, binmode => ':raw')) );
+ print $LOG Encode::decode( $args{ENCODING}, scalar(File::Slurp::read_file($filename, binmode => ':raw')) ); # BP-1806 ok
} else {
- print $LOG scalar(File::Slurp::read_file($filename));
+ print $LOG scalar(File::Slurp::read_file($filename)); # BP-1806 ok
}
print $LOG "\n========== END FILE\n $filename\n==========\n\n";
}
Index: ImportQueue.pm
===================================================================
--- ImportQueue.pm (revision 38023)
+++ ImportQueue.pm (working copy)
@@ -277,7 +277,7 @@
my $data;
- $data = File::Slurp::read_file($importFilename, {binmode => ':raw'} );
+ $data = File::Slurp::read_file($importFilename, {binmode => ':raw'} ); # BP-1806 ok
# If this is an XML file, figure out what encoding it is in and
# decode() appropriately. It should ALWAYS be utf-8 by the time
Index: ExportData.pm
===================================================================
--- ExportData.pm (revision 38023)
+++ ExportData.pm (working copy)
@@ -750,7 +750,7 @@
# value, i.e., if the template doesn't exist, there is no "contributor" field in the output
if(my $file = scalar($article->find_file('dc-contributor-field.txt'))) {
my $contributor_field;
- my $template = read_file($file);
+ my $template = read_file($file); # BP-1806 ok
if($template) {
$contributor_field = Magic::do_magic($template, FILE => $asset_name, CONTEXT => $article, TEXT => 1);
}
Index: Article.pm
===================================================================
--- Article.pm (revision 38024)
+++ Article.pm (working copy)
@@ -3437,7 +3437,7 @@
$s->delete_under_path($old_static_dir, $site_key);
}else{
if (-d $old_static_dir) {
- `rm -rf $old_static_dir`;
+ `rm -rf $old_static_dir`; # BP-1806 ok
}
}
}
@@ -9267,7 +9267,7 @@
$decision->{ATTACHMENTS} = $args{ATTACHMENTS},
}
- $article->{EDITORIAL_DECISIONS} //= [];
+ $article->{EDITORIAL_DECISIONS} //= []; #/
my $new_decision_index = scalar(@{$article->{EDITORIAL_DECISIONS}});
# BP-1602 We need to store Decision Letters in Article Directory for
Index: Magic.pm
===================================================================
--- Magic.pm (revision 38023)
+++ Magic.pm (working copy)
@@ -1808,12 +1808,12 @@
#MAIN-9799 Hackaround. Avoid wantarray until Surp.pm fixed.
#$md5 = md5_hex(read_file("$dir/$imgfile"));
my $file_contents = read_file("$dir/$imgfile", binmode => ':raw');
- $md5 = Utils::safe_md5_hex($file_contents); # MAIN-9818 OK (using :raw data)
- $md5cache{$dir}{$imgfile} = $md5;
- unless (-e "$this_topassetdir/md5images/$md5.$ext") {
- rmkdir("$this_topassetdir/md5images")
- unless -d "$this_topassetdir/md5images";
- write_file("$this_topassetdir/md5images/$md5.$ext", {binmode => ':raw'}, $file_contents);
+ $md5 = Utils::safe_md5_hex($file_contents);
+ $md5cache{$dir}{$imgfile} = $md5; # BP-1806 ok
+ unless (-e "$this_topassetdir/md5images/$md5.$ext") { # BP-1806 ok
+ rmkdir("$this_topassetdir/md5images") # BP-1806 ok
+ unless -d "$this_topassetdir/md5images"; # BP-1806 ok
+ write_file("$this_topassetdir/md5images/$md5.$ext", {binmode => ':raw'}, $file_contents); # BP-1806 ok
}
}
@@ -2967,7 +2967,7 @@
? ""
: sourcepath_text( "FILE: $file (cont)" );
- return [ "<magic nomagic>$begin".scalar(read_file($f))."$end</magic>", $f, 0, 0 ];
+ return [ "<magic nomagic>$begin".scalar(read_file($f))."$end</magic>", $f, 0, 0 ]; # BP-1806 ok
}
@@ -3010,7 +3010,7 @@
my $f = $context->find_file($farg);
Log->trace("Magic include_file $f");
return "CANNOT FIND FILE: $farg" unless $f;
- my $contents = read_file($f);
+ my $contents = read_file($f); # BP-1806 ok
return _process_include_file($dr, $farg, $f, $contents);
}
@@ -3355,7 +3355,7 @@
my ($dr, $file, $strip) = @_;
my $generated = Wrapper::pregenerate_file($context, $dr, $file, $strip);
Log->trace("Magic include_pregenerated $generated");
- my $contents = read_file($generated);
+ my $contents = read_file($generated); # BP-1806
return "<magic nomagic>$contents</magic>";
}
@@ -4114,7 +4114,7 @@
}
} else {
# XXXX Should we let the template writer see any file related errors?
- my $data = File::Slurp::read_file($name);
+ my $data = File::Slurp::read_file($name); # BP-1806 ok
for my $str (Utils::parselines($data)) {
push(@list, $str);
}
Index: Globals.pm
===================================================================
--- Globals.pm (revision 38023)
+++ Globals.pm (working copy)
@@ -577,7 +577,7 @@
my $json = JSON->new();
$json->relaxed(1);
- my $file_contents = File::Slurp::read_file("${config_dir}/global_settings.json");
+ my $file_contents = File::Slurp::read_file("${config_dir}/global_settings.json"); # BP-1806 ok
eval {
$global_config = $json->decode($file_contents);
}; if(my $err = $@) {
@@ -595,7 +595,7 @@
if(! -f $override_file) { next OVERRIDE_FILE }
Log->trace("override_file:$override_file");
- $file_contents = File::Slurp::read_file($override_file);
+ $file_contents = File::Slurp::read_file($override_file); # BP-1806 ok
my $override_config = $json->decode($file_contents);
Log->trace(sub{ "global_settings.personal.json: " . Dumper($override_config) });
Index: Magic/CGIView.pm
===================================================================
--- Magic/CGIView.pm (revision 38023)
+++ Magic/CGIView.pm (working copy)
@@ -60,7 +60,7 @@
eval {
# First read in the Magic template from disk
- my $template_text = File::Slurp::read_file($template_fullpath); # will croak on failure
+ my $template_text = File::Slurp::read_file($template_fullpath); # will croak on failure BP-1806 ok
# Then munge the hash in various ways required for Magic
@keys_added = prep_data_for_magic($context, $stash);
Index: Context.pm
===================================================================
--- Context.pm (revision 38023)
+++ Context.pm (working copy)
@@ -5910,7 +5910,7 @@
push(@list, \%new_rec);
}
} else {
- my $data = File::Slurp::read_file($file);
+ my $data = File::Slurp::read_file($file); # BP-1806 ok
for my $line (Utils::parselines($data)) {
# MAIN-3064: trim to avoid incorrect validation failure.
TextUtils::trim($line);
Index: Configs.pm
===================================================================
--- Configs.pm (revision 38023)
+++ Configs.pm (working copy)
@@ -254,7 +254,7 @@
my $size = $item->{input}{size} || '25';
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @explanation;
push(@explanation, $revert_link) if ($revert_link);
@@ -286,7 +286,7 @@
my $cols = $item->{input}{cols} || 25;
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @explanation;
push(@explanation, $revert_link) if ($revert_link);
@@ -317,7 +317,7 @@
my $description = $item->{description} ? "$item->{description}:" : '';
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @values = split("\n", $value);
@@ -859,7 +859,7 @@
my $file = $context->find_file($item->{assetname});
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @values = sort(split("\n", $value));
my $changed;
@@ -875,7 +875,7 @@
my $old_value;
if(-e $filename) {
- $old_value = read_file($filename);
+ $old_value = read_file($filename); # BP-1806 ok
}
my @old_values = split("\n", $old_value);
if (join(", ", @new_values) ne join(", ", @old_values)) {
@@ -962,7 +962,7 @@
my $data = $query->param("x_" . $item->{assetname});
my $changed;
if(-e $filename) {
- $changed = read_file($filename) ne $data;
+ $changed = read_file($filename) ne $data; # BP-1806 ok
} else {
# check against any proto or higher level asset. Don't save
# a local copy if it's the same MAIN-258
@@ -971,7 +971,7 @@
my $default_filename = $context->find_file($item->{assetname});
if($default_filename) {
# ignore various newlines when comparing
- my $tmp_old = read_file($default_filename);
+ my $tmp_old = read_file($default_filename); # BP-1806 ok
my $regex = "[\r\n]";
$tmp_old =~ s/$regex//g;
@@ -993,8 +993,8 @@
# creating a new custom file need to bust the cache
$context->delete_from_findfile_cache($filename);
}
- `mv $filename $backup` if (-e $filename);
- File::Slurp::write_file($filename, $data);
+ `mv $filename $backup` if (-e $filename); # BP-1806 ok
+ File::Slurp::write_file($filename, $data); # BP-1806 ok
};
if ($@) {
$msg .= statusline("Error: $item->{assetname} not uploaded");
@@ -1166,8 +1166,8 @@
if( $hasChanges && $args{SAVE} && ! @errors )
{
- `mv $filename $backup` if (-e $filename);
- File::Slurp::write_file(
+ `mv $filename $backup` if (-e $filename); # BP-1806 ok
+ File::Slurp::write_file( # BP-1806 ok
$filename, ExportData::serialize( \@saveDocTypeList ) );
#push(@changes, "document types changed");
Index: Validate.pm
===================================================================
--- Validate.pm (revision 38023)
+++ Validate.pm (working copy)
@@ -43,7 +43,7 @@
write_file($xml, $data);
} elsif(($file = $args{FILE}) || ($data = $args{DATA})) {
unless($data) {
- $data = read_file($file);
+ $data = read_file($file); # BP-1806 ok
}
my $done;
if($data =~ /<!DOCTYPE/) {
@@ -79,7 +79,7 @@
$data =~ s,(<[\w-]+),$1 $attrs,;
}
}
- write_file($xml, $data);
+ write_file($xml, $data); # BP-1806 ok
}
} else {
die "must pass in something to validate";
Index: SQLDb.pm
===================================================================
--- SQLDb.pm (revision 38023)
+++ SQLDb.pm (working copy)
@@ -1293,7 +1293,7 @@
eval
{
- $configFileContents = read_file( $filename, err_mode => 'croak' );
+ $configFileContents = read_file( $filename, err_mode => 'croak' ); # BP-1806 ok
};
if ( my $ex = Exception::Class->caught() )
{
Index: FileUpload.pm
===================================================================
--- FileUpload.pm (revision 38023)
+++ FileUpload.pm (working copy)
@@ -503,8 +503,8 @@
# a flag.
my $encoding = $rec->{ENCODING};
- open(INFILE, "<", $rec->{TMPFILE}) || confess("can't open $rec->{TMPFILE}: $!");
- open(OUTFILE, ">", $filename) || confess("can't create $filename: $!");
+ open(INFILE, "<", $rec->{TMPFILE}) || confess("can't open $rec->{TMPFILE}: $!"); # BP-1806 ok
+ open(OUTFILE, ">", $filename) || confess("can't create $filename: $!"); # BP-1806 ok
if ( $encoding && $encoding ne 'raw' )
{
Index: Export.pm
===================================================================
--- Export.pm (revision 38023)
+++ Export.pm (working copy)
@@ -134,7 +134,7 @@
}else{
# to save space, we just use a link to the pdf. This s/b a soft link,
# but pkzip doesn't handle soft links.
- system "ln -s $orig_file $fulltext_name";
+ system "ln -s $orig_file $fulltext_name"; # BP-1806 ok
}
return ($metadata_name, $fulltext_name);
} else {
@@ -369,7 +369,7 @@
sub get_servers
{
return $SERVER_DATA if $SERVER_DATA;
- my $xml = read_file("$data/ftp_servers.xml");
+ my $xml = read_file("$data/ftp_servers.xml"); # BP-1806 ok
my $result;
eval
@@ -478,7 +478,7 @@
my $dir = $Globals::global_temporary_directory."/export/$server/$args{COUNTER}";
my $now = time();
if(-e $dir) {
- system("rm -rf $dir");
+ system("rm -rf $dir"); # BP-1806 ok
}
my $storage_layer = bepress::ArticleStorage->new();
Index: bepress/ArticleRequests/Reader.pm
===================================================================
--- bepress/ArticleRequests/Reader.pm (revision 38023)
+++ bepress/ArticleRequests/Reader.pm (working copy)
@@ -42,7 +42,6 @@
use SQLDb;
use Site;
use Context;
-use File::Slurp 'read_file';
use Timer;
use base qw(Class::Accessor::Fast);
Index: Configs.pm
===================================================================
--- Configs.pm (revision 38023)
+++ Configs.pm (working copy)
@@ -254,7 +254,7 @@
my $size = $item->{input}{size} || '25';
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @explanation;
push(@explanation, $revert_link) if ($revert_link);
@@ -286,7 +286,7 @@
my $cols = $item->{input}{cols} || 25;
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @explanation;
push(@explanation, $revert_link) if ($revert_link);
@@ -317,7 +317,7 @@
my $description = $item->{description} ? "$item->{description}:" : '';
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @values = split("\n", $value);
@@ -859,7 +859,7 @@
my $file = $context->find_file($item->{assetname});
my $value;
if(-e $file) {
- $value = read_file($file);
+ $value = read_file($file); # BP-1806 ok
}
my @values = sort(split("\n", $value));
my $changed;
@@ -875,7 +875,7 @@
my $old_value;
if(-e $filename) {
- $old_value = read_file($filename);
+ $old_value = read_file($filename); # BP-1806 ok
}
my @old_values = split("\n", $old_value);
if (join(", ", @new_values) ne join(", ", @old_values)) {
@@ -962,7 +962,7 @@
my $data = $query->param("x_" . $item->{assetname});
my $changed;
if(-e $filename) {
- $changed = read_file($filename) ne $data;
+ $changed = read_file($filename) ne $data; # BP-1806 ok
} else {
# check against any proto or higher level asset. Don't save
# a local copy if it's the same MAIN-258
@@ -971,7 +971,7 @@
my $default_filename = $context->find_file($item->{assetname});
if($default_filename) {
# ignore various newlines when comparing
- my $tmp_old = read_file($default_filename);
+ my $tmp_old = read_file($default_filename); # BP-1806 ok
my $regex = "[\r\n]";
$tmp_old =~ s/$regex//g;
@@ -993,8 +993,8 @@
# creating a new custom file need to bust the cache
$context->delete_from_findfile_cache($filename);
}
- `mv $filename $backup` if (-e $filename);
- File::Slurp::write_file($filename, $data);
+ `mv $filename $backup` if (-e $filename); # BP-1806 ok
+ File::Slurp::write_file($filename, $data); # BP-1806 ok
};
if ($@) {
$msg .= statusline("Error: $item->{assetname} not uploaded");
@@ -1166,8 +1166,8 @@
if( $hasChanges && $args{SAVE} && ! @errors )
{
- `mv $filename $backup` if (-e $filename);
- File::Slurp::write_file(
+ `mv $filename $backup` if (-e $filename); # BP-1806 ok
+ File::Slurp::write_file( # BP-1806 ok
$filename, ExportData::serialize( \@saveDocTypeList ) );
#push(@changes, "document types changed");
Index: Validate.pm
===================================================================
--- Validate.pm (revision 38023)
+++ Validate.pm (working copy)
@@ -43,7 +43,7 @@
write_file($xml, $data);
} elsif(($file = $args{FILE}) || ($data = $args{DATA})) {
unless($data) {
- $data = read_file($file);
+ $data = read_file($file); # BP-1806 ok
}
my $done;
if($data =~ /<!DOCTYPE/) {
@@ -79,7 +79,7 @@
$data =~ s,(<[\w-]+),$1 $attrs,;
}
}
- write_file($xml, $data);
+ write_file($xml, $data); # BP-1806 ok
}
} else {
die "must pass in something to validate";
Index: SQLDb.pm
===================================================================
--- SQLDb.pm (revision 38023)
+++ SQLDb.pm (working copy)
@@ -1293,7 +1293,7 @@
eval
{
- $configFileContents = read_file( $filename, err_mode => 'croak' );
+ $configFileContents = read_file( $filename, err_mode => 'croak' ); # BP-1806 ok
};
if ( my $ex = Exception::Class->caught() )
{
Index: Export.pm
===================================================================
--- Export.pm (revision 38023)
+++ Export.pm (working copy)
@@ -134,7 +134,7 @@
}else{
# to save space, we just use a link to the pdf. This s/b a soft link,
# but pkzip doesn't handle soft links.
- system "ln -s $orig_file $fulltext_name";
+ system "ln -s $orig_file $fulltext_name"; # BP-1806 ok
}
return ($metadata_name, $fulltext_name);
} else {
@@ -369,7 +369,7 @@
sub get_servers
{
return $SERVER_DATA if $SERVER_DATA;
- my $xml = read_file("$data/ftp_servers.xml");
+ my $xml = read_file("$data/ftp_servers.xml"); # BP-1806 ok
my $result;
eval
@@ -478,7 +478,7 @@
my $dir = $Globals::global_temporary_directory."/export/$server/$args{COUNTER}";
my $now = time();
if(-e $dir) {
- system("rm -rf $dir");
+ system("rm -rf $dir"); # BP-1806 ok
}
my $storage_layer = bepress::ArticleStorage->new();
Index: bepress/PlackApp.pm
===================================================================
--- bepress/PlackApp.pm (revision 38023)
+++ bepress/PlackApp.pm (working copy)
@@ -331,7 +331,7 @@
# load the contents of the psgi_routes.json file and return them as a struct
#
sub get_psgi_routes {
- my $json = read_file( "$ENV{FILETREE}/psgi/psgi_routes.json" );
+ my $json = read_file( "$ENV{FILETREE}/psgi/psgi_routes.json" ); # BP-1806 ok
if ( !$json ) {
bepress::Exception->throw(
'error' => "failed to read file! $!",
Index: bepress/API/ReviewerList.pm
===================================================================
--- bepress/API/ReviewerList.pm (revision 38023)
+++ bepress/API/ReviewerList.pm (working copy)
@@ -317,7 +317,7 @@
# Read File and check for Slurp Errors.
my @textfile_data;
eval {
- @textfile_data = File::Slurp::read_file($filename);
+ @textfile_data = File::Slurp::read_file($filename); # BP-1806 ok
};
if ($@) {
be::Ex::FileParse->throw(message => "File::Slurp could not read text file!", cause => $filename);
Index: bepress/Controller/UnitTestJavaScript.pm
===================================================================
--- bepress/Controller/UnitTestJavaScript.pm (revision 38023)
+++ bepress/Controller/UnitTestJavaScript.pm (working copy)
@@ -476,7 +476,7 @@
if ( -f $try_path ) {
Log->trace( "Found at $try_path" );
$contents = "/* Inlined: $try_path */";
- $contents = read_file( $try_path );
+ $contents = read_file( $try_path ); # BP-1806 ok
$found_path = $try_path;
}
}
Index: bepress/Controller/Templates.pm
===================================================================
--- bepress/Controller/Templates.pm (revision 38023)
+++ bepress/Controller/Templates.pm (working copy)
@@ -62,7 +62,7 @@
die;
}
- my $file_data = bepress::Model::Templates::read_file( $file_path, $template_name );
+ my $file_data = bepress::Model::Templates::read_file( $file_path, $template_name ); # BP-1806 ok
my %tt_data = (
template_name => $template_name,
Index: bepress/Selenium/Metadata.pm
===================================================================
--- bepress/Selenium/Metadata.pm (revision 38023)
+++ bepress/Selenium/Metadata.pm (working copy)
@@ -81,7 +81,7 @@
} else {
my $metadata_filepath = $filepath_or_hashref;
if (-e $metadata_filepath) {
- $self->read_file($metadata_filepath);
+ $self->read_file($metadata_filepath); # BP-1806 ok
} else {
be::Ex->throw("Given filepath doesn't exist: $metadata_filepath");
}
Index: bepress/Sendmail.pm
===================================================================
--- bepress/Sendmail.pm (revision 38023)
+++ bepress/Sendmail.pm (working copy)
@@ -196,7 +196,7 @@
}
be::Ex->guard();
- if ( ! $contents_ref && ! -r $filepath ) {
+ if ( ! $contents_ref && ! -r $filepath ) { # BP-1806 ok
be::Ex::FileNotFound->throw(
error => '', file => $filepath, ident_key => 'sendmail_file_not_found'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment