[LON-CAPA-cvs] cvs: loncom /imspackages imsprocessor.pm
raeburn
raeburn at source.lon-capa.org
Wed Dec 10 20:12:14 EST 2014
raeburn Thu Dec 11 01:12:14 2014 EDT
Modified files:
/loncom/imspackages imsprocessor.pm
Log:
- Coding style: sort() keys()
Index: loncom/imspackages/imsprocessor.pm
diff -u loncom/imspackages/imsprocessor.pm:1.53 loncom/imspackages/imsprocessor.pm:1.54
--- loncom/imspackages/imsprocessor.pm:1.53 Fri Aug 2 12:56:26 2013
+++ loncom/imspackages/imsprocessor.pm Thu Dec 11 01:12:14 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Processor for IMS Packages
#
-# $Id: imsprocessor.pm,v 1.53 2013/08/02 12:56:26 raeburn Exp $
+# $Id: imsprocessor.pm,v 1.54 2014/12/11 01:12:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -387,7 +387,7 @@
);
$p->parse_file($xmlfile);
$p->eof;
- foreach my $itm (keys %contents) {
+ foreach my $itm (keys(%contents)) {
@{$$items{$itm}{contents}} = @{$contents{$itm}};
}
}
@@ -438,7 +438,7 @@
sub copy_resources {
my ($context,$cms,$hrefs,$resources,$tempdir,$targets,$url,$crs,$cdom,$destdir,$timenow,$assessmentfiles,$total) = @_;
if ($context eq 'DOCS') {
- foreach my $key (sort keys %{$hrefs}) {
+ foreach my $key (sort(keys(%{$hrefs}))) {
if (grep/^$key$/,@{$targets}) {
%{$$url{$key}} = ();
foreach my $file (@{$$hrefs{$key}}) {
@@ -617,7 +617,7 @@
}
if ($cms eq 'angel5') {
my $currboard = '';
- foreach my $key (sort keys %{$resources}) {
+ foreach my $key (sort(keys(%{$resources}))) {
if (grep/^$key$/,@{$targets}) {
if ($$resources{$key}{type} eq "BOARD") {
push @{$boards}, $key;
@@ -646,7 +646,7 @@
}
}
} elsif ($cms eq 'bb5' || $cms eq 'bb6') {
- foreach my $key (sort keys %{$resources}) {
+ foreach my $key (sort(keys(%{$resources}))) {
if (grep/^$key$/,@{$targets}) {
if ($$resources{$key}{type} eq "resource/x-bb-document") {
unless ($$items{$$resources{$key}{revitm}}{filepath} eq 'Top') {
@@ -714,7 +714,7 @@
$$items{'Top'}{'contentscount'} ++;
}
} elsif ($cms eq 'webctce4') {
- foreach my $key (sort keys %{$resources}) {
+ foreach my $key (sort(keys(%{$resources}))) {
if (grep/^$key$/,@{$targets}) {
if ($$resources{$key}{type} eq "webcontent") {
%{$$resinfo{$key}} = ();
@@ -729,7 +729,7 @@
}
}
} elsif ($cms eq 'webctvista4') {
- foreach my $key (sort keys %{$resources}) {
+ foreach my $key (sort(keys(%{$resources}))) {
if (grep/^$key$/,@{$targets}) {
%{$$resinfo{$key}} = ();
if ($$resources{$key}{type} eq 'webct.question') {
@@ -816,7 +816,7 @@
$srcstem = "/res/$udom/$uname/$newdir";
}
- foreach my $key (sort keys %{$items}) {
+ foreach my $key (sort(keys(%{$items}))) {
if ($$includeditems{$key}) {
%{$flag{$key}} = (
page => 0,
@@ -1034,7 +1034,7 @@
$filestem = "/res/$udom/$uname/$newdir";
}
- foreach my $key (sort keys %pagecontents) {
+ foreach my $key (sort(keys(%pagecontents))) {
for (my $i=0; $i<@{$pagecontents{$key}}; $i++) {
my $filename = $destdir.'/pages/'.$key.'_'.$i.'.page';
my $resource = "$filestem/resfiles/$$items{$pagecontents{$key}[$i][0]}{resnum}.html";
@@ -1350,7 +1350,7 @@
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf');
my $xmlstem = $$configvars{'lonDaemons'}."/tmp/".$user_cdom."_".$user_crs."_";
- foreach my $user_id (keys %{$settings}) {
+ foreach my $user_id (keys(%{$settings})) {
if ($$settings{$user_id}{user_role} eq "s") {
} elsif ($user_handling eq 'enrollall') {
@@ -1870,7 +1870,7 @@
&Apache::lonnet::put('discussiontimes',\%storenewentry,$cdom,$crs);
}
my %record=&Apache::lonnet::restore('_discussion');
- my ($temp)=keys %record;
+ my ($temp)=keys(%record);
unless ($temp=~/^error\:/) {
my %newrecord=();
$newrecord{'resource'}=$symb;
@@ -3263,7 +3263,7 @@
$p->parse_file($xmlfile);
$p->eof;
my $boxcount;
- foreach my $id (keys %{$settings}) {
+ foreach my $id (keys(%{$settings})) {
if ($$settings{$id}{class} eq 'string') {
$boxcount = 0;
if (@{$$settings{$id}{boxes}} > 1) {
@@ -3340,7 +3340,7 @@
}
} elsif ($cms eq 'webctvista4') {
unless($$dbparse) {
- foreach my $res (sort keys %{$allquestions}) {
+ foreach my $res (sort(keys(%{$allquestions}))) {
my $parent = $$allquestions{$res};
&parse_webctvista4_question($res,$docroot,$resources,$hrefs,$qzdbsettings,\@allquestids,\%allanswers,\%allchoices,$parent,$catinfo);
}
@@ -3389,13 +3389,13 @@
if (!-e "$destdir/sequences") {
mkdir("$destdir/sequences",0755);
}
- my $numcats = scalar(keys %{$catinfo});
+ my $numcats = scalar(keys(%{$catinfo}));
my $curr_id = 0;
my $next_id = 1;
my $fh;
open($fh,">$destdir/sequences/question_database.sequence");
push @{$sequencesfiles},'question_database.sequence';
- foreach my $category (sort keys %{$catinfo}) {
+ foreach my $category (sort(keys(%{$catinfo}))) {
my $seqname;
if ($cms eq 'webctce4') {
$seqname = $$catinfo{$category}{title}.'_'.$category;
@@ -3962,7 +3962,7 @@
}
if ($$settings{$id}{class} eq 'numerical') {
foreach my $numid (@{$$settings{$id}{numids}}) {
- foreach my $var (keys %{$$settings{$id}{$numid}{vars}}) {
+ foreach my $var (keys(%{$$settings{$id}{$numid}{vars}})) {
if ($cms eq 'webctce4') {
$$settings{$id}{text} =~ s/{($var)}/\$$1 /g;
} elsif ($cms eq 'webctvista4') {
@@ -4449,9 +4449,9 @@
|;
foreach my $numid (@{$$settings{$id}{numids}}) {
my $formula = $$settings{$id}{$numid}{formula};
- my $pattern = join('|',(sort (keys (%mathfns))));
+ my $pattern = join('|',(sort(keys(%mathfns))));
$formula =~ s/($pattern)/\&$mathfns{$1}/g;
- foreach my $var (keys %{$$settings{$id}{$numid}{vars}}) {
+ foreach my $var (keys(%{$$settings{$id}{$numid}{vars}})) {
my $decnum = $$settings{$id}{$numid}{vars}{$var}{dec};
my $increment = '0.';
if ($decnum == 0) {
@@ -5221,7 +5221,7 @@
if ($$settings{newwindow} eq "true") {
$linktag .= qq| target="$res$filecount"|;
}
- foreach my $entry (keys %{$$settings{files}[$filecount]{registry}}) {
+ foreach my $entry (keys(%{$$settings{files}[$filecount]{registry}})) {
$linktag .= qq| $entry="$$settings{files}[$filecount]{registry}{$entry}"|;
}
$linktag .= qq|>$$settings{files}[$filecount]{linkname}</a><br/>\n|;
More information about the LON-CAPA-cvs
mailing list