Item1705: Ensure all uses of ListIterator have a 'use' or 'require'

Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Extension
Component: TopicUserMappingContrib
Reported By: MichaelDaum
Waiting For:
Last Change By: KennethLavrsen
Not every call to listitterator had a require resulting in perl errors under certain circumstances. Btw. having a perl require in a busy loop might not be a good idea anyway.

-- MichaelDaum

Reopening per Olivier's notes from ML so it is not forgotten


Sorry, but we should have written some guidelines about that... We 
discussed this quite extensively with CDot and Sven (maybe others too), 
and I think the agreed conclusion was:

If you need a module, but don't need anything it imports, don't use 
top-level require, but use:
use Module ();

So this should have been:
use Foswiki::ListIterator ();

I won't over-write your commit, but I think this rule makes sense.
If you don't see the difference, mainly, require is done at execution 
time, whereas use is done as compilation time. So:
use Foswiki::ListIterator ();
is equivalent to:
    require Foswiki::ListIterator;

Without the (), it will call the import method of the module, which 
might not be interesting, as most of the times it's only looking for a 
function which doesn't exist, or doesn't do anything.


-- KennethLavrsen - 09 Jun 2009

Use use.

-- MichaelDaum - 10 Jun 2009

ItemTemplate edit

Summary Ensure all uses of ListIterator have a 'use' or 'require'
ReportedBy MichaelDaum
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component TopicUserMappingContrib
Priority Normal
CurrentState Closed
Checkins distro:58e09345fe41 distro:9b6d56f50bc1
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r8 - 04 Oct 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy