While I never got around to posting this problem to this mail list, it has
been troubling me for some time and I found a resolution and thought I'd
share it.

The problem:

I've wrote a simple script that uses LWP::UserAgent to automate some form
posting.  It works fine as a .pl, but after using PerlApp to compile to an
.exe, when run the result is a return code of 500 and this error:

     Can't locate object method "host" via package "URI::_foreign"

I went through the usual iterations of compiling and then running, and
noting the error messages of what was missing so I could manually add those
components at compile time and ended up with this compile line:

    perlapp myprog.pl -f -add
URI::_userpass;LWP::MediaTypes;LWP::Protocol::http;File::Basename

This still did not get rid of the other error (above) however.  I tore
through every module I could find to find the cause of the problem to no
avail.  Searching the archive of this mail list I found someone a year ago
or so with the identical same problem and the posted answer was "use
Win32::Internet instead."  Unfortunately I couldn't do that because I'm
doing a "type=FILE" type function and need to have the ability to pass a
filename whose contents should be used as the value of the field.
Win32::Internet doesn't seem to support that but LWP::UserAgent does.


The solution:

Leaving the details of the ordeal out, the final answer is to include this
in your PerlApp line:

    -add URI:http

in in addition to the other components that are being added.  Unfortunately
this missing component didn't give a nice happy error message that pointed
to the cause like the others did.

Hopefully this will help save someone else from pulling out large clumps of
their hair.


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to