Mohd Isa
Mohd Isa

Reputation: 429

Can we use MinGW to compile a Perl script?

I have some problems to compile or run a Perl script in Windows. I have installed MinGW in my Windows to compile C code using the GCC package. Now, can I use MinGW to compile Perl script/code and how?

Upvotes: 1

Views: 2500

Answers (3)

ikegami
ikegami

Reputation: 386361

ActivePerl creates shortcuts for .pl files (if you check the box during installation). You can see the association by running the following from a prompt:

>assoc .pl
.pl=Perl

>ftype Perl
Perl="C:\Progs\perl5121-ap1201\bin\perl.exe" "%1" %*

(Use wahtever assoc returned as the argument for ftype.)

You can do it yourself with:

assoc .pl=Perl
ftype Perl=Perl="C:\Progs\perl5121-ap1201\bin\perl.exe" "%1" %*

(Use the correct path for your machine.)

Keep in mind that many scripts require command line inputs, and that the console closes down as soon as the script exits when you launch it from double-clicking. As such, it's often better to run your script from the prompt.

If you have the association setup as above, you can run a Perl script from the console simply by typing its name

>script.pl
Hello, World!

Or you can be explicit and specify that it requires Perl.

>perl script.pl
Hello, World!

That assumes that Perl is in the PATH. If not, you can specify the whole path to Perl.

>C:\Progs\perl5121-ap1201\bin\perl script.pl
Hello, World!

Upvotes: 1

iconify
iconify

Reputation: 86

See PAR::Packer's frontend pp, or "Cava Packager", or IndigoStar's Perl2Exe, or ActiveState's PerlApp

Upvotes: 3

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74252

No. GCC does not include Perl. Try Strawberry Perl or ActivePerl for Windows which are Perl distributions for Windows.

Upvotes: 4

Related Questions