start_table problem

N

Nikos

Why when i run this i get an eroor saying start_table is undef(i dont
remmber the error exactly but its something abou the line with start_table


====================================================
print start_form(-action=>'games.pl');
print start_table( {class=>'games'} );
while( $row = $sth->fetchrow_hashref )
{
print Tr(
td( {-width=>'20%'}, submit( $row->{gamename} )),
td( {-width=>'75%'}, $row->{gamedesc} ),
td( {-width=>'5%'}, $row->{gamecounter} )
);
}
print end_table;
print end_form, br;

====================================================
 
N

Nikos

Nikos said:
Why when i run this i get an eroor saying start_table is undef(i dont
remmber the error exactly but its something abou the line with start_table

this to be exact:

Software error:

Undefined subroutine &main::start_table called at D:
 
E

Eric Schwartz

Nikos said:
Why when i run this i get an eroor saying start_table is undef(i dont
remmber the error exactly but its something abou the line with
start_table

Your error is on line 42.

Of course, I might be wrong, but since you can't be bothered to cut
and paste the correct error message, I can't be bothered to answer you
properly.

-=Eric
 
C

Chris Mattern

Nikos said:
this to be exact:

Software error:

Undefined subroutine &main::start_table called at D:

Odd, that's not the error I get.

syscjm@sakura:~$ cat testit.plx
print start_form(-action=>'games.pl');
print start_table( {class=>'games'} );
while( $row = $sth->fetchrow_hashref )
{
print Tr(
td( {-width=>'20%'}, submit( $row->{gamename} )),
td( {-width=>'75%'}, $row->{gamedesc} ),
td( {-width=>'5%'}, $row->{gamecounter} )
);
}
print end_table;
print end_form, br;
syscjm@sakura:~$ perl testit.plx
No comma allowed after filehandle at testit.plx line 12.
syscjm@sakura:~$

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
N

Nikos

Chris said:
Nikos wrote:




Odd, that's not the error I get.

syscjm@sakura:~$ cat testit.plx
print start_form(-action=>'games.pl');
print start_table( {class=>'games'} );
while( $row = $sth->fetchrow_hashref )
{
print Tr(
td( {-width=>'20%'}, submit( $row->{gamename} )),
td( {-width=>'75%'}, $row->{gamedesc} ),
td( {-width=>'5%'}, $row->{gamecounter} )
);
}
print end_table;
print end_form, br;
syscjm@sakura:~$ perl testit.plx
No comma allowed after filehandle at testit.plx line 12.
syscjm@sakura:~$

I changed 'print end_form, br;' to 'print end_form;' but i still getting
the same error which i dont understand it at all.
 
N

Nikos

Eric said:
Your error is on line 42.

Of course, I might be wrong, but since you can't be bothered to cut
and paste the correct error message, I can't be bothered to answer you
properly.

-=Eric

If you noticed, i post-followed up with the exact error message, but as
you wish.
 
S

Scott Bryce

Nikos said:
Undefined subroutine &main::start_table called at D:

Usually this error means that you have an undefined subroutine
&main::start_table that you are trying to call from the specified line.
You would solve this problem by writing a start_table subroutine
somewhere in the main package.

It could also mean that the start_table subroutine exists in another
package, probably inside of a module, and you forgot to specify the
package name.
 
M

Mark Clements

Nikos said:
Why when i run this i get an eroor saying start_table is undef(i dont
remmber the error exactly but its something abou the line with start_table
Oh - OK, we'll just guess what the actual error message is, shall we?

How long would it have taken you to run this again to test? Are you
determined to be annoying?

Anyway...
this to be exact:

Software error:

Undefined subroutine &main::start_table called at D:

man perldiag

explains what error messages mean. Of course, in this case the error
message is perfectly clear? Have you read it? I suspect that you have
mispasted the error message anyway - d: is normally a drive
specification rather than a file path.

I'd have thought this particular error messages was fairly
self-explanatory. What do you *think* it means?

In order to try to minimise the pain here, because you won't bother to
read the documentation (see *numerous* other tedious threads for proof -
do you ever look at old threads you have kicked off, Nikos. If you did
you may see a familiar pattern):

you have forgotten to either use CGI or to tell it which subroutines you
want to import:

try

use CGI qw:)standard);

Try reading the documentation for CGI. Oh, sorry - I forgot. You don't
read documentation. Luckily you don't need to: others are more than
willing to read all the documentation that you need for you, and explain
it to you painstakingly.

Can someone please tell me why I'm bothering with this :(

Mark
 
N

Nikos

Jim said:
Did you perhaps forget to include one of the following in your program?:

use CGI qw/:standard/;
use CGI qw/:standard *table/;
use CGI qw/:standard start_table/;

See the documentation for the CGI module:

perldoc CGI

It helps to post a complete, short-as-possible, program that
demonstrates the problem you are having. Had you done so, we would know
whether not including one of above statements was causing your problem.

Iam using this: use CGI qw:)standard)
 
