Problem with Switch.pm

"Rothenmaier, Deane" <[email protected]> Thu, 17 Jan 2013 14:26:05 +0000
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <8FBE912FE28C484D9D2D95AAA28F393726F0E331@BY2PRD0611MB415.namprd06.prod.outlook.com>
--===============1558064514==
Content-Type: multipart/alternative;
	boundary="_000_8FBE912FE28C484D9D2D95AAA28F393726F0E331BY2PRD0611MB415_"
Content-Language: en-US

--_000_8FBE912FE28C484D9D2D95AAA28F393726F0E331BY2PRD0611MB415_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="us-ascii"

Gurus,

I'm having a problem getting Switch to work. I have a subroutine which is j=
ust a large switch statement, and switch statements (including a nested one=
) in the mainline code. As separate programs (with the subroutine broken ou=
t into a stub program), they both work perfectly. When I put the switch ver=
sion of the sub back into the program code, the thing breaks with the messa=
ge: "Bad switch statement (problem in the code block?) near test.pl line 42=
94."  I should mention that line 4294 is the last line of the source file; =
so no help there.

This is the subroutine code:

sub get_software_data {

my ($line, $flag) =3D @_;



  my ($name, $vrsn) =3D (q{})x2;



   # Local (nested) subs for various products:

   local *dnet_sub =3D sub {

                           $line =3D~ /^.* Version (.*)$/;

                           $name =3D 'Wizards to adjust .NET Framework secu=
rity';

                           $vrsn =3D (length( $1 ) > 0) ? $1 : "N/A";

                         };

   local *java_sub =3D sub {

                           $line =3D~ /^.* Version ((\d+).*)$/;

                           $name =3D 'Java Platform Standard Edition';

                           $vrsn =3D "1\.$2 ($1)";

                          };

   local *mcav_sub =3D sub {

                           $line =3D~ /^([^\d]*)\.(.*)$/;

                           $name =3D $1;

                           $vrsn =3D (length( $2 ) > 0) ? $2 : "N/A";

                         };

   local *perl_sub =3D sub {

                           $line =3D~ /^.* Build (.*) version (.*)$/;

                           $name =3D "ActiveState ActivePerl";

                           $vrsn =3D ($2 ne "N/A") ? sprintf( "%s (build %s=
)", $2, $1 ) : $2;

                         };

  local *dflt_sub =3D sub {

                           $line =3D~ /^(.*) Version (.*)$/;

                           $name =3D $1;

                           $vrsn =3D (length( $2 ) > 0) ? $2 : "N/A";

                         };

   local *misc_sub =3D sub {

                           $line =3D~ /^(.*)\s+(.*)$/;

                           $name =3D $1;

                           $vrsn =3D (length( $2 ) > 0) ? $2 : "N/A";

                         };



   switch ($line) {

      case /Java Platform Standard Edition/                                =
      { java_sub() }

      case /Sun Microsystems, Inc. - Java\(TM\) Platform SE \d* U\d+/      =
      { java_sub() }

      case /Sun Microsystems, Inc. - Java\(TM\)\s*\d* Platform Standard Edi=
tion/ { java_sub() }

      case /Wizards to adjust \.NET Framework/ { dnet_sub() }

      case /Version/ { dflt_sub() }

      case /ActiveState, a division of Sophos - ActivePerl Build/ { perl_su=
b() }

      case /ActiveState Tool Corp\. - ActivePerl Build/           { perl_su=
b() }

      case /McAfee, Inc\. - VSCORE\./ { mcav_sub() }

      case /Access for Windows/    { misc_sub() }

      case /Client Access Express/ { misc_sub() }

      else {

         $name =3D $line;

         $vrsn =3D ($flag) ? "N/A" : "data";

      }

   }



   return( $name, $vrsn );

}

And here's a sample from the mainline code:


use Switch;

...



         if (defined( $key )) {

            switch ($col_ndx) {

               case 0 {

                  $col_data =3D $sw_data{$key};

               }

               case ($check_col) {

                  if (defined( $col_data )) {

                     $data_line =3D~ s{>[^<]*<}

                                    {>$col_data<}; # Insert new data

                     undef $col_data;

                  }

               }

            } # end switch ($col_ndx)



            ++$col_ndx;

         } # end if

What the deuce am I missing, or doing wrong? Again, as separate programs, b=
oth the subroutine and the mainline (with a different, non-"switch" version=
 of the sub), work fine. Combined, I get the error above.

TIA,

Deane Rothenmaier
Programmer/Analyst - IT-StdCfg
Walgreens Corp.
2 Overlook Point #N51022D
MS 6515
Lincolnshire, IL 60069
224-542-5150

Never trust a computer you can't throw out a window. - Steve Wozniak


--_000_8FBE912FE28C484D9D2D95AAA28F393726F0E331BY2PRD0611MB415_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
	{mso-style-priority:99;
	mso-style-link:"Plain Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.5pt;
	font-family:Consolas;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.PlainTextChar
	{mso-style-name:"Plain Text Char";
	mso-style-priority:99;
	mso-style-link:"Plain Text";
	font-family:Consolas;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Gurus,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;m having a problem getting Switch to work. I=
 have a subroutine which is just a large switch statement, and switch state=
ments (including a nested one) in the mainline code. As separate programs (=
with the subroutine broken out into a stub
 program), they both work perfectly. When I put the switch version of the s=
ub back into the program code, the thing breaks with the message: &#8220;Ba=
d switch statement (problem in the code block?) near test.pl line 4294.&#82=
21;&nbsp; I should mention that line 4294 is the
 last line of the source file; so no help there.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">This is the subroutine code:<o:p></o:p></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">sub get_software_data {<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">my ($line, $flag) =3D @_;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;my ($name, $vrsn) =3D (q{})x2;<o:p></o:p></s=
pan></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; # Local (nested) subs for various products:=
<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; local *dnet_sub =3D sub {<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $line =3D~ /^.* Version (.*)$/;<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $name =3D 'Wizards to adjust .NET Framework secur=
ity';<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =3D (length( $1 ) &gt; 0) ? $1 : &quot;N/A&=
quot;;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; };<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; local *java_sub =3D sub {<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $line =3D~ /^.* Version ((\d&#43;).*)$/;<o:p></o:=
p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;$name =3D 'Java Platform Standard Edition';<o:p><=
/o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =3D &quot;1\.$2 ($1)&quot;;<o:p></o:p></spa=
n></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; };<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; local *mcav_sub =3D sub {<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $line =3D~ /^([^\d]*)\.(.*)$/;<o:p></o:p></span><=
/p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $name =3D $1;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =3D (length( $2 ) &gt; 0) ? $2 : &quot;N/A&=
quot;;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; };<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; local *perl_sub =3D sub {<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $line =3D~ /^.* Build (.*) version (.*)$/;<o:p></=
o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $name =3D &quot;ActiveState ActivePerl&quot;;<o:p=
></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =3D ($2 ne &quot;N/A&quot;) ? sprintf( &quo=
t;%s (build %s)&quot;, $2, $1 ) : $2;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; };<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;local *dflt_sub =3D sub {<o:p></o:p></span><=
/p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $line =3D~ /^(.*) Version (.*)$/;<o:p></o:p></spa=
n></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $name =3D $1;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =3D (length( $2 ) &gt; 0) ? $2 : &quot;N/A&=
quot;;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; };<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; local *misc_sub =3D sub {<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $line =3D~ /^(.*)\s&#43;(.*)$/;<o:p></o:p></span>=
</p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $name =3D $1;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =3D (length( $2 ) &gt; 0) ? $2 : &quot;N/A&=
quot;;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; };<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; switch ($line) {<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Java Platform Stand=
ard Edition/&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;{ java_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Sun Microsystems, I=
nc. - Java\(TM\) Platform SE \d* U\d&#43;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { java_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Sun Microsystems, I=
nc. - Java\(TM\)\s*\d* Platform Standard Edition/ { java_sub() }<o:p></o:p>=
</span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Wizards to adjust \=
.NET Framework/ { dnet_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Version/ { dflt_sub=
() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /ActiveState, a divi=
sion of Sophos - ActivePerl Build/ { perl_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /ActiveState Tool Co=
rp\. - ActivePerl Build/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; { perl_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /McAfee, Inc\. - VSC=
ORE\./ { mcav_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Access for Windows/=
&nbsp;&nbsp;&nbsp; { misc_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case /Client Access Expre=
ss/ { misc_sub() }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {
<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$n=
ame =3D $line;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $vrsn =
=3D ($flag) ? &quot;N/A&quot; : &quot;data&quot;;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp; return( $name, $vrsn );<o:p></o:p></span></=
p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">}<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">And here&#8217;s a sample from the mainline code:<o:=
p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">use Switch;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&#8230;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (def=
ined( $key )) {<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; switch ($col_ndx) {<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0 {<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $col_data =3D $sw_data{$key}=
;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; case ($check_col) {<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (defined( $col_data )) {<=
o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $data_line=
 =3D~ s{&gt;[^&lt;]*&lt;}<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; {&gt;$col_data&lt;}; # Insert new data<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; undef $col=
_data;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; } # end switch ($col_ndx)<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &#43;&#43;$col_ndx;<o:p></o:p></span></p>
<p class=3D"MsoPlainText"><span style=3D"font-size:8.0pt;font-family:&quot;=
Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } # end=
 if<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">What the deuce am I missing, or doing wrong? Again, =
as separate programs, both the subroutine and the mainline (with a differen=
t, non-&#8220;switch&#8221; version of the sub), work fine. Combined, I get=
 the error above.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">TIA,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Deane Rothenmaier<o:p></o:p></p>
<p class=3D"MsoNormal">Programmer/Analyst &#8211; IT-StdCfg<o:p></o:p></p>
<p class=3D"MsoNormal">Walgreens Corp.<o:p></o:p></p>
<p class=3D"MsoNormal">2 Overlook Point #N51022D<o:p></o:p></p>
<p class=3D"MsoNormal">MS 6515<o:p></o:p></p>
<p class=3D"MsoNormal">Lincolnshire, IL 60069<o:p></o:p></p>
<p class=3D"MsoNormal">224-542-5150<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-family:&quot;Arial&quot;,&quot;s=
ans-serif&quot;">Never trust a computer you can&#8217;t throw out a window.=
 &#8211; Steve Wozniak<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_8FBE912FE28C484D9D2D95AAA28F393726F0E331BY2PRD0611MB415_--


--===============1558064514==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1558064514==--