Hi,
Thanks for all your replies.
A few points about the batch file I would like to convert is that it has the
following:
1) labels and goto's
2) if statements
3) variables
I tried the first suggestion on the following batch file that uses labels
and gotos:
goto.bat
======
:begin
echo hello world
goto begin
goto.pl
=====
use strict;
use warnings;
my $command;
$command=':begin';
system ($command);
$command='echo hello world';
system ($command);
$command='goto begin';
system ($command);
This shows that it's not just about transferring the commands from .bat to
.pl.
What's needed is something that understands DOS batch labels and goto's, if
statements and variables.
Would it still be helpful if I got the actual batch file I am would like to
convert?
I WHISH I had written it in PERL to begin with........
Thanks,
Richard.
_ ___
|_) |
| \ICHARD |HOMAS.
[EMAIL PROTECTED]
rdthomas.welcome.to
From: David Nicol <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
CC: [email protected]
Subject: Re: .bat to .pl
Date: Sat, 3 Sep 2005 21:20:56 -0500
MIME-Version: 1.0
Received: from listserv.activestate.com ([209.17.183.249]) by
mc3-f33.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Sat, 3 Sep 2005
20:01:31 -0700
Received: from listserv.activestate.com (localhost.localdomain
[127.0.0.1])by listserv.activestate.com (8.12.10/8.12.10) with ESMTP id
j842V0fk024552;Sat, 3 Sep 2005 19:31:16 -0700(envelope-from
[EMAIL PROTECTED])
Received: from smtp5.ActiveState.com (sack.ActiveState.com
[192.168.2.149](may be forged))by listserv.activestate.com
(8.12.10/8.12.10) with ESMTP idj842L4XE023902 for
<[email protected]>;Sat, 3 Sep 2005 19:21:04 -0700
(envelope-from [EMAIL PROTECTED])
Received: from smtp8.activestate.com (smtp8.activestate.com
[192.168.2.82])by smtp5.ActiveState.com (8.12.11/8.12.11) with ESMTP id
j842Kv9F016116for <[email protected]>;Sat, 3 Sep 2005
19:20:57 -0700 (envelope-from [EMAIL PROTECTED])
Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198])by
smtp8.activestate.com (8.13.4/8.13.4) with ESMTP id j842Klb5098357for
<[email protected]>;Sat, 3 Sep 2005 19:20:47 -0700
(PDT)(envelope-from [EMAIL PROTECTED])
Received: by zproxy.gmail.com with SMTP id r28so506814nzafor
<[email protected]>;Sat, 03 Sep 2005 19:20:56 -0700 (PDT)
Received: by 10.36.160.8 with SMTP id i8mr1162869nze;Sat, 03 Sep 2005
19:20:56 -0700 (PDT)
Received: by 10.36.113.8 with HTTP; Sat, 3 Sep 2005 19:20:56 -0700 (PDT)
X-Message-Info: JGTYoYF78jFlQsajRlpviDLhXeuqB4sValtfJgdh3tI=
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta;
d=gmail.com;h=received:message-id:date:from:reply-to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;b=W3zqE7fAsa/JiB22h4d8QJmCibj6ef1rmsR7v8eTP28/6glgpuMwtLjxKylcNNTIe5FES3MRQVBVS/d5Jg68/+QnDYSfJwoJoWg4XTqsKL6395oW6eYcUWhw+CUCnnb+i49jdGiNxuC8ysr7gXyA6M9hLDH40B6xXa+2yW/c7So=
References:
<[EMAIL PROTECTED]><[EMAIL PROTECTED]><[EMAIL PROTECTED]>
X-PerlMx-Spam: CA, All, Gauge=IIIIIII, Probability=7%, Report='__CD 0, __CT
0,__CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY
0,__MIME_VERSION 0, __SANE_MSGID 0'
X-SpamReport: No antispam rules were triggered by this message
X-PMX-Version: CA 4.7.1.128075, Antispam-Engine: 2.1.0.0,Antispam-Data:
2005.9.3.36
X-MIME-Autoconverted: from quoted-printable to 8bit
bylistserv.activestate.com id j842L4XE023902
X-BeenThere: [email protected]
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Discussions relating to
ActivePerl<activeperl.listserv.ActiveState.com>
List-Unsubscribe:
<http://listserv.ActiveState.com/mailman/listinfo/activeperl>,
<mailto:[EMAIL PROTECTED]>
List-Archive:
<http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/activeperl>
List-Post: <mailto:[email protected]>
List-Help:
<mailto:[EMAIL PROTECTED]>
List-Subscribe:
<http://listserv.ActiveState.com/mailman/listinfo/activeperl>,
<mailto:[EMAIL PROTECTED]>
Errors-To: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 04 Sep 2005 03:01:31.0911 (UTC)
FILETIME=[F3D6B970:01C5B0FC]
On 9/3/05, Rick Nakroshis <[EMAIL PROTECTED]> wrote:
> To be more precise, no, there is no translator that analyzes what
> your batch file is doing to then generate a perl script. If you show
> us your batch file, we can give you some pointers and ideas if you like.
>
> Rick
I can't think of a standard DOS 5 utility that has functionality not
available from within Perl, so the tool would certainly be possible.
It would look something like this:
#!perl
use BatchInPerlLibraryModuleThatHasNotBeenWrittenYet;
while(<>){
my($command, $args) = /(\w+)\s+?(.*)/ or next;
$command = lc $command;
$command eq 'rem' and next;
isBATCH($command) and do{
BatchInPerlLibraryModuleThatHasNotBeenWrittenYet->$command($args);
next;
};
system($_); # fall back to looking the FS anyway
};
__END__
If you were to write this module you would be a hero to anyone who needs
to port batch files to non-MSDOS systems. You could write the parts of it
that are needed to support the scripts you need to port, then ask for a TPF
grant to write the rest of it.
Sort of like TChrist's project to rewrite all the unix command line
tools in Perl.
MSDOS is a unix, you know -- I have a MSDOS 2.0 manual, and it talks about
MSDOS as being a weak version of unix, when introducing the piping and
redirection
operators.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs