source: trunk/soft/ObsData/ourplugins/cr_lid_lor.pl @ 232

Last change on this file since 232 was 232, checked in by nanardon, 18 years ago
  • fix lidlor plugin to match all possible case
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1#!/usr/bin/perl
2
3# $Id$
4
5use strict;
6
7sub {
8    my ($rda, $plugintype, $datafile, $datatype) = @_;
9
10    my $archive = $rda->archive() or do {
11        $rda->logging(4,
12            'Can get archive'
13        );
14        return(0);
15    };
16   
17    my $filename = $archive->extract() or do {
18        $rda->logging(4,
19            "Can't get temporary file: %s",
20            $archive->error,
21        );
22        return(0);
23    };
24   
25    my $resopen = open(my $h, $filename);
26   
27    unlink($filename);
28
29    if (!$resopen) {
30        $rda->logging(4,
31            "Can't open temp file %s",
32            $filename,
33        );
34        return(0);
35    }
36
37    while (my $line = <$h>) {
38        chomp($line);
39        if ($line =~ /^Numero\s+\|Nom\s+\|Voies actives/) {
40            my $nextline = <$h>;
41            chomp($nextline);
42            $nextline =~ /^1\s*\|E(\d)\d{6}\.?N\d{4}/;
43            if ($1) {
44                return(1,
45                    'mode', $1,
46                );
47            } else {
48                $rda->logging(4,
49                    "can't find marker: %s",
50                    $nextline,
51                );
52                return(0);
53            }
54        }
55    }
56
57    close($h);
58   
59    return(0);
60}
61
Note: See TracBrowser for help on using the repository browser.