• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Storage.pm line 1596 (getListOfWebs):

@webList =
    grep {
        $security->checkAccessPermission( 'view', $user, undef, undef, $_ )
    } @webList;

Depending on the UserMapping-module there might be a lot of code behind checkAccessPermission(). The code above depends on $_ not being changed by the called code. Please change it to something along the lines of

my @wl;
foreach (@webList) {
    push ( @wl, $_ ) if $security->checkAccessPermission( 'view', $user, undef, undef, $_ );
@webList = @wl;

I know its not half as elegant but much safer. And its quite hard to diagnose if you are bit by this.

Huh? $_ is a local variable - it is scoped by the context it is called within. For example, try this:
my @blah = (
   [ 'A', 'a', 'B' ],
   [ 'X', 'y', 'z' ],

foreach (@blah) {
   print join(',', grep {$_ =~ /[A-Z]/} @$_),"\n";

While I agree that $_ is a horrible concept, there is nothing wrong with the above code. Discarded.


Summary grep's relience on $_ causes trouble
ReportedBy TWiki:Main.EdgarHolleis
Codebase 4.0.4
SVN Range TWiki-4.1, Sat, 23 Sep 2006, build 11571
AppliesTo Engine

Priority Low
CurrentState No Action Required


TargetRelease n/a
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2006-09-30 - CrawfordCurrie
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback