Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^5: looping logic error while printing output from folder/flie content

by Vijay81 (Acolyte)
on Dec 18, 2012 at 15:41 UTC ( #1009409=note: print w/replies, xml ) Need Help??

in reply to Re^4: looping logic error while printing output from folder/flie content
in thread looping logic error while printing output from folder/flie content

Thanks Graff. Now I have installed pkdb module after reading the point which you said in pervious reply and I can do the debugging line by line.

On this point : "You might also need to consider what will happen when your program has to cover a different pattern of directory nesting."

Even i was thinking this, what ever i tried to script is now only for pre defined set of directory structure, which is very wrong way. Can you please advise how can make script more generic one so that don't need to depend on directory pattern

Many Thanks
  • Comment on Re^5: looping logic error while printing output from folder/flie content

Replies are listed 'Best First'.
Re^6: looping logic error while printing output from folder/flie content
by graff (Chancellor) on Dec 19, 2012 at 04:36 UTC
    The code I posted above is one way to handle variation in the directory structure. You might need to tweak it to get the kind of xml layout that you want.

      Thanks Graff. If am not asking too much. Can you please explain your script in details like what does each line do. so that after i understood correctly i can make the necessary changes

      Just add the comment on the side of each line. that will do for me please

      Many Thanks..

        Seriously? What's stopping you making the effort of learning what each line does, and adding comments yourself? Your post history looks like you're asking for people here to deliver something you're being paid to deliver.

        WIth all due respect, marto's response was reasonable and appropriate. I considered adding more comments to the code I posted above, but then I realized that I don't know enough about your level of knowledge to determine what I should add to be most helpful to you.

        I also reflected on my own experience learning perl as a new language (way back in 1995). Someone handed me a bunch of perl scripts that were supposed to work together as a pipeline to do some really intricate text processing, and I was supposed to adapt it to handle a larger range of input data. I spent at least half of my time referring back to "perldoc -f ..." to look up the detailed (and quite clear) descriptions of perl functions (in fact, I often ran "perldoc perlfunc" to see them all), as well as "perldoc perlsyn", "perldoc perlre" and so on.

        That, along with stepping through in the debugger in order to see what a given function returned for a given input, allowed me to get my task done reasonably well. I highly recommend that approach. (Bear in mind that the code I posted might not do things the way you want them to be done.)

        And now that we have Data::Dumper, using the debugger is even better - just add  use Data::Dumper 'Dumper'; at the top, and as you step through you can just do  p Dumper($some_ref) or  p Dumper(\@some_array) and so on, to see what's happening.

        I agree with you both. Graff and Marto.

        @Marto, please accept my sincere apologize for been rude. It wasn't intentional it's just came out as frastration. I hope you will understand.

        As pointed out, I will come back with comments on Graff script (what ever I understood) and if you think/forgive then please do help me to understand if am missedout or misunderstood the logic

        Once again, I am really sorry and apologize, feel very ashamed of myself

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009409]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2018-06-17 22:28 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.