Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Has anyone seen perl losing arguments?

by MidLifeXis (Prior)
on Sep 28, 2011 at 19:03 UTC ( #928390=note: print w/ replies, xml ) Need Help??


in reply to Has anyone seen perl losing arguments?

You may find it helpful to print out the values of $now_string, $start_date, and $end_date.

--MidLifeXis


Comment on Re: Has anyone seen perl losing arguments?
Select or Download Code
Re^2: Has anyone seen perl losing arguments?
by ted.byers (Scribe) on Sep 28, 2011 at 19:39 UTC

    Oh, I printed everything;$now_string,$start_date and $end_date. Especially when debuggin the programs, I print out everything used as input to a function, command line arguments, &c. If I assign the comand to be executed to a variable, and print that variable before executing it via back ticks or 'system', I see what is supposed to be there, but that has no effect ont he behaviour. On my other machines, it all works as expected. On this server in the cloud, it is causing problems.

        Thanks for your help

        No, I didn't dumper it. rather, I just print intermediate results, until the program has been shown to be working OK.

        The shell is Windows Server Web's cmd

        Here are the contents of my IPC.test.pl script:

        use strict; use warnings; use IPC::System::Simple qw(system systemx capture capturex); $| = 1; my $cmd = 'argv.test.pl qwerty asdfghjk zxcv'; my $op = `$cmd`; print "==============\n",$op,"\n\n=================\n"; my @args; push @args,'argv.test.pl'; push @args,"\"qwerty 12354\""; push @args,'asdfg'; push @args,'zxcvbnm'; system('perl',@args); print "\n\n==============\n"; systemx('perl',@args); print "\n\n==============\n";

        And there are the contents of 'argv.test.pl'

        print "$ARGV[0]\n\t$ARGV[1]\n\t\t$ARGV[2]\n";

        and here is what is written to standard out:

        C:/Perl64.v.5.14/bin\perl.exe -w c:/Work/IPC.test.pl ============== ================= qwerty 12354 asdfg zxcvbnm ============== qwerty 12354 asdfg zxcvbnm ==============

        So, it is clear that my way forward is to use IPC::System::Simple. But what is not clear is why using the default system and back ticks worked fine on WIndows 7, Windows XP, and Windows Server 2003, but fails miserably on Windows Server Web. But I am not going to worry too much about that as long as I can quickly get these programs working again.

        Thanks again.

      Ok, and what were the results? What I see in your post is that the results are undef. Perhaps it would also be useful to print the argument, as a whole, that is passed to system.

      --MidLifeXis

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://928390]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2014-08-01 06:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls