in reply to Is it possible to overload backticks (qx) operator

It's not entirely equal. The qx example gives me command '1' not found. This indicates that the execution of the qx-result happens after your code is executed. So, maybe you want to override system() instead of qx?


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: Is it possible to overload backticks (qx) operator
by bdimych (Monk) on Oct 21, 2008 at 14:53 UTC
    No, I do not receive "command '1'..." message. Probably it is because of difference of systems

    what I have:

    bdimych@bolshakovxp ~ $ perl -v This is perl, v5.10.0 built for cygwin-thread-multi-64int (with 6 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. bdimych@bolshakovxp ~ $ cat 1.pl BEGIN { use overload; use Data::Dumper; overload::constant 'q' => sub { print Dumper \@_; }; } qq(echo aaa); qx(echo aaa); bdimych@bolshakovxp ~ $ perl 1.pl $VAR1 = [ 'echo aaa', 'echo aaa', 'qq' ]; $VAR1 = [ 'echo aaa', 'echo aaa', 'qq' ]; bdimych@bolshakovxp ~ $ uname -a CYGWIN_NT-5.1 bolshakovxp 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygw +in
Re^2: Is it possible to overload backticks (qx) operator
by bdimych (Monk) on Oct 21, 2008 at 15:08 UTC
    In any case "not found" occurs only after my overloading sub is called, but how to determine operator right inside overloading sub?