Under "use strict", you need to predeclare all variables used.  See the
documentation for the "my" keyword using perldoc (perldoc -f my) for more
information.

I would also recommend reading chapters 1 and 2 (as well as 3-5 and 7 as
you have time) of the O'Reilly camel book (Programming Perl - Wall,
Christiansen, and Schwartz), and then Damian Conway's "Object Oriented
Perl" for a more in depth understanding of modern Perl concepts and
constructs.

Brian





[EMAIL PROTECTED] on 01/14/2002 06:53:56 AM

To:   [EMAIL PROTECTED]
cc:
bcc:

Subject:  RE: [cgiapp] Error in CGI::Application script


I changed the .pm and package name to match the same. Still I am having few
errors as below. Am I suppose to declare local variables differently in the
package?? I am not sure as I am a starter on the Perl, CGI and
CGI::Application and using it for the very first time.

[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$val" requires
explicit package name at testapi.pm line 30.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$startloc" requires
explicit package name at testapi.pm line 31.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$startloc" requires
explicit package name at testapi.pm line 32.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$c" requires
explicit
package name at testapi.pm line 33.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$dir" requires
explicit package name at testapi.pm line 34.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "@apps" requires
explicit package name at testapi.pm line 36.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$c" requires
explicit
package name at testapi.pm line 36.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$dir" requires
explicit package name at testapi.pm line 36.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$c" requires
explicit
package name at testapi.pm line 37.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$i" requires
explicit
package name at testapi.pm line 40.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$i" requires
explicit
package name at testapi.pm line 40.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$c" requires
explicit
package name at testapi.pm line 40.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$i" requires
explicit
package name at testapi.pm line 40.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$val" requires
explicit package name at testapi.pm line 41.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "@apps" requires
explicit package name at testapi.pm line 41.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$i" requires
explicit
package name at testapi.pm line 41.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$i" requires
explicit
package name at testapi.pm line 42.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$c" requires
explicit
package name at testapi.pm line 42.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Global symbol "$val" requires
explicit package name at testapi.pm line 44.
[Mon Jan 14 07:45:36 2002] testapi.cgi: Compilation failed in require at
testapi.cgi line 3.
[Mon Jan 14 07:45:36 2002] testapi.cgi: BEGIN failed--compilation aborted
at
testapi.cgi line 3.

**************************
The lines on which I am getting errors are as below:

package testapi;
use base 'CGI::Application';
use strict;

   # Needed for our database connection
   use DBI;

   sub setup {
 my $self = shift;
 $self->start_mode('mode1');
 $self->run_modes(
  'mode1' => 'showapps',
  'mode2' => 'showyear',
  'mode3' => 'showdates',
  'mode4' => 'showdetails'
 );

   }
   sub teardown {
 my $self = shift;

   }

   sub showapps {
 my $self = shift;

 # Get CGI query object
 my $q = $self->query();
 $val = "";
 $startloc="e:/it support services/db
architecture/sybase/sysmon-webdb";
 opendir(SMD,"$startloc") || die "Failed to open Sysmon DB";
 $c=0;
 while ($dir = readdir(SMD))
 {
   $apps[$c] = $dir;
   $c++;
 }
 closedir(SMD);
 for ($i = 2; $i < $c; $i++ ) {
   $val .= $apps[$i];
   if($i < $c-1)
   {
      $val .= ",";
   }
 }
 my $output = '';
 $output .= $q->start_html(-title => 'Sysmon Database');
 $output .= $q->start_form();
 $output .= $q->scrolling_list(-name=> '@apps', -values=>'$val');
 $output .= $q->hidden(-name => 'rm', -value => 'mode2');
 $output .= $q->submit();
 $output .= $q->end_form();
 $output .= $q->end_html();

 return $output;
   }

   sub showlist {
 my $self = shift;

 my $q = $self->query();
 my $testcode = $q->param("testcode");

 my $output = '';
 $output .= $q->start_html(-title => 'List of Matching tests');

 $output .= $q->end_html();

 return $output;
   }

   sub showdetail {
 my $self = shift;

 my $q = $self->query();
 my $testid = $q->param("testid");

 my $output = '';
 $output .= $q->start_html(-title => 'test Detail');

 $output .= "No details available";

 return $output;
   }
1;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to