Skip to content
This repository
Browse code

Making S::D::R compress using .. instead of -

  • Loading branch information...
commit 4332704ed0eec9f071db17fd96692e0b1e89b5ed 1 parent 17079c8
Erik Bourget authored October 19, 2011
10  perl_seco_data_range/source/lib/Seco/Data/Range.pm
@@ -176,7 +176,7 @@ sub _extra_compress {
176 176
     }
177 177
     my $result = _simple_compress(\@nodes);
178 178
     for ($result) {
179  
-        s/(\d+-\d+)\.UNDOXXX/{$1}/g;
  179
+        s/(\d+\.\.\d+)\.UNDOXXX/{$1}/g;
180 180
         s/(\d+)\.UNDOXXX/$1/g;
181 181
     }
182 182
     return $result;
@@ -262,7 +262,7 @@ sub _simple_expand {
262 262
         if (
263 263
             $range =~ /\A
264 264
                    $node_regex
265  
-                   -            # our separator is '-'
  265
+                   \.\.            # our separator is '..'
266 266
                    \1?          # the prefix again, which is optional
267 267
 		  (\d+)         # and the end of the range
268 268
 		  ((?(3) \3 |   # if the domain matched before, we want it here
@@ -286,8 +286,8 @@ sub _simple_expand {
286 286
             my $len = length($start);
287 287
 
288 288
             # pad $end with leading characters from start so we can
289  
-            # type 01-3 and expand that to 01,02,03 or maybe
290  
-            # ks301000-9 for ks301000-301009
  289
+            # type 01..3 and expand that to 01,02,03 or maybe
  290
+            # ks301000..9 for ks301000..301009
291 291
             my $len_end = length($end);
292 292
             $end = substr($start, 0, $len - $len_end) . $end
293 293
               if $len_end < $len;
@@ -324,7 +324,7 @@ sub _get_group {
324 324
     my ($prefix, $digits, $count, $suffix) = @_;
325 325
 
326 326
     $prefix = "" unless defined $prefix;
327  
-    my $group = sprintf("%s%0*d-%s",
  327
+    my $group = sprintf("%s%0*d..%s",
328 328
         $prefix, length($digits), $digits,
329 329
         _ignore_common_prefix($digits, $digits + $count));
330 330
 

0 notes on commit 4332704

Please sign in to comment.
Something went wrong with that request. Please try again.