Re: Use of uninitialized valued in concatenation....

2003-08-27 Thread Perrin Harkins
On Fri, 2003-08-22 at 17:23, B. Fongo wrote:
 I have a file (output_tab.pm) that I use to generate tables
 dynamically. Even though it serves its purpose, it goes on generating
 this error:
 
 Script_name.pl: Use of uninitialized value in concatenation (.) or
 string at output_tab.pm line 42.

This is a standard perl error message.  It is not related to mod_perl. 
You can look in the perldiag man page for a more complete explanation.

- Perrin


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Use of uninitialized valued in concatenation....

2003-08-25 Thread Josh Chamas
B. Fongo wrote:
Hello

I have a file (output_tab.pm) that I use to generate tables dynamically. 
Even though it serves its purpose, it goes on generating this error:

Script_name.pl: Use of uninitialized value in concatenation (.) or 
string at output_tab.pm line 42.

At line 42 of your output_tab.pm module, make sure all variables being
used in that line have a value before being used.  For example...
  $null_var ||= '';

The real problem may be that your logic to assign the variable in
the first place doesn't work, but you can make the error message go
away with the mentioned trick.
For more info on this, check out the perldoc perldiag page and
look up the error message for a better explanation.
Regards,

Josh

Josh Chamas, Founder   phone:925-552-0128
Chamas Enterprises Inc.http://www.chamas.com
NodeWorks Link Checker http://www.nodeworks.com


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread B. Fongo
It is not a standard perl error message. I went through mod_perl doc at
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#T
racing_Warnings_Reports

and understand that, the error message appear if one fails to pass a
value to a subroutine before using. Looking through my codes, you may
have noticed that, I did pass 2 arguments to the subroutine.

 

-Ursprüngliche Nachricht-
Von: Perrin Harkins [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 23. August 2003 00:10
An: B. Fongo
Cc: [EMAIL PROTECTED]
Betreff: Re: Use of uninitialized valued in concatenation

On Fri, 2003-08-22 at 17:23, B. Fongo wrote:
 I have a file (output_tab.pm) that I use to generate tables
 dynamically. Even though it serves its purpose, it goes on generating
 this error:
 
 “Script_name.pl: Use of uninitialized value in concatenation (.) or
 string at output_tab.pm line 42”.

This is a standard perl error message.  It is not related to mod_perl. 
You can look in the perldiag man page for a more complete explanation.

- Perrin




--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



AW: AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread B. Fongo





Oh yes I did. I always try my script on the command line to ensure the
syntax are ok before running them on the web server with  mod_perl.  So
the error has to do with mod_perl. Perhaps you may want to take a look
of some examples:

I have a file (output_tab.pm) that I use to generate tables dynamically.
Even though it serves its purpose, it goes on generating this error:

“Script_name.pl: Use of uninitialized value in concatenation (.) or
string at output_tab.pm line 42”.

I went through this section of mod_perl docs und thought I’ve understood
it, but I can’t feature out the error. I’ll appreciate any help.

Below is  my module and a script that triggers such error.

#
 output_tab.pm


#-
# Modulname: output_tab.pm
#-
use strict;
package output_tab;
use vars qw(@ISA @EXPORT);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(output_tab);
use db_Verbindungen;




sub output_tab{
   
   my ($dbh,$abfrage,$columnspan, $sth,@table_head,@table_data);
   ($abfrage, @table_head) = @_;
   $columnspan = @table_head;
   print qq(table width=95% border=1 cellspacing=1
cellpadding=1 align=center);
   print qq(tr bgcolor=#a9a9a9);

   foreach (@table_head){
  print qq(th$_/th);

   }
   print qq(/tr);

   # Erbnisse Anzeigen
   $dbh = db_Verbindungen;
   $sth = $dbh-prepare($abfrage);
   $sth-execute();
   print qq(tr);
   while(@table_data = $sth-fetchrow_array){
  #my $table_data;
  foreach (@table_data)
  {
   
   print qq(td bgcolor='#d0d0d0'$_/td); # Here is line 42
  }
   print qq(/tr);
  }
  print qq(trtd colspan=$columnspan
bgcolor='#d0d0d0'nbsp;/td/tr);
  print qq(/table);
  $sth-finish();
  $dbh-disconnect();   
}
1;
   
 
###


#!/usr/bin/perl -w

#
#Script: pakete_auflisten.pl
#=

use strict;
use db_Verbindungen;
use gui;
use output_tab;


my ($dbh,$abfrage,@table_head);
$abfrage = ('SELECT Gruppe, Paketname, Auftragsdatum, Status,
Statusmeldung FROM Gruppen_Software ORDER BY Auftragsdatum DESC'); 
@table_head = qw(Gruppe Paketname Auftragsdatum Status Statusmeldung);

# Aufruf der Methode top() des gui.pm Moduls.
top('Paketliste');

# At this stage i call the method output_tab with two arguements.
output_tab($abfrage,@table_head);

# Aufruf der Methode footer() des gui.pm Moduls.
footer();


#== ENDE==




Babs
























-Ursprüngliche Nachricht-
Von: Sreeji K Das [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 23. August 2003 11:10
An: B. Fongo; 'Perrin Harkins'; [EMAIL PROTECTED]
Betreff: Re: AW: Use of uninitialized valued in concatenation

Did u check what's in line # 42 ? If u run the same
script with same params as stand-alone, do u see the
warning ?

Sreeji
 --- B. Fongo [EMAIL PROTECTED] wrote:  It is not a
standard perl error message. I went
 through mod_perl doc at

http://perl.apache.org/docs/general/perl_reference/perl_reference.html#T
 racing_Warnings_Reports
 
 and understand that, the error message appear if one
 fails to pass a
 value to a subroutine before using. Looking through
 my codes, you may
 have noticed that, I did pass 2 arguments to the
 subroutine.
 
  
 
 -Ursprüngliche Nachricht-
 Von: Perrin Harkins [mailto:[EMAIL PROTECTED] 
 Gesendet: Samstag, 23. August 2003 00:10
 An: B. Fongo
 Cc: [EMAIL PROTECTED]
 Betreff: Re: Use of uninitialized valued in
 concatenation
 
 On Fri, 2003-08-22 at 17:23, B. Fongo wrote:
  I have a file (output_tab.pm) that I use to
 generate tables
  dynamically. Even though it serves its purpose, it
 goes on generating
  this error:
  
  “Script_name.pl: Use of uninitialized value in
 concatenation (.) or
  string at output_tab.pm line 42”.
 
 This is a standard perl error message.  It is not
 related to mod_perl. 
 You can look in the perldiag man page for a more
 complete explanation.
 
 - Perrin


Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/




--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Use of uninitialized valued in concatenation....

2003-08-23 Thread Frank Maas
B. Fongo wrote:
 “Script_name.pl: Use of uninitialized value in concatenation (.) or
 string at output_tab.pm line 42”.

Perrin replied:
 This is a standard perl error message.  It is not related to mod_perl. 
 You can look in the perldiag man page for a more complete explanation.

B. Fongo wrote:
 It is not a standard perl error message. I went through mod_perl doc at
 http://perl.apache.org/docs/general/perl_reference/perl_reference.html#T
 racing_Warnings_Reports

I am sorry, but it *is* a standard Perl error message. It means exactly
what it says: you concatenated or stringify an undefined value. Looking
in your code (of which I do not know exactly where it starts, so line 42
is a bit of a guess) it can be either

   print qq(td bgcolor='#d0d0d0'$_/td);
or
  print qq(trtd colspan=$columnspan
bgcolor='#d0d0d0'nbsp;/td/tr);

In the latter case, please check $columnspan to be sure it is given a
defined value. For the first: you go through a list of tablerow values,
can it be that a value is NULL? This would be translated into undef and
hence raise this warning. Try to replace with

   my $val=$_||'NULL'; print qq(td bgcolor='0#d0d0d0'$val/td);

--Frank


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread Sreeji K Das
Did u check what's in line # 42 ? If u run the same
script with same params as stand-alone, do u see the
warning ?

Sreeji
 --- B. Fongo [EMAIL PROTECTED] wrote:  It is not a
standard perl error message. I went
 through mod_perl doc at

http://perl.apache.org/docs/general/perl_reference/perl_reference.html#T
 racing_Warnings_Reports
 
 and understand that, the error message appear if one
 fails to pass a
 value to a subroutine before using. Looking through
 my codes, you may
 have noticed that, I did pass 2 arguments to the
 subroutine.
 
  
 
 -Ursprüngliche Nachricht-
 Von: Perrin Harkins [mailto:[EMAIL PROTECTED] 
 Gesendet: Samstag, 23. August 2003 00:10
 An: B. Fongo
 Cc: [EMAIL PROTECTED]
 Betreff: Re: Use of uninitialized valued in
 concatenation
 
 On Fri, 2003-08-22 at 17:23, B. Fongo wrote:
  I have a file (output_tab.pm) that I use to
 generate tables
  dynamically. Even though it serves its purpose, it
 goes on generating
  this error:
  
  “Script_name.pl: Use of uninitialized value in
 concatenation (.) or
  string at output_tab.pm line 42”.
 
 This is a standard perl error message.  It is not
 related to mod_perl. 
 You can look in the perldiag man page for a more
 complete explanation.
 
 - Perrin


Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: AW: AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread Udo Rader
Am Sat, 23 Aug 2003 09:48:05 + schrieb B. Fongo:
   foreach (@table_data)
   {

print qq(td bgcolor='#d0d0d0'$_/td); # Here is line 42
   }

as Frank already pointed out, your trouble is the uninitialized $_ value
you have in line 42 (which is exactly what the warning tells you, BTW).

the reason for this is very probably that @table_data contains items
that have not been initialized (= they have no value, not even an
empty value assigned to them). @table_data is filled from
database, so _check your database_. I bet you will find null values in
here.

if you don't want to output anything if the database delivers such a null
value simply replace your line 42 with

-CUT--
print qq(td bgcolor='#d0d0d0'$_/td) if $_;
-CUT--

if you want to output an empty line for null values, then do as Frank
suggested:

-CUT--
my $val=$_||'NULL'; print qq(td DEFANGED_bgcolor=0#d0d0d0$val/td);
-CUT--

and no, this has definitively absolute nothing to do with mod_perl, thats
just expected and normal perl behaviour.

happy hacking

udo


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Re: AW: AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread Marcel Greter

-CUT--
my $val=$_||'NULL'; print qq(td DEFANGED_bgcolor=0#d0d0d0$val/td);
-CUT--
 

This is not a very good solution. You would also catch the case where $_ 
is 0, which may should not happen. You would better do

foreach (@table_data) {
$_ = defined $_ ? $_ : NULL;
print qq(td bgcolor='#d0d0d0'$_/td); # Here is line 42
}
Basically you also simply could use the warnings pragma within this sub :

no warnings uninitialized;

greets, Marcel



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Re: AW: AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread Frank Maas
On Sat, Aug 23, 2003 at 01:55:03PM +0200, Marcel Greter wrote:
 
 This is not a very good solution. You would also catch the case where $_ 
 is 0, which may should not happen. You would better do

Yes... I always fall into that pithole. I think this is because I find
the 'defined(...) ? ... : ...' phrase is kinda ugly. Silly me, I know.

   $_ = defined $_ ? $_ : NULL;

Still... I don't know if I like toying around with $_. Especially since
you change the real array value (and not a copy) and this might cause
problems later on (should you use the values somewhere else as well).

But why are we talking about this on a mod_perl list. Sorry guys.

--Frank


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: AW: AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread Stas Bekman
Frank Maas wrote:
On Sat, Aug 23, 2003 at 01:55:03PM +0200, Marcel Greter wrote:

This is not a very good solution. You would also catch the case where $_ 
is 0, which may should not happen. You would better do


Yes... I always fall into that pithole. I think this is because I find
the 'defined(...) ? ... : ...' phrase is kinda ugly. Silly me, I know.

	$_ = defined $_ ? $_ : NULL;
perl 5.9 has introduced a new operator //= to make it spiffy, so you'd write 
the above as:

  $_ //= NULL;

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


AW: Use of uninitialized valued in concatenation....

2003-08-23 Thread B. Fongo
OK Guys!

Thanks for all the contributions. All along, I thought mod_perl was
complaining that $_ isn't initialized. Most of the suggestions I got
points to the array (@table_data) in the loop. It is actually true that
the some of the values of the array are NULL. 

Thanks again for all those suggestions.

Babs





-Ursprüngliche Nachricht-
Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Udo Rader
Gesendet: Samstag, 23. August 2003 13:00
An: [EMAIL PROTECTED]
Betreff: Re: AW: AW: Use of uninitialized valued in concatenation

Am Sat, 23 Aug 2003 09:48:05 + schrieb B. Fongo:
   foreach (@table_data)
   {

print qq(td bgcolor='#d0d0d0'$_/td); # Here is line 42
   }

as Frank already pointed out, your trouble is the uninitialized $_ value
you have in line 42 (which is exactly what the warning tells you, BTW).

the reason for this is very probably that @table_data contains items
that have not been initialized (= they have no value, not even an
empty value assigned to them). @table_data is filled from
database, so _check your database_. I bet you will find null values in
here.

if you don't want to output anything if the database delivers such a
null
value simply replace your line 42 with

-CUT--
print qq(td bgcolor='#d0d0d0'$_/td) if $_;
-CUT--

if you want to output an empty line for null values, then do as Frank
suggested:

-CUT--
my $val=$_||'NULL'; print qq(td DEFANGED_bgcolor=0#d0d0d0$val/td);
-CUT--

and no, this has definitively absolute nothing to do with mod_perl,
thats
just expected and normal perl behaviour.

happy hacking

udo


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html





--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Use of uninitialized valued in concatenation....

2003-08-22 Thread B. Fongo
Title: Use of uninitialized valued in concatenation








Hello

I have a file (output_tab.pm) that I use to generate tables dynamically. Even though it serves its purpose, it goes on generating this error:

Script_name.pl: Use of uninitialized value in concatenation (.) or string at output_tab.pm line 42.

I went through this section of mod_perl docs und thought Ive understood it, but I cant feature out the error. 

Below it my module and a script that triggers such error.

#

output_tab.pm



#-

# Modulname: output_tab.pm

#-

use strict;

package output_tab;

use vars qw(@ISA @EXPORT);

require Exporter;

@ISA = qw(Exporter);

@EXPORT = qw(output_tab);

use db_Verbindungen;




sub output_tab{

 

 my ($dbh,$abfrage,$columnspan, $sth,@table_head,@table_data);

 ($abfrage, @table_head) = @_;

 $columnspan = @table_head;

 print qq(table width=95% border=1 cellspacing=1 cellpadding=1 align=center);

 print qq(tr bgcolor=#a9a9a9);

 foreach (@table_head){

 print qq(th$_/th);

 }

 print qq(/tr);

 # Erbnisse Anzeigen

 $dbh = db_Verbindungen;

 $sth = $dbh-prepare($abfrage);

 $sth-execute();

 print qq(tr);

 while(@table_data = $sth-fetchrow_array){

 #my $table_data;

 foreach (@table_data)

 {

 

 print qq(td bgcolor='#d0d0d0'$_/td);

 }

 print qq(/tr);

 }

 print qq(trtd colspan=$columnspan bgcolor='#d0d0d0'nbsp;/td/tr);

 print qq(/table);

 $sth-finish();

 $dbh-disconnect(); 

}

1;

 

 ###



#!/usr/bin/perl -w

#

#Script: pakete_auflisten.pl

#=

use strict;

use db_Verbindungen;

use gui;

use output_tab;


my ($dbh,$abfrage,@table_head);

$abfrage = ('SELECT Gruppe, Paketname, Auftragsdatum, Status, Statusmeldung FROM Gruppen_Software ORDER BY Auftragsdatum DESC'); 

@table_head = qw(Gruppe Paketname Auftragsdatum Status Statusmeldung);

# Aufruf der Methode top() des gui.pm Moduls.

top('Paketliste');

# At this stage i call the method output_tab with two arguements.

output_tab($abfrage,@table_head);

# Aufruf der Methode footer() des gui.pm Moduls.

footer();


#== ENDE==






Ill appreciate any help.





Babs