File Coverage

Test_Progs/failure_to_identify_loops
Criterion Covered Total %
statement 29 135 21.4
branch 6 86 6.9
condition 3 26 11.5
subroutine 4 4 100.0
pod n/a
total 42 251 16.7


line stmt bran cond sub pod time code
1             #! /usr/bin/perl -w
2              
3             # Failure to Identify select Loops
4             #
5             # When a properly formed select loop appears in certain contexts,
6             # such as before a line containing certain patterns of dollar signs
7             # or quotes,
8             # it will not be properly identified and translated into standard Perl.
9             #
10             # The following is such an example:
11             #
12             # use Shell::POSIX::Select;
13             # select (@names) { print ; }
14             # # $X$
15             #
16             # The failure of the filtering routine to rewrite the loop causes the
17             # compiler to issue the following fatal error when it sees the
18             # { following the (LIST):
19             #
20             # syntax error at filename line X, near ") {"
21             #
22             # This of course prevents the program from running.
23             #
24             # The problem is either a bug in Filter::Simple, or one of the modules on
25             # which it depends.
26             # Until this is resolved, you may be able to
27             # handle such cases by explicitly turning filtering off before the offending
28             # code is encountered, using the no directive:
29             #
30             # use Shell::POSIX::Select; # filtering ON
31             # select (@names) { print ; }
32             #
33             # no Shell::POSIX::Select; # filtering OFF
34             # # $X$
35              
36             # Is this resolved?
37              
38 1         5 my $VERSION = 1.02;
39              
40 1     1   7 use blib;
  1         1  
  1         77  
41              
42             # case 1:
43              
44 1     1   876 use Shell::POSIX::Select;
  1         3  
  1         7  
45             select (@names) { print ; }
46             # $X$
47              
48             # case 2:
49 1 50 50     3  
  1         7  
50             use Shell::POSIX::Select; # filtering ON
51             select (@names) { print ; }
52              
53             no Shell::POSIX::Select; # filtering OFF
54 1         2 # $X$
  1         6