[Israel.pm] OT: how can you limit your search to a block in vi or emacs?

Gaal Yahas gaal at forum2.org
Tue Sep 9 00:55:10 PDT 2008


Qualify doesn't do anything for lexicals:

perl -Mstrict -MSymbol -le 'my $x; print qualify("x")'
main::x

Also, it doesn't help much with static analysis; you have to insert
calls to at the point where you want qualification to happen.

Also also, it doesn't support sigils: qualify('$x') => main::$x

On Mon, Sep 8, 2008 at 3:42 PM, sawyer x <xsawyerx at gmail.com> wrote:
> hmm... you're right
>
> what about Symbol's qualify() function?
> parsing it with B::Deparse or something like that and then
> qualify()ing variables?
> i haven't looked much into it...
>
> On Mon, Sep 8, 2008 at 1:07 PM, Gaal Yahas <gaal at forum2.org> wrote:
>> What does it mean to "use typeglobs" in this context and why does it help Gabor?
>>
>> Note that lexical variables (declared with "my") are not in a package
>> symbol table.
>>
>> On Mon, Sep 8, 2008 at 12:46 PM, sawyer x <xsawyerx at gmail.com> wrote:
>>> given you want to differ between @x and $x, $x and $x{$name},
>>> $x[$num], i think regular editor (vim / emacs without a macro) does
>>> not seem to cover it.
>>> considering you're probably looking to add variable name replacements
>>> to Pedro, while making sure you're allowing for similar names of
>>> different typed variables (scalar, array, hash could have similar name
>>> and not be mistaken), i think the best answer was to use typeglobs (as
>>> suggested by Dov) or look into packages more specifically.
>>> maybe the search could prompt for a package name (assuming by default
>>> "main" or whatever is in the first "package" paragraph till it finds
>>> another) and then parse the code using perl (i think adam kennedy has
>>> something for that) and change all the variable names.
>>>
>>> On Sun, Sep 7, 2008 at 8:34 PM, Gabor Szabo <szabgab at gmail.com> wrote:
>>>>
>>>> I often need to find (and maybe rename) all the ocurances of a variable.
>>>>
>>>> The problem is
>>>> 1) if the same name is used in multiple places then my search keeps
>>>>     going to the other places as well an does not stay within the scope.
>>>>
>>>> 2) how can I easily locate both @x and $x[2]  but not $x nor $x{name}?
>>>>
>>>> Gabor
>>>> _______________________________________________
>>>> Perl mailing list
>>>> Perl at perl.org.il
>>>> http://perl.org.il/mailman/listinfo/perl
>>> _______________________________________________
>>> Perl mailing list
>>> Perl at perl.org.il
>>> http://perl.org.il/mailman/listinfo/perl
>>>
>>
>>
>>
>> --
>> Gaal Yahas <gaal at forum2.org>
>> http://gaal.livejournal.com/
>> _______________________________________________
>> Perl mailing list
>> Perl at perl.org.il
>> http://perl.org.il/mailman/listinfo/perl
>>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>



-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list