N

Nikos

Scott said:
Usually this error means that you have an undefined subroutine
&main::start_table that you are trying to call from the specified line.
You would solve this problem by writing a start_table subroutine
somewhere in the main package.

It could also mean that the start_table subroutine exists in another
package, probably inside of a module, and you forgot to specify the
package name.


Inside games.pl i dont use any subs.
 
N

Nikos

Mark said:
Oh - OK, we'll just guess what the actual error message is, shall we?

How long would it have taken you to run this again to test? Are you
determined to be annoying?

Anyway...



man perldiag

explains what error messages mean. Of course, in this case the error
message is perfectly clear? Have you read it? I suspect that you have
mispasted the error message anyway - d: is normally a drive
specification rather than a file path.

I'd have thought this particular error messages was fairly
self-explanatory. What do you *think* it means?

In order to try to minimise the pain here, because you won't bother to
read the documentation (see *numerous* other tedious threads for proof -
do you ever look at old threads you have kicked off, Nikos. If you did
you may see a familiar pattern):

you have forgotten to either use CGI or to tell it which subroutines you
want to import:

try

use CGI qw:)standard);

Try reading the documentation for CGI. Oh, sorry - I forgot. You don't
read documentation. Luckily you don't need to: others are more than
willing to read all the documentation that you need for you, and explain
it to you painstakingly.

Can someone please tell me why I'm bothering with this :(

Mark


Iam using
use CGI qw:)standard);

and the exact error message is:

Undefined subroutine &main::start_table called at
D:\www\cgi-bin\games.pl line 44.

just where the print start_table line is.
 
C

Chris Mattern

Nikos said:
Inside games.pl i dont use any subs.
Uh, yes you do. Maybe you didn't mean to, but that's what you wrote:

print start_table( blah blah );

That syntax calls a subroutine called &start_table. If you haven't
defined such a subroutine, you get an error.

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
T

Trey Waters

Iam using this: use CGI qw:)standard)

--

Just to point out the relevant section from `perldoc CGI`:

With a few exceptions (described below), start_tag_name
and end_tag_name functions are not generated automatically
when you use CGI. However, you can specify the tags you
want to generate start/end functions for by putting an
asterisk in front of their name, or, alternatively,
requesting either "start_tag_name" or "end_tag_name" in
the import list.

Funny thing is, the section of the CGI.pm documentation relevant to this
question was found with the FIRST match of searching for "start_table". I
will admit, the text of the paragraph can be a little confusing (esp. if
you're like me, and not the quickest kid on the block), but the example
that follows makes it perfectly clear.

I will let you figure out how to use perldoc to find the example in the
CGI.pm docs which will show you how to fix your error message. :)

Hint: Someone else has already given you the answer.

+-----------------------------------------------------------------------+
Trey Waters (e-mail address removed)
Experience is the worst teacher.
It always gives the test first and the instruction afterward.
+-----------------------------------------------------------------------+
 
C

Chris Mattern

Nikos said:
Iam using
use CGI qw:)standard);

No you aren't. I looked back at the code you posted and there are no
use statements in it of any kind. We cannot debug code you do not post.
and the exact error message is:

Undefined subroutine &main::start_table called at
D:\www\cgi-bin\games.pl line 44.

just where the print start_table line is.

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
N

Nikos

Chris said:
print start_table( blah blah );

That syntax calls a subroutine called &start_table. If you haven't
defined such a subroutine, you get an error.

I see. Can i write it someway else?

This way is ok,- but unfortunately it creates a lot of tables instead of
one:

print start_form(-action=>'games.pl');
while( $row = $sth->fetchrow_hashref )
{
print table( {class=>'games'},
print Tr(
td( {-width=>'20%'}, submit( $row->{gamename} )),
td( {-width=>'75%'}, $row->{gamedesc} ),
td( {-width=>'5%'}, $row->{gamecounter} )
);
}
print end_form;


I need to get the print table before the while which is what i tried but
it gives me that damn error.

How can i put the print table before the while? Is there a way other
than print start_table?
 
N

Nikos

Trey said:
Just to point out the relevant section from `perldoc CGI`:

With a few exceptions (described below), start_tag_name
and end_tag_name functions are not generated automatically
when you use CGI. However, you can specify the tags you
want to generate start/end functions for by putting an
asterisk in front of their name, or, alternatively,
requesting either "start_tag_name" or "end_tag_name" in
the import list.

Funny thing is, the section of the CGI.pm documentation relevant to this
question was found with the FIRST match of searching for "start_table". I
will admit, the text of the paragraph can be a little confusing (esp. if
you're like me, and not the quickest kid on the block), but the example
that follows makes it perfectly clear.

I will let you figure out how to use perldoc to find the example in the
CGI.pm docs which will show you how to fix your error message. :)

Can you beleive that i dont know at all how to use perldoc even how to
serach the syntax of print?

i have activestates perl.
Can i see the help document in browser somehow or is better in console?
 
N

Nikos

Chris said:
No you aren't. I looked back at the code you posted and there are no
use statements in it of any kind. We cannot debug code you do not post.

Iam suign it i just did not post it but since it seems you want it and
blame me for not psoting all the code, here, take it ALL :)

#!/usr/bin/perl
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw:)standard);
use DBD::mysql;
use POSIX qw(strftime);

print header( -charset=>'iso-8859-7' );
print start_html( -style=>'/data/tmpl/style.css',
-title=>'Ðáé÷íßäéá ãéá êáôÝâáóìá!',
-background=>'/data/images/night.gif' );

my ($sth, $row);
my $gamename = param('gamename');
my $host = gethostbyaddr (pack ("C4", split (/\./,
$ENV{'REMOTE_ADDR'})), 2) || $ENV{REMOTE_ADDR};
my $dbh = DBI->connect('DBI:mysql:nikos_db', 'root', 'tiabhp2r') or
{RaiseError=>1};

#===============================================================================

my @row;
$sth = $dbh->prepare( 'INSERT INTO games (gamename, gamedesc,
gamecounter) VALUES (?, ?, ?)' );

open (FILE, "<../data/games/descriptions.txt") or die $!;
while (<FILE>) {
chomp;

@row = split /\t/;
push @row, 0;

$sth->execute( @row );
}
close (FILE);

#===============================================================================

