miscellaneous tech stuff

posted by tom / April 14, 2006 /

Warning: gibberish ahead. Those of you who don't find Perl and Javascript really, really fascinating should probably stop now.

There, I'm all disclaimed. On to what I've been messing with this week:

  1. WWW::Mechanize is fairly awesome — I wish I'd known about it back when I was doing everything with LWP. However! It isn't really up to the task of interacting with ASP.NET sites. I've generally had a pretty positive outlook on Microsoft's current web platform, but trying to interact with it via Perl is changing my mind — the Viewstate and Javascript stuff is just a mess.

    The site I currently want to talk to changes some dropdown options via Javascript based on what you select in other fields. This is a fairly bad idea, but it really sucks in this situation: because of a "feature" in HTML::Form, you can't submit a value via Mechanize that isn't available for that form element in the page's original HTML. Because of this Javascript situation, the value I need to submit isn't available and Mechanize throws an error.

    The solution seems to be to download the page to the disk, rewrite the parts that don't match my requirements, then point Mechanize at that local copy with a URI::File. For those who don't speak geek, take my word for it: this is a huge pain in the ass. And I'm still not sure it'll work, although I have all the different pieces working in a proof-of-conceptish way. Perl gurus would be welcome to chime in at this point.


  2. Earlier this week Emily pointed me an an old post of Michael's complaining about PDF links that don't label themselves. I feel his pain, and because I felt like wasting 20 minutes writing Javascript, I wrote a GreaseMonkey script to fix the problem. That's not that exciting. What is exciting is that when I tried putting it through the GM script compiler, it actually worked (previous attempts were, um, less successful). So voila: a Firefox extension that does the same thing as the script without having to have GM installed.

    I've tried to mess around with writing FF extensions before, and it's been a mess (I've got no talent for XUL). The GM compiler still won't give you access to the cool, chrome-y things you can do with a real extension, but you can get a lot done with this.

Comments

Can't you just mouseover the link and see where it'll take you?

Posted by: ben wolfson on April 14, 2006 09:02 PM

you're so smart, with your pdf greasemonkey stuff. that's so hot.

Posted by: catherine on April 15, 2006 01:16 AM

i am so astoundingly drunk.

Posted by: catherine on April 15, 2006 01:17 AM

true, except for sites that have evil javascript to interfere. but it's the principle of the thing.

Posted by: tom on April 15, 2006 02:21 PM

this is probably as good a place as any to thank you for the Python tutorials, Tommy. I took the knowledge you gave me, did a little research of my own and was able to answer this question on a job application for 900913...I didn't do it in 20 lines, maybe YOU can ..?!?

Posted by: Jon on April 20, 2006 12:50 AM

well, I'm glad you enjoyed them, Jon. I'm not done, actually -- someday I'll write the final and best one, which covers interacting with websites. But I sort of got sidetracked writing my SMS thingy (and have come to the conclusion in the process that Perl is probably better suited to that sort of thing anyway).

Posted by: tom on April 20, 2006 10:09 AM

Post A Comment

Name


Email Address


URL


Comments


Remember info?



Google Analytics