Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Perl MIME parser partially works with my code I wrote (code does not exist , there is no code)by Anonymous Monk |
on Oct 03, 2013 at 07:48 UTC ( [id://1056731]=note: print w/replies, xml ) | Need Help?? |
When you get stuck, and what you think should be matching is not matching, its time to ddumperBasic debugging checklist the data you're matching against ( $textstuff, $from ), so you can figure out if the problem is with the data (missing, not what you expected), or with your regex pattern ( m//matching or s///ubstitution ) The script is composed mostly of bits and pieces of other scripts I have found over the last few months .... ny ideas on what would make this work better, and actually log the urls? make it log any messages that match any of the from addresses, IF they don't have an attachment? Thanks all for your help! Hello and congratulations, you got pretty far, you've got a prototype, but now you're a little bit stuck, its time to rethink your approach :) its time to start over :) Why? :) Because you have lines eleven indentation levels deep, there are too many variables around to keep track of ; you need more subroutines The way I would approach this problem/exercise/task, is to pretend the code you have written doesn't exist, grab a pencil and paper, and draw a few boxes , putting a goal into each box :) say
Now that you have goals, start turning them into subroutines, so when you get stuck you can copy/paste only the subroutine which isn't working and concentrate on only fixing it -- easier than fixing entire program :) So you then write something like
Or like
or something like this, all depending on how complicated the matching/extracting is and how it needs to be grouped , which parts are common/similar/alike/reusable
More of this type of idea of rewriting your code in Re: RFC: beginner level script improvement (version control), skimmable code is the idea, more subs, more subs, more subs, more subs, more subs, More generic advice :) On debugging, verify everything, talk to teddybear ... checklists and more talking to yourself out loud is a pretty good debugging technique :) 1 / 2/3
In Section
Seekers of Perl Wisdom
|
|