shag has asked for the wisdom of the Perl Monks concerning the following question:
I've been using a WWW::Mechanize script for a couple years to automate some maintenance activities for one of our products (Lyris ListManager, if anyone happens to be familiar). After upgrading the app to a newer version, my script stopped working, though it's not actually "failing" as far as the script is concerned - it's just not doing what it's intended to do. I've been doing tcpdumps and such, and the only notable difference I can find is that the file I'm uploading via the web form has a different content-type via Mechanize vs a browser. Is there a way I can specify a file type for a "file" form field? I don't know if it really matters, as the data being sent is identical in both traces, but it's all I can come up with so far. I'm far from a Mechanize expert, and I'm struggling to troubleshoot further.
The submit button is a linked image, and I'm using click() to call it, specifying the name and some coordinates I stole from a tcpdump from a web session. I didn't have to use coordinates previously, so I'm not entirely sure if I can just pick coords like that, or if they are dynamic and relative to the session somehow.
Below are snippets of the POST, indicating the only notable differences I could find.
Anyone have any ideas? I can post the entire POST if needed...
Working:
-----------------------------2995119424827 Content-Disposition: form-data; name="file_name"; filename="test.csv" Content-Type: application/vnd.ms-excel <data here> -----------------------------2995119424827 Content-Disposition: form-data; name="import.x" 22 -----------------------------2995119424827 Content-Disposition: form-data; name="import.y" 3 -----------------------------2995119424827--
Not Working:
--xYzZY Content-Disposition: form-data; name="file_name"; filename="<path>/tes +t.csv" Content-Type: text/plain <data here> --xYzZY Content-Disposition: form-data; name="import.x" 20 --xYzZY Content-Disposition: form-data; name="import.y" 9 --xYzZY--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize issue
by ikegami (Patriarch) on Apr 08, 2009 at 16:14 UTC | |
|
Re: WWW::Mechanize issue
by almut (Canon) on Apr 08, 2009 at 17:37 UTC |