print span( {class=>'lime'}, "Áðü åäþ ìðïñåßò íá êáôåâÜóåéò ùñáßá
áðëÜ ðáé÷íßäéá ðïõ Ý÷ù åðéëÝîåé!" ), br;
print span( {class=>'yellow'}, "Ìðïñåßò íá åðéêïéíùíÞóåéò ìáæß ìïõ óôï
hackeras\@gmail.com" ), br() x 2;

$sth = $dbh->prepare( "SELECT * FROM games" );
$sth->execute;

print start_form(-action=>'games.pl');
print start_table( {class=>'games'} );
while( $row = $sth->fetchrow_hashref )
{
print Tr(
td( {-width=>'20%'}, submit( $row->{gamename} )),
td( {-width=>'75%'}, $row->{gamedesc} ),
td( {-width=>'5%'}, $row->{gamecounter} )
);
}
print end_table;
print end_form;

print br;

if ( !param() ) {
print p( {-align=>'center'}, a( {href=>'index.pl'}, img
{src=>'../data/images/back.gif'} ));
}

#===============================================================================

if( param() )
{
$dbh->do( "UPDATE games SET gamecounter=gamecounter+1 WHERE
gamename=$gamename" );
$dbh->do( "UPDATE visitorlog SET passage=$gamename WHERE host=$host" );

$sth = $dbh->prepare( "SELECT gamename, gamecounter FROM games
where gamename=?" );
$sth->execute( $gamename );
$row = $sth->fetchrow_hashref;

print span( {class=>'lime'}, "Åßóáé ï $row->gamecounter ïò ðïõ
êáôåâÜæåé ôï $row->gamename!!" ), br;
print span( {class=>'yellow'}, "Åëðßæù íá óïõ áñÝóåé êáé íá óïõ
öáíåß ÷ñÞóéìï!" );

print p( {-align=>'center'}, a( {href=>'index.pl'}, img
{src=>'../data/images/back.gif'} ));
print "<script
language='Javascript'>location.href=/data/games/$gamename.rar</script>";
}
 
C

Chris Mattern

Nikos said:
Iam suign it i just did not post it

And I am supposed to use my magic telepathy hat to debug code you are
using but not posting, I guess.
but since it seems you want it and
blame me for not psoting all the code, here, take it ALL :)
Post a simple and complete program that is the minimum necessary to
reproduce the problem. As you have been asked to do MANY, MANY times.

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
A

A. Sinan Unur

Nikos said:
i have activestates perl.
Can i see the help document in browser somehow or is better in
console?

How few brain cells do you really have to have to be able to go

Start -> Programs -> ActiveState ActivePerl 5.8 -> Documentation

Please do not answer this question.

Please STOP abusing this newsgroup.

Please consider physically relocating to another planet, or maybe, at least
take up C programming. I hear the folks in comp.lang.c are much, much
friendlier.

Besides, C is fast, lightning fast.

Sinan.
 
F

Fabian Pilkowski

* Nikos said:
Can you beleive that i dont know at all how to use perldoc even how to
serach the syntax of print?

Well, reading this I understand why you're asking all your annoying
questions here. You don't know *how* to read the docs.

Hiltherto, you have told you won't read at all. -- Is the time coming
where you want to read the docs yourself? Hoping this, I'll answer your
question:

`perldoc` is a program you can call from your console.

To read the docs of one module you have to type `perldoc Module` -- in
the case of CGI.pm (see above) you just have to type `perldoc CGI` as
Trey has mentioned in his posting. When looking for some information
about one of Perl's builtin functions like print(), you have to type
`perldoc -f print`. All this is done from your console.
i have activestates perl.
Can i see the help document in browser somehow or is better in console?

Additionally, when using ActiveState's Perl all these informations are
already available in HTML format. Scout about a subdirectory of Perl's
install dir (AFAIR, "C:\perl" as default) named "html". This HTML pages
are using frames: a left one to show a navigation bar and a right one to
show the information you have choosen in the first. The navigation bar
begins with some ActiveState stuff, followed by the core docs. When
scrolling down some lines you see the docs for all installed modules. As
Sinan has pointed to, there is also a link in your start menu.

Please, have a look at this and try to read it.

regards,
fabian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top