ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
RE: Absoulte path in Perl
by Matt Pettis other posts by this author
May 31 2007 10:21AM messages near this date
Absoulte path in Perl | Re: Absoulte path in Perl
what do you get when you print out the result of 'getcwd'?  does that
give you what you expect?

________________________________

From: activeperl-bounces@[...].com
[mailto:activeperl-bounces@[...].com] On Behalf Of Mothi
Mehta
Sent: Thursday, May 31, 2007 1:37 AM
To: activeperl@[...].com
Subject: Absoulte path in Perl


Hello everyone, 

I am getting problems in Perl to get Absolute path, 

My Directory structure is :   

c:\Inetpub\wwwroot\mytestscripts\perl\path.pl 

scripts details: 

#!/usr/bin/perl -w 
use strict; 
use CGI; 
use Cwd 'abs_path'; 
use Cwd; 
my $cgi           = CGI-> new; 
$cgi-> header; 
print $cgi-> header; 
my $file = getcwd; 
my $abs_path = abs_path($file); 
my $output=''; 
use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # uncommenting this
during debugging phase may be helpful 

  
print <<"END_HTML"; 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<HTML>  
<HEAD>  
<TITLE> Absolute Path Sample Script Showing How To Get Absolute Path In
PERL </TITLE>  
</HEAD>  
<BODY>  
<strong> Sample Script Showing Absolute Path </strong> 
<h3> The Absolute Path is:  $abs_path </h3> 

</BODY>  
</HTML>  
END_HTML 




But when I run this its shows : 

Sample Script Showing Absolute Path 
The Absolute Path is: c:/inetpub/wwwroot 

why its showing "c:/inetpub/wwwroot" instead of
"c:/inetpub/wwwroot/mytestscripts/perl" 

is anything wrong ? 

Please suggest me asap.. 

Thanks in advance.. 
Mohit Mehta 
Thread:
Mothi Mehta
Matt Pettis
kenneth
Mothi Mehta
kenneth
Mothi Mehta
kenneth
Mothi Mehta
Mothi Mehta
Jan Dubois
kenneth
Jan Dubois
Mothi Mehta
kenneth
Mothi Mehta
Mothi Mehta

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved