Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: foreach/while loop help

by Anonymous Monk
on Jul 12, 2015 at 23:19 UTC ( [id://1134436]=note: print w/replies, xml ) Need Help??


in reply to foreach/while loop help

Aside from the typos (smart quotes) what is the problem?

I see you have nested loops, this means you need more function

I also see you have readline loop inside readline loop but with open outside the loops -- this means you definitely need more functions

Replies are listed 'Best First'.
Re^2: foreach/while loop help
by bshah (Novice) on Jul 12, 2015 at 23:37 UTC

    Thanks for your reply.
    The issue is , code isn't looping through each group and member from the list
    As you mentioned, the looping inside looping is confused, I guess and need more functions but don't know what it is.
    I'm just learning to write in Perl so definitely need more help to understand.

      The issue is , code isn't looping through each group and member from the list

      What loop is that?

      Why do you think it isn't looping, because data is missing, or ldap calls aren't returning data or ?

      The way to solve that problem is to eliminate everything from the code that isn't that loop, and solve only that loop, see Re^2: Perl Script and Re^4: Main logic of this script (summary/abstract/outline) (and parent/replies)

      So when I run your program through ppi-outline.pl I get

      so I might rewrite that as

      while( $dl = <FH> ){ my @entries = GetEntries( ... ); FudgeEntries( \@entries, $removememfilepath ); }

      Basicaly outline the program in terms of subroutines ( make more subs, don't develop allergy ) that actually run, even if that means making them stubs stubs by hardcoding the data, then one by one turn the stubs into real subs. Get running code first, then slowly improve that running code.

      is ldap-master temporarily offline? If you use stubs you can still develop your program .... and others who don't use ldap at all (or don't have an is ldap-master like yours) can help you

      Is the problem with GetMembers()? Only concentrate on getmembers ....

      Somewhere in your program you make an assumption about a function or some data that isn't true, so your program doesn't work the way you want it; all you have to do is find it, that gets easy with small subs

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1134436]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-25 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found