Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Difficulty with Logic parsing ICAL feed

by roboticus (Canon)
on Aug 17, 2012 at 16:30 UTC ( #988021=note: print w/ replies, xml ) Need Help??


in reply to Difficulty with Logic parsing ICAL feed

ChocolateCake:

It looks like it doesn't find "SUMMARY", so it keeps resetting $offset to the same location--character 10: -1 + length("DESCRIPTION"). I'd suggest terminating the loop if it can't find SUMMARY or DESCRIPTION.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Difficulty with Logic parsing ICAL feed
Re^2: Difficulty with Logic parsing ICAL feed
by ChocolateCake (Initiate) on Aug 17, 2012 at 17:02 UTC
    THANK YOU!! YOU FIXED MY PROBLEM AND MY CODE WORKS!! BEST FEELING IN THE WORLD!!

      ChocolateCake:

      I should've mentioned: If you're having trouble with a loop like this, you might find it helpful to print the "interesting" variables (e.g. $offset) at the top of the loop. For example:

      while (1) { my $idxSummary = index($string, "SUMMARY", $offset); my $result = ""; my $idxDescription = index ($string, "DESCRIPTION", $offset); my $result2= ""; print "idxSum:$idxSummary, idxDesc:$idxDescriptioni, offs:$offset\ +n";

      Then I'd imagine you'd see something like:

      idxSum:47, idxDesc: 62, offs:0 idxSum:122, idxDesc: 143, offs:73 idxSum:-1, idxDesc:-1, offs:10 idxSum:-1, idxDesc:-1, offs:10 .....

      Then you'd probably figure it processed the first two records, and had a problem with the third. I didn't download your code, nor the ICAL url or anything, so the numbers are entirely fictitious.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

Reaped: Re^2: Difficulty with Logic parsing ICAL feed
by NodeReaper (Curate) on Aug 17, 2012 at 17:02 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-12-25 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls