473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What directory perl script is being run from? - followup

Thanks for quick reply.

Cwd didn't work because it gives what directory
you are currently in not the directory the script is in!

Can't get FindBin to work..any idea what's wrong with the following?

my $Bin;
use FindBin qw($Bin);
use lib "$Bin/../lib";
print $Bin;
My apologies for posting aout easy stuff but I don't use Perl
normally..just doing a quick hack to someone else's script!

Thanks again.

"Jürgen Exner" <ju******@hotmail.com> wrote in
R D wrote:
How do I get a *Windows* perl script to figure out what directory it is being run from/

perldoc Cwd
exists in?

perldoc FindBin


Jul 19 '05 #1
1 6653
On Fri, 19 Mar 2004 at 16:11 GMT, R D <rk*@myrealbox.com> wrote:
Thanks for quick reply.

Cwd didn't work because it gives what directory
you are currently in not the directory the script is in!

Can't get FindBin to work..any idea what's wrong with the following?

You forgot to:

use strict;
use warnings;
my $Bin; ^^^^^^^
Oops! You just declared a lexical variable, obscuring
$FindBin::Bin that you are going to import in the next use
statement. You should have could this yourself because you
are using warnings, aren't you? Always, always "use strict"
and "use warnings".
use FindBin qw($Bin);
use lib "$Bin/../lib";
print $Bin;

Now it prints correctly the path where your script is located.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Al Davis | last post by:
Note: I tried cross-posting this message to several newsgoups, including comp.lang.perl.misc, c.l.p.moderated, comp.infosystems.www.authoring.cgi, comp.lang.javascript and comp.lang.php. Nothing...
by: Thomas Covello | last post by:
Hello, When the following perl script is executed: #!/usr/bin/env perl use strict; use diagnostics; use warnings; # Header bytes for different zip formats my $GZIP_HEADER =...
by: R D | last post by:
Hi, How do I get a *Windows* perl script to figure out what directory it is being run from/exists in? Cheers, R
by: Shabam | last post by:
I have a command script that backs up a user account. This involves moving files from different directories into an archive. Now, I need that script to back up all user accounts on the system,...
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that...
by: Karyn Williams | last post by:
I am new to Pyton. I am trying to modify and understand a script someone else wrote. I am trying to make sense of the following code snippet. I know line 7 would be best coded with regex. I first...
by: kimonp | last post by:
I am running on windows XP with a fresh install of wamp5 (1.7.2) and mediawiki. I am trying to call a perl function from within php using proc_open. The perl script is being executed and...
by: phil469 | last post by:
I'm having an issue when trying to read a file in a user's homedir from a cgi script. I have a virtual host section in my httpd.conf file which I'll include. The cgi script is a very basic script...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.