zzspectrez has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am having a bitch of time getting drag and drop to work with perl on Windows XP. It's been a while since I have been hacking around with perl.. So maybee Im just rusty. However, I remember doing this before with windows 98 no problemo. If I remember the jist.... You just use pl2bat on your perl script and then when you drop a file onto the batch file it is passed to your script in @ARGV... right??

Doesnt seem to work...
------------------------------
#!perl print "TEST\n"; print "ARGV: ..@ARGV..\n"; <>;
------------------------------
Then:
c:\pl2bat test.pl c:\test.bat HELLO ARGV: .... c:\test.bat test.pl HELLO ARGV: ..test.pl..
Ok seems to work...
Then I double click on the batch file... I get the expected.
HELLO ARGV: ....
It waits for me to hit return then the cmd window closes.
If you drag and drop on to the batch file, the cmd window opens and then immediately closes...

vitals....
**Win Xp
**Activestate Perl
c:\perl -v
This is perl, v5.8.2 built for MSWin32-x86-multi-thread
(with 25 registered patches, see -V for more detail)
.... snip .......

.Any Suggestions???

thanks..
zzspectrez

Replies are listed 'Best First'.
Re: Activestate Perl and "Drag and Drop"
by Thelonius (Priest) on Jul 16, 2004 at 05:39 UTC
    I think what is happening is that the
    <>;
    is reading one line from the file that you dragged onto it, then Perl is exiting.

    Try

    print "TEST\n"; print "ARGV: ..@ARGV..\n"; <STDIN>;

    On my Windows XP, drag and drop is not working at all for perl files. Did you have to set some extra registry/ftype/assoc setting? Double clicking runs okay for me.

    Updated: Oh, yeah, the whole pl2bat step. Yeah, that works.

Re: Activestate Perl and "Drag and Drop"
by tye (Sage) on Jul 16, 2004 at 18:24 UTC

    Use <STDIN> not <> or use -Mouse ?

    - tye        

      That was it.....
      Thanks...

      So what did <> default to when you drag and drop?? It worked as expected (read from STDIN) untill you droped something on it. Does it default then to @ARGV or to the actual file descriptor of the file dropped on it??

      Thanks!