in reply to Checking if STDIN contains data on win32
It's easier to the opposite: Use STDIN if there are no args. It's better because text can always be added to STDIN, but args cannot be added once a program has started.
my $text; if (@ARGV) { $text = shift(@ARGV); } else { local $/; $text = <STDIN>; }
If the argument is a file name whose content you want to place on the clipboard, the ARGV file handle (the default for <>) does just that.
my $text; { local $/; $text = <>; }
If you still wanted to head down your original path, your best bet would be to check whether your process's STDIN has been redirected using -t STDIN (tested). select and therefore IO::Select only work on sockets in Windows.
|
|---|