If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > ??need to tell script where perldoc is located??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-17-06, 13:20
NevadaSam NevadaSam is offline
Registered User
 
Join Date: May 2006
Posts: 3
??need to tell script where perldoc is located??

I just received my O'Reilly's Learning Perl book and my first script is not working. I have been learning Perl on my own for a month but this book is new to me. Anyway this simple script probably is not working because it is not locating the file:
Code:
#!C:\Perl\bin
print "Content-type: text/html\n\n";
use CGI qw(:standard -debug);
use strict;

my @lines;

@lines = 'perldoc -u -f atan2';
foreach (@lines) {
	s/\w<([^>]+)>/\U$1/g;
	print;
	}
I am running Perl on Windows XP Pro with IIS. OK, everything is installed right as I have been learning and running scripts for a few weeks. This 'perldoc -u -f atan2' is something by other book did not mention.

I can run perldoc -u -f atan2 fine from the command prompt, but not from the above script. I am thinking that I have to tell the script where perldoc is located and I am not sure how to do that.

Additional information that might be helpful:
perldoc is located at: C:\Perl\bin
The script is in: C:\Inetpub\wwwroot\cgi-bin\OReilly

I am trying to access the script using this in the browser window: http://localhost/cgi-bin/OReilly/whirlwind.cgi and only prints perldoc -u -f atan2 out.

Last edited by NevadaSam; 05-17-06 at 13:26.
Reply With Quote
  #2 (permalink)  
Old 05-17-06, 15:19
KevinADC KevinADC is offline
Registered User
 
Join Date: Feb 2006
Posts: 56
well, well, well, small world huh?

You sure you looked at the book? The single-quotes ' should be back tiks `:

@lines = `perldoc -u -f atan2`;

Looking forward to seeing this question on 6 to 8 other perl forums.
Reply With Quote
  #3 (permalink)  
Old 05-17-06, 15:45
NevadaSam NevadaSam is offline
Registered User
 
Join Date: May 2006
Posts: 3
Thanks, KevinADC. That was the problem, and the text clearly said not to confuse the backquote with the single quote. I still may have a different book than most. It is the 4th Edition of Learning Perl. Only 15 more chapters to go.

I did have to comment out the second line # print "Content-type: text/html\n\n"; before it would print with line breaks. Actually the book did not have that line in their code. It was something that I inserted when the script failed to work. I'm sure that I will understand that later.

Thanks! Problem solved.
Sam

Last edited by NevadaSam; 05-17-06 at 15:49.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On