cvs commit: p5ee/App-WorkQueue/lib/App WorkQueue.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     06/02/09 09:57:15

  Modified:    App-WorkQueue/lib/App WorkQueue.pm
  Log:
  work with positive or negative constraint limits
  
  Revision  Changes    Path
  1.3       +11 -3     p5ee/App-WorkQueue/lib/App/WorkQueue.pm
  
  Index: WorkQueue.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-WorkQueue/lib/App/WorkQueue.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WorkQueue.pm	7 Feb 2006 16:18:18 -0000	1.2
  +++ WorkQueue.pm	9 Feb 2006 17:57:15 -0000	1.3
  @@ -1285,8 +1285,11 @@
           # do nothing
       }
       else {
  +        my ($limit);
           foreach my $c (@$global_constraints) {
  -            if ($c->[$GCONSTR_COUNTS]{$c->[$GCONSTR_COUNT_ATTRIB]} >= $c->[$GCONSTR_LIMITS]{$c->[$GCONSTR_LIMIT_ATTRIB]}) {
  +            $limit = $c->[$GCONSTR_LIMITS]{$c->[$GCONSTR_LIMIT_ATTRIB]};
  +            $limit = -$limit if ($limit < 0);
  +            if ($c->[$GCONSTR_COUNTS]{$c->[$GCONSTR_COUNT_ATTRIB]} >= $limit) {
                   $complies = 0;
                   last;
               }
  @@ -1333,8 +1336,11 @@
           # do nothing
       }
       else {
  +        my ($limit);
           foreach my $c (@$global_constraints) {
  -            if ($c->[$GCONSTR_COUNTS]{$c->[$GCONSTR_COUNT_ATTRIB]} >= $c->[$GCONSTR_LIMITS]{$c->[$GCONSTR_LIMIT_ATTRIB]}) {
  +            $limit = $c->[$GCONSTR_LIMITS]{$c->[$GCONSTR_LIMIT_ATTRIB]};
  +            $limit = -$limit if ($limit < 0);
  +            if ($c->[$GCONSTR_COUNTS]{$c->[$GCONSTR_COUNT_ATTRIB]} >= $limit) {
                   $complies = 0;
                   last;
               }
  @@ -1355,6 +1361,7 @@
                   $limit = $c->[$CONSTR_LIMITS]{$key};
                   $limit = $c->[$CONSTR_LIMITS]{_DEFAULT} if (!defined $limit);
                   if (defined $limit) {
  +                    $limit = -$limit if ($limit < 0);
                       $count_incr = (defined $c->[$CONSTR_COUNT_IDX]) ? $entry->[$c->[$CONSTR_COUNT_IDX]] : 1;
                       if ($c->[$CONSTR_COUNTS]{$key} + $count_incr > $limit) {
                           $complies = 0;
  @@ -1380,6 +1387,7 @@
                   $limit = $c->[$CONSTR_LIMITS]{$key};
                   $limit = $c->[$CONSTR_LIMITS]{_DEFAULT} if (!defined $limit);
                   if (defined $limit) {
  +                    $limit = -$limit if ($limit < 0);
                       $count_incr = (defined $c->[$CONSTR_COUNT_ATTRIB]) ? $entry->{$c->[$CONSTR_COUNT_ATTRIB]} : 1;
                       if ($c->[$CONSTR_COUNTS]{$key} + $count_incr > $limit) {
                           $complies = 0;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.