miscellaneous tech stuff
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:
- 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.
- 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.
