[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] 4.02 How to use: uneval and uneval_it
****** message to minivend-users from Mike Heins <mikeh@minivend.com> ******
Quoting Ton Verhagen (ton@verhagen.net):
> Sorry, but I am a bit lost. Probably I have overlooked something
> very obvious, but I can't see what it could be. Any ideas or
> pointers?
>
It isn't obvious.
[perl]
my $ref = { qw/ foo bar / };
$Tag->uneval( { ref => $ref });
[/perl]
The reason for this is that the $Tag object has some logic that
says if the first argument is a reference it should assume it
is an attribute hash.
You can't, of course, call Vend::Util::uneval_it in a Safe
compartment, so you would neeed [perl global=1] along with
AllowGlobal to make that possible.
The only way to find this would have been to see where I used
the tag, and there was nowhere until 4.02.
Someone wondered once how I find stuff so quickly. Well, one of
my secrets is a little script I wrote called "vg":
#!/usr/bin/perl
use Getopt::Std;
use vars qw/$opt_x $opt_i $opt_g $opt_r $opt_n/;
getopts("gin:rx:");
if(!@ARGV) {
die "usage: vg string [exclude [exclude...]]\n";
}
my $CMD = 'vim';
$CMD = 'gvim' if $opt_g;
my $name = $opt_n ? qq{-name '$opt_n'} : '';
my $rcs_exclude = $opt_r ? q{egrep -v '\.swp|RCS/' |} : '';
my $ic = '';
my $iflag = '';
if( $opt_i ) {
$ic = q{-c 'set ic'};
$iflag = q{-i};
}
if (scalar @ARGV == 1) {
system "$CMD $ic '+/$ARGV[0]/' `find . $name -type f -print -follow | egrep -v '\.swp|RCS/' | sort| xargs grep -l $iflag '$ARGV[0]'`";
}
else {
system "$CMD $ic '+/$ARGV[0]/i' `find . $name -type f -print | grep -v '$ARGV[1]' |sort| xargs grep -l $iflag '$ARGV[0]' `";
}
Basically, it does a recursive grep in the current directory for a pattern
and then feeds the resulting files to my editor (vim). This allows me
to search for a thing like 'Tag..uneval' and find it with authority.
--
Internet Robotics, 131 Willow Lane, Floor 2, Oxford, OH 45056
phone +1.513.523.7621 fax 7501 <mikeh@minivend.com>
I have a cop friend who thinks he ought be able to give a new ticket;
"too dumb for conditions".
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list