File: msg_parse_001.sh

package info (click to toggle)
cod-tools 3.11.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 159,136 kB
  • sloc: perl: 58,707; sh: 41,323; ansic: 7,268; xml: 1,982; yacc: 1,117; makefile: 731; python: 166
file content (25 lines) | stat: -rwxr-xr-x 758 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
##
# Tests the way error messages are formed when using COD::UserMessage
# module in command-line perl as well as reading from SDTIN as input file.
##

#BEGIN DEPEND------------------------------------------------------------------
INPUT_MODULE=src/lib/perl5/COD/UserMessage.pm
#END DEPEND--------------------------------------------------------------------

IMPORT_MODULE=$(\
    echo ${INPUT_MODULE} | \
    perl -pe "s|^src/lib/perl5/||; s/[.]pm$//; s|/|::|g;" \
)

echo "test error" | \
perl -M"${IMPORT_MODULE} qw( error )" \
     -e 'print "$ARGV";' \
     -e 'while (<>) {' \
     -e '    error( {' \
     -e '       program  => $0,' \
     -e '       filename => $ARGV,' \
     -e '       message  => $_' \
     -e '    } );' \
     -e '}'