[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Development hpricot breaks code

lrlebron@gmail.com

12/3/2006 1:35:00 AM

I was using this simple script to parse some links from a web page

require 'open-uri'
require 'hpricot'

strLink = "http://sportsline.com/nfl/scoreboard/2006/w...

@doc = Hpricot(open(strLink))

@doc.search("a").each do |a|

if a.inner_html.include?"GameCenter"
puts 'http://sportslin... + a.attributes['href']
end

end

The script worked fine with the stable gem (0.4) but breaks with the
development gem (4.76). Unfortunately, I cannot find any documentation
that tells me what has changed between them

Any ideas would be greatly appreciated.

thanks,

Luis

5 Answers

Chris Pearl

12/3/2006 1:41:00 AM

0

File a bug on the Hpricot trac:

http://code.whytheluckystiff.net/hpri...

Be sure to include more information, for example the exact error
message, and preferably the smallest piece of code to reproduce said
error.

On 12/3/06, lrlebron@gmail.com <lrlebron@gmail.com> wrote:
> I was using this simple script to parse some links from a web page
>
> require 'open-uri'
> require 'hpricot'
>
> strLink = "http://sportsline.com/nfl/scoreboard/2006/w...
>
> @doc = Hpricot(open(strLink))
>
> @doc.search("a").each do |a|
>
> if a.inner_html.include?"GameCenter"
> puts 'http://sportslin... + a.attributes['href']
> end
>
> end
>
> The script worked fine with the stable gem (0.4) but breaks with the
> development gem (4.76). Unfortunately, I cannot find any documentation
> that tells me what has changed between them
>
> Any ideas would be greatly appreciated.
>
> thanks,
>
> Luis
>
>
>

Trans

12/3/2006 1:45:00 AM

0


lrlebron@gmail.com wrote:
> I was using this simple script to parse some links from a web page
>
> require 'open-uri'
> require 'hpricot'
>
> strLink = "http://sportsline.com/nfl/scoreboard/2006/w...
>
> @doc = Hpricot(open(strLink))
>
> @doc.search("a").each do |a|
>
> if a.inner_html.include?"GameCenter"
> puts 'http://sportslin... + a.attributes['href']
> end
>
> end

Are sure you want to use 'include?' and not 'index' ?

T.


lrlebron@gmail.com

12/3/2006 1:58:00 AM

0

Positive. The script works correctly with include? Does not work with
index.

Luis
Trans wrote:
> lrlebron@gmail.com wrote:
> > I was using this simple script to parse some links from a web page
> >
> > require 'open-uri'
> > require 'hpricot'
> >
> > strLink = "http://sportsline.com/nfl/scoreboard/2006/w...
> >
> > @doc = Hpricot(open(strLink))
> >
> > @doc.search("a").each do |a|
> >
> > if a.inner_html.include?"GameCenter"
> > puts 'http://sportslin... + a.attributes['href']
> > end
> >
> > end
>
> Are sure you want to use 'include?' and not 'index' ?
>
> T.

_why

12/3/2006 7:50:00 AM

0

On Sun, Dec 03, 2006 at 10:35:05AM +0900, lrlebron@gmail.com wrote:
> The script worked fine with the stable gem (0.4) but breaks with the
> development gem (4.76). Unfortunately, I cannot find any documentation
> that tells me what has changed between them

Hey, thanks, this was a problem with script tags found inside javascript blocks.
Speaking particularly of, uh, this here at line 534:

<SCRIPT LANGUAGE="JavaScript">
var tcdacmd="dt";
if (switchTacoda != 'off') {
document.write('<script src="http://an.tacoda.net/an/12026/sl...
language="JavaScript"><\/script>');
}
</SCRIPT>

This is fixed in the repository. Can you checkout from
http://code.whytheluckystiff.net/svn/hpr... and see if it has healed??
Doing `rake install` will make the gem and install it.

_why

lrlebron@gmail.com

12/3/2006 4:21:00 PM

0


_why wrote:
> On Sun, Dec 03, 2006 at 10:35:05AM +0900, lrlebron@gmail.com wrote:
> > The script worked fine with the stable gem (0.4) but breaks with the
> > development gem (4.76). Unfortunately, I cannot find any documentation
> > that tells me what has changed between them
>
> Hey, thanks, this was a problem with script tags found inside javascript blocks.
> Speaking particularly of, uh, this here at line 534:
>
> <SCRIPT LANGUAGE="JavaScript">
> var tcdacmd="dt";
> if (switchTacoda != 'off') {
> document.write('<script src="http://an.tacoda.net/an/12026/sl...
> language="JavaScript"><\/script>');
> }
> </SCRIPT>
>
> This is fixed in the repository. Can you checkout from
> http://code.whytheluckystiff.net/svn/hpr... and see if it has healed??
> Doing `rake install` will make the gem and install it.
>
> _why

After I figured out how to get the svn code in my windows box I ran the
rake install and get the following error

rake package
rake aborted!
undefined method `exitstatus' for nil:NilClass
C:/temp2/hpricot/rakefile:169
(See full trace by running task with --trace)

thanks,

Luis