siegfried wrote:
I think the best I could hope for would be to write a perl script that
generated a bat file and then I manually execute the bat file. I don't
think there is anyway to automate the execution of the bat file.
I'm sure that there is; if you can't put it into its own bat file, you
could have Perl itself execute it via the system() command. Since new
processes (such as those run with system()) inherit the environment,

Yeah: that is precisely the problem. The child inherits from the parent. Can
I make the child manipulate the environment table in the parent? I don't
think so. Please tell me I'm wrong.


it's easy to set up %ENV however you'd like.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

Tom,
Please elaborate. I need to have an interactive command shell with the
symbols set up.

Anytime I run a perl program that uses backquotes or system, those symbols
that are defined by perl will only be good for duration of the perl program
and as soon as perl exits, I'll have a command prompt with none of the new
symbols defined -- correct?

I believe this is true for all *nix and windows shells.

Hi Siegfried

Does the little program suite below solve your problem? Batch file 'test.bat'
calls Perl script 'time.pl' which writes 'time.bat'. 'test.bat' then calls
'time.bat' to set the environment variable and echoes the value to the screen.

As for automating the execution, take a look at the 'at' command. Type

at /?

in the comman prompt window.

HTH,

Rob



**FILE time.pl

use strict;
use warnings;

use Date::Manip;
our $TZ = 'GMT';

my $date = UnixDate('now', '%u');

open my $fh, '> time.bat';

print $fh <<END;
[EMAIL PROTECTED] time=$date
END

close $fh;


**FILE test.bat

@echo off
time.pl
call time.bat
echo %time%


**RUNTIME

E:\Perl\source>test
Wed Nov 15 03:34:40 +0000 2006

E:\Perl\source>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to