SPUG: backticks, system, and ImageMagick

Matt Tucker tuck at whistlingfish.net
Mon Feb 25 14:45:45 CST 2002

-- Richard Wood <wildwood_players at yahoo.com> spake thusly:

> I am having a problem with backticks and I am looking
> for new ideas on what it could be.

> When I write a very simple script such as:
> perl -e "print `mogrify`;"
> I get the usage only if I use mogrify, or convert.  
> If I try identify, composite, or montage, I get
> nothing.

> Could some of the commands be writing to something
> other than STDOUT? like STDERR?

Yes. Backticks fail to capture STDERR, and many programs write their
usage to that. However, you should still be seeing the output, since
the backticks aren't capturing it.

On unix I'd say do '2>&1', but obviously that's not a choice without
installing cygwin. The other option is to use something like
IPC::Open3. As I recall there's an OO interface to that functionality
that works rather nicely, but I can't remember what it's called.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20020225/06ea3cf5/attachment.bin

More information about the spug-list mailing list