Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

WWW::Hotmail problem

by doonyakka (Beadle)
on Jan 11, 2004 at 18:52 UTC ( [id://320498]=perlquestion: print w/replies, xml ) Need Help??

doonyakka has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to write a very simple script (see relevant code below) using WWW::Hotmail, but every time I try to run it, I get the following error: "The getpwuid function is unimplemented at perl/site/lib/Mail/Audit.pm".

Any ideas on how to fix this would be much appreciated.

Cheers,
doonyakka

PS. I've installed Mail::Audit

#!/usr/bin/perl use strict; use WWW::Hotmail; my $browser = new WWW::Hotmail; $browser->login("foo", "bar"); for ($browser->messages) { $_->retrieve->accept; $_->delete; } exit(0);

Replies are listed 'Best First'.
Re: WWW::Hotmail problem
by ysth (Canon) on Jan 11, 2004 at 22:22 UTC
    Put at the beginning of your script (before using Mail::Audit or any module that uses it):
    BEGIN { *CORE::GLOBAL::getpwuid = sub { wantarray ? (undef,undef,undef,undef,undef,undef,undef, "c:/somehomedir") : "someusername" }; }
    and it should work. (Don't have Mail::Audit installed on Win32 to try.)

    Update: added missing { after BEGIN (Thanks, Liz)

      Thanks, it looks promising. I'll give it a go and let you know what happens.

      I'm away for a couple more days but I'll try it as soon as I get back.

      Cheers.
Re: WWW::Hotmail problem
by tachyon (Chancellor) on Jan 11, 2004 at 19:12 UTC
      I agree. When I read your inital comments I immediately thought you might be running this on a Win32 system. The Mail::Audit module is attempting to use the getpwuid function which isn't supported on Win32. In this case you might be able to alter the Mail::Audit module on your system manually to work around this problem. If you read through the source code for Mail::Audit the module makes several calls to the getpwuid function. Try and amend these few lines to make them Win32 compliant and then re-run your script.

      Have fun!

      Dean
        Try and amend these few lines to make them Win32 compliant.

        The other possible approach is to actually write your own getpwuid. Now, doing a general, re-usable one is hard, because Win32 doesn't supply certain things. (That's why Perl doesn't do this in the first place.) However, you likely only need to return values for one user (yourself), and so a special-case version of it that just works for you might be easy. Especially since the calling code may only be using certain values, such as the username and "comment" (i.e., human-readable name).

        Of course, this may also be futile, since code that relies on getpwuid may make other assumptions that will break on Win32 as well.


        $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://320498]
Approved by TStanley
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-26 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found