perl in Windows: using the "Send To" folder and perl

A

Adam S

Hi,

with a few thousand lines worth of Perl programmnig in a Unix
environment behind me I want to create an application in Windows where
I can mark several files and then right-click and do a "Send To" to a
perl application.

When using the "Send To" right-click menu item, all the files I've
marked are supplied on the command line to the executable i.e.

myexecutable file1.txt file2.txt ... fileN.txt

I create my executable by writing a .bat file which in turn supplies
the input argument with a

eval "perl myperlscript.pl @ARGS" statement.

My first version of myperlscript.pl only printed all the file names
supplied to to stdout just to check how many files I can do.

That's where the problem arises, somewhere along the line it only
manages about 5 files (the path names are rather long, about 50
characters.

Somewhere the command line gets very short, I don't exactly know
where, if itäs the .bat command line that's too short or the perl
command line.

Other "proper" applications, such as gVim, don't seem to have a
problem with 50 similar file names being supplied.

If the solution is to create a perlscript.exe, how do I do that so I
can get rid of the .bat file to launch the perl interpreter? In a Unix
environment I would just add a #!/usr/bin/perl and the script itself
would be an executable, but how do I do it in Windows without
involving a .bat file? Or is there an entirely different solution
where I can do a #! like addition to my script?

Thankful for any help.

Best Regards,
Adam
 
A

A. Sinan Unur

(e-mail address removed) (Adam S) wrote in
with a few thousand lines worth of Perl programmnig in a Unix
environment behind me I want to create an application in Windows where
I can mark several files and then right-click and do a "Send To" to a
perl application.

Well, this is not strictly a Perl question but ...
When using the "Send To" right-click menu item, all the files I've
marked are supplied on the command line to the executable i.e.

myexecutable file1.txt file2.txt ... fileN.txt

I create my executable by writing a .bat file which in turn supplies
the input argument with a

eval "perl myperlscript.pl @ARGS" statement.

My first version of myperlscript.pl only printed all the file names
supplied to to stdout just to check how many files I can do.

That's where the problem arises, somewhere along the line it only
manages about 5 files (the path names are rather long, about 50
characters.

Somewhere the command line gets very short, I don't exactly know
where, if itäs the .bat command line that's too short or the perl
command line.

You do not mention which Windows command shell you are using. command.com
has always been hampered by very short line lengths (numbers like 127 and
255 come to mind). AFAIK, cmd.exe in XP is better but I don't know how much
better.
Other "proper" applications, such as gVim, don't seem to have a
problem with 50 similar file names being supplied.

If the solution is to create a perlscript.exe, how do I do that so I
can get rid of the .bat file to launch the perl interpreter? In a Unix
environment I would just add a #!/usr/bin/perl and the script itself
would be an executable, but how do I do it in Windows without
involving a .bat file? Or is there an entirely different solution
where I can do a #! like addition to my script?

Untested: A solution that might work regardless of the version of Windows
you are using is to create a shortcut to wperl.exe and specify the script
name and command line parameters via that shortcut.

Hope this helps.

Sinan.
 
B

Ben Morrow

Quoth (e-mail address removed) (Adam S):
Hi,

with a few thousand lines worth of Perl programmnig in a Unix
environment behind me I want to create an application in Windows where
I can mark several files and then right-click and do a "Send To" to a
perl application.

When using the "Send To" right-click menu item, all the files I've
marked are supplied on the command line to the executable i.e.

myexecutable file1.txt file2.txt ... fileN.txt

I create my executable by writing a .bat file which in turn supplies
the input argument with a

eval "perl myperlscript.pl @ARGS" statement.

My first version of myperlscript.pl only printed all the file names
supplied to to stdout just to check how many files I can do.

That's where the problem arises, somewhere along the line it only
manages about 5 files (the path names are rather long, about 50
characters.

Somewhere the command line gets very short, I don't exactly know
where, if itäs the .bat command line that's too short or the perl
command line.

My guess would be it's command.com truncating the command line.
If the solution is to create a perlscript.exe, how do I do that so I
can get rid of the .bat file to launch the perl interpreter? In a Unix
environment I would just add a #!/usr/bin/perl and the script itself
would be an executable, but how do I do it in Windows without
involving a .bat file? Or is there an entirely different solution
where I can do a #! like addition to my script?

You can use pp (install PAR.pm).

Alternatively, have you tried putting a shortcut to
c:\path\to\perl c:\path\to\script.pl
in send to instead?

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top