1.system("reboot");
which will run a perl script with bat format.At one time I found
that the batch file was running but the system didn't reboot as I
expected so I hit a enter key and suddenly the script continued.I
swear I didn't put anything to wait the keyboard event.Actually ,in
the batch file I just do 3 thing
1.copy file1,file2
2.open a file ,write contents and close it
3.execute the reboot.exe
Usually it works fine but the situation I mentioned happened one or
two times.
Quite strange for me.
2.`pkzip25 -add a.zip @files`
pkzip25 will add the files into a.zip.While perl ran to this
line,it halted
.The pkzip25.exe didn't do its job and I couldn't find the process
from task manager but I was sure the program had run to this line.
Does such kind of situations happened to you?Is it possible to avoid
them?
Thanks for help.
Derek
> 1.system("reboot");
> which will run a perl script with bat format.At one time I found
> that the batch file was running but the system didn't reboot as I
> expected so I hit a enter key and suddenly the script continued.I
> swear I didn't put anything to wait the keyboard event.Actually ,in
> the batch file I just do 3 thing
> 1.copy file1,file2
> 2.open a file ,write contents and close it
> 3.execute the reboot.exe
> Usually it works fine but the situation I mentioned happened one or
> two times.
> Quite strange for me.
It's difficult to know what is going on because you don't really show
all of your code. One thing that might help you find your problem is
to check the return value of the system command (when it doesn't
reboot your machine, of course :). See "perldoc -f system".
> 2.`pkzip25 -add a.zip @files` pkzip25 will add the files into
>a.zip.While perl ran to this line,it halted .The pkzip25.exe didn't
>do its job and I couldn't find the process from task manager but I
>was sure the program had run to this line.
Unless you need to capture stdout of this command, it probably will
help to use the "system" command as you did above and check the return
value.
Jon
--
Two are better than one, because they have a good return for their
work: If one falls down, his friend can help him up... Though one
may be overpowered, two can defend themselves. A cord of three
strands is not quickly broken. -- Ecclesiastes 4:9,12 (NIV)
(snipped)
Your article is gibberish, nothing but nonsense.
> Recently I got problems that my perl script would hang after calling
> making a system call.Two cases are like this
note: "my perl script"
> 1.system("reboot");
> which will run a perl script with bat format.
This will not invoke a Perl script on a Win32 box.
Your syntax will prompt DOS to attempt to execute
a file named "reboot" regardless of extension,
following a DOS default extension sequence.
This will not successfully run a Perl script.
DOS will default to .exe .com or .bat
DOS will not default to an extension of .pl nor .cgi
You cannot associate a .pl nor .cgi extension with
your perl.exe via DOS. You can only do this via
a Windows GUI prompt.
> At one time I found that the batch file
What batch file? You have mentioned no batch file.
You have mentioned a Perl script alleged to be
in a bat format, whatever this nonsense means.
> was running but the system didn't reboot as I
> expected so I hit a enter key and suddenly the script continued.I
> swear I didn't put anything to wait the keyboard event.
Completely irrelevant.
> Actually ,in the batch file I just do 3 thing
What batch file? You still have not mentioned any batch file.
> 1.copy file1,file2
> 2.open a file ,write contents and close it
> 3.execute the reboot.exe
An .exe file is a binary executable. It is not a Perl file nor batch file.
Your reboot.exe was already executed by your system("reboot") previously.
You cannot reboot a Win machine twice by invoking a single instance
of a program, whatever the heck program you think you are using.
Additionally, if you attempt to reboot with Windows running in the
background, Bill Gates will loudly complain to shut down all programs
before rebooting.
I really would like to know how you reboot with Perl waiting for
a system status return; success or failure. Moreover, I really
REALLY want to know how you reboot twice using a single instance
run of some magical program which has yet to surface as a reality.
If you have four files,
reboot.exe reboot.com reboot.bat reboot.pl
which file do you think DOS will execute with a generic system call
lacking any extension?
You have seriously contradicted yourself a number of times.
You say system("reboot") invokes a Perl script. This is untrue.
Subsequently you write about a batch file which appears to not exist.
Finally, you invoke "reboot" for a second time but as a binary file.
Have you considered having a friend help you screw your head on correctly?
Godzilla!
I try to make my questions more clearly as below and hope this time
it's understood easily.Thanks.
Derek
"Godzilla!" <godz...@stomp.stomp.tokyo> wrote in message news:<3C7B2807...@stomp.stomp.tokyo>...
> > Recently I got problems that my perl script would hang after calling
>
> note: "my perl script"
>
sorry but what's wrong here?
>
> > 1.system("reboot");
> > which will run a perl script with bat format.
>
> This will not invoke a Perl script on a Win32 box.
sorry,I thought 'a perl script with bat format' means a batch file
with contents like this
@perl -x -S "%0" %*
@goto end
#!perl
.... perl codes ...
__END__
:end
but it seems wrong ...
>
> > 1.copy file1,file2
> > 2.open a file ,write contents and close it
> > 3.execute the reboot.exe
>
I'm sorry that I didn't explain it clearly.Let me mend my mistake
suppose reboot.bat is in c:\temp and reboot.exe is in c:\temp\bin
the content of reboot.bat is like this
copy "c:\\file1","c:\\file2";
open ($W,">>c:\\file3") or die;
close $W;
system('c:\temp\bin\reboot')
and the way I invoke reboot.bat is like this (in c:\temp)
system("reboot")
I know I should check the return code but what if it doesn't return
,which is what happened to me.
> You have seriously contradicted yourself a number of times.
No ,I don't think so but I admit I'm lack of ability of expression
>
> You say system("reboot") invokes a Perl script. This is untrue.
It's true.IMO reboot.bat is still a perl script
> Subsequently you write about a batch file which appears to not exist.
As mentioned above,it does exist.
> Finally, you invoke "reboot" for a second time but as a binary file.
it's the first time I call this program to reboot my computer
>
> Have you considered having a friend help you screw your head on correctly?
I'd like to if that can improve my English
> Godzilla! wrote:
(snipped)
> > Have you considered having a friend help you screw your head on correctly?
> I'd like to if that can improve my English
It is not your English skills which need first priority improvement, Frank.
Godzilla!
[in a followup to one of Godzilla's usual rants]
> Forgive my poor English and I'm really appreciated for Mr. Godzilla's
> patience to find so many lexical mistakes I have made.It's an
> unexpected gain !
Do not pay any attention to what Godzilla says. It is a troll, and has
no decent working knowledge of Perl or programming in general. Search
groups.google.com to see a history of its posts and replies to these
posts.
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |