A script stopped working when I moved it from Win 2003 server to Win 2008. After some troubleshooting it seems that it was not grabbing the command line parameters.
So I did a print $ARGV and exit at the beginning of the file and I get this: -
Use of uninitialized value $ARGV at .... line X
-
I'm using perl from a folder, not installed or in window's path.
Thanks!
Dan
It's been my experience that this is a common problem when the OP has never installed perl and is using a port which makes you set these types of settings without a supplying any defaults.
The action attribute of the open setting within the file type association should be set to something like this:
"C:\Perl64\bin\perl.exe" "%1" %*
The key part being:
"%1" %*
which sets/allows for the acceptance of the script arguments aka @ARGV. Calling the perl interpreter directly and passing it the script and args will "get around" the problem, but is not the best/proper solution.
10 3677 RonB 589
Expert Mod 512MB
$ARGV is a scalar variable. What you're wanting is @ARGV which is an array.
I you want to post your script and how you're executing it, we should be able to find the problem.
Sorry, that's a PHP->Perl mistake.
There isn't any script, just this: -
-
print "Testing ARGV...\n";
-
print @ARGV;
-
print #$ARGV;
-
-
It prints an empty line after that message of course.
RonB 589
Expert Mod 512MB
Syntax error, change:
to:
Or a better method to see what's in the array. - use Data::Dumper;
-
print Dumper \@ARGV;
yes, that was a typo, I apologize. It remains the same though, still doesn't work.
Whatever it takes to convince you :)
here's my file now: -
use Data::Dumper;
-
print Dumper \@ARGV;
-
Here's the output on Win 2k8: -
C:\>test.pl test test test
-
$VAR1 = [];
-
Weird huh? Code works fine on my XP PC.
Output On XP: -
-
C:\tmp>test.pl test test test
-
$VAR1 = [
-
'test',
-
'test',
-
'test'
-
];
-
-
-
I'm out of ideas. Googled with no avail.
Dan
RonB 589
Expert Mod 512MB
Your file type association is not setup correctly.
Run a test by executing your script like this:
C:\>perl test.pl test test test
This is most puzzling because I have worked on both windows platforms you mentioned, doing Perl development of course, and never experienced this issue. I am anxious to see what happens with Ron's last suggestion.
RonB 589
Expert Mod 512MB
It's been my experience that this is a common problem when the OP has never installed perl and is using a port which makes you set these types of settings without a supplying any defaults.
The action attribute of the open setting within the file type association should be set to something like this:
"C:\Perl64\bin\perl.exe" "%1" %*
The key part being:
"%1" %*
which sets/allows for the acceptance of the script arguments aka @ARGV. Calling the perl interpreter directly and passing it the script and args will "get around" the problem, but is not the best/proper solution.
Agreed! Lets see what happens when they run it.
Ron was exactly right.
I half-heatedly explained that perl is not installed, but since it "worked" I didn't have any technical reasons why ARGV wouldn't work.
It does have to do with file association, because like he said when I gave my file to perl.exe it worked! -
-
C:\temp\Perl64\bin>perl.exe C:\test.pl test test test
-
$VAR1 = [
-
'test',
-
'test',
-
'test'
-
];
-
-
Awesome! Thank you.
Why not installed? This is a loaned/borrowed server and want to return it in the same exact shape I got it. (Running everything from inside a folder makes for easy cleanup later)
Thanks guys,
Dan
I am certainly glad that Ron's suggestion was the issue. On another note, specifically the issue of returning the server in the condition you found it, portable apps are your friend. In fact, Strawberry Perl has a portable version that you can put on a stick. Enjoy!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: jerry |
last post by:
I'm trying to run an application under another user within a winform
app writen in C#. I have tried a number of different things, but it
seems that the CreateProcessWithLogonW function should work...
|
by: PengYu.UT |
last post by:
The following shows the source code and the error message(from
g++-3.3). I wrote two assignment operator. One is for the same type
case, the other one is for different type case. I'm wondering why...
|
by: Sourcerer |
last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and
tried to run it on my friend's computer (he doesn't have the compiler). We both
have Windows XP Professional. I have .NET...
|
by: Sin Jeong-hun |
last post by:
Hi. I need to simulate keyboard and mouse events. For the first step,
I tried to move mouse using SendInput. But it didn't work. I searched
all over the internet for an example, but only questions...
|
by: silkodyssey |
last post by:
I recently installed the release version of visual c#2008 and I
decided to test it with a wpf application. I tried dragging controls
to the form but it doesn't work, the controls do not appear on...
|
by: cosmos22 |
last post by:
The loop below doesn't work, I was wondering if anyone can help me. I need to create an infinate loop around the while condition.
The error states that 'd' is undeclared
Thank you all :)
...
|
by: =?Utf-8?B?QXZhRGV2?= |
last post by:
ASP.Net 2.
We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003
32 Bit with IIS 6. A few library classes we wrote uses impersonation in code
like explained in this...
|
by: Andy B |
last post by:
I have the following code and can't quite figure out why it doesn't work. in
the first section, I am trying to take the data from a entity framework
function import and use it inside a repeater.
...
|
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= |
last post by:
Note: My apologies for repeating this post from last week, but my nospam
alias and profile account were incorrect. I think I have fixed this, so
hopefully this post will trigger MS into a response...
|
by: BuildHome |
last post by:
Hello,
I have windows 2008 R2 and IIS 7.5 with PHP 5.2.4.
I've tried to upgrade to PHP 5.3.3 and the same problem.
I'm using WORDPRESS or phpmyadmin that need to use session.
I've enabled...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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,...
| |