Re: FWD: Converting libwww to Win95
Gisle Aas (aas@bergen.sn.no)
Sun, 14 Jul 1996 16:00:49 +0200
In message <31E724FC.6B21@bcs.org.uk>, Martin Cleaver writes:
> Maybe Gisle would be kind enough to comment on why we get
> the subroutine redefined warnings.
[...]
> Yup. I assume the messages are as follows:
>
> Subroutine is_info redefined at
> C:/win32app/perl-extra-libs/prod/standard/HTTP/Response.pm line 175.
> Subroutine is_success redefined at
> C:/win32app/perl-extra-libs/prod/standard/HTTP/Response.pm line 176.
> Subroutine is_redirect redefined at
> C:/win32app/perl-extra-libs/prod/standard/HTTP/Response.pm line 177.
> Subroutine is_error redefined at
> C:/win32app/perl-extra-libs/prod/standard/HTTP/Response.pm line 178.
I have no idea why this would happen.
> This may be a difference between perl 5.001 and perl 5.002 or maybe
> I messed up in my conversion script. I should try converting my
> script on a UNIX box and seeing whether I get the same errors.
>
> Use of uninitialized value at
> C:/win32app/perl-extra-libs/prod/standard/LWP/MediaTypes.pm line 48.
> Use of uninitialized value at
> C:/win32app/perl-extra-libs/prod/standard/LWP/MediaTypes.pm line 48.
>
> This is because $HOME isn't set on Win32 machines. I think that
> LWP shouldn't complain.
I can fix this one, though.
Index: MediaTypes.pm
===================================================================
RCS file: /f/stovner/utvikling/CVSROOT/aas/perl/mods/libwww-perl/lib/LWP/MediaTypes.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MediaTypes.pm 1996/05/08 16:28:55 1.14
+++ MediaTypes.pm 1996/07/14 13:58:29 1.15
@@ -1,5 +1,5 @@
#
-# $Id: MediaTypes.pm,v 1.14 1996/05/08 16:28:55 aas Exp $
+# $Id: MediaTypes.pm,v 1.15 1996/07/14 13:58:29 aas Exp $
package LWP::MediaTypes;
@@ -45,11 +45,12 @@
local($/, $_) = ("\n", undef); # ensure correct $INPUT_RECORD_SEPARATOR
+my @priv_files = ();
+push(@priv_files, "$ENV{HOME}/.media.types", "$ENV{HOME}/.mime.types")
+ if defined $ENV{HOME}; # Some does not have a home (for instance Win32)
+
# Try to locate "media.types" file, and initialize %suffixType from it
-for $typefile ((map {"$_/LWP/media.types"} @INC),
- "$ENV{HOME}/.media.types",
- "$ENV{HOME}/.mime.types",
- ) {
+ for $typefile ((map {"$_/LWP/media.types"} @INC), @priv_files) {
open(TYPE, $typefile) || next;
LWP::Debug::debug("Reading media types from $typefile");
while (<TYPE>) {
Regards,
Gisle.