Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 19th, 2001, 08:50 AM
landim landim is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 2 landim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry

Hi all...

I am making a CGI that runs this...

#!/usr/bin/perl

use DBI;

.
.
.

while (my $hash_ref=$sth->fetchrow_hashref())
{
print"$hash_ref->{name} and $hash_ref->{age}n"
}

this worked perfectly on terminal window...

>PERL MYCGI.CGI

but when i tried trough HTTP, it only prints "and"...

WHY?

Thanks...

landim2@brhs.com.br


Reply With Quote
  #2  
Old January 22nd, 2001, 02:36 PM
timbuckthree timbuckthree is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 4 timbuckthree User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm not sure why it acts like that because I never reference my hashes like that, but I'd figure the '->' reference is being parsed by the browser as a tag error. Try:

Code:
print $hash->{name} . " and " . $hash->{age};


or my favorite

Code:
print "$hash{name} and $hash->{age}";


Also if your working on a remote web server make sure you're connecting to the right data base. I'm sure you've already figured this out but I thought I might give it a guess anyway.

Later,
t

Reply With Quote
  #3  
Old January 29th, 2001, 02:55 PM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
Wink

check your code for the CGI part. It may be that your variables are not being passed to the script properly or that you are not passing them back from the script to the browser properly. Also, I don't see a 'use CGI;' at the top of your script or any other code indicative of a CGI script. You may have to check that. Next time, you may want to include more code to get a more specific answer.

Hope this helps.
__________________
- dsb -
Perl Guy

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Perl only Prints on Terminal Window


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway