The following test program crashes on the second request with option -b with
the error message given in comments at the end of the program.  
HTTP::Cookies::Netscape apparently cannot handle File:// urls.  I worked
around this error by adding code in my app to recognize this situation and
to temporarily unset the cookie jar.  This is with perl-5.8.1, 
libwww-perl-5.76.

Thanks,
Doug

--------------------------------------------------
#!/usr/bin/perl

use LWP;
use HTTP::Cookies::Netscape;
use Getopt::Std;

getopts("b");
# -b invoke bug; otherwise program runs correctly

my $ua = LWP::UserAgent->new;
$jar = HTTP::Cookies::Netscape->new(file => "cookies.txt");

if($opt_b) {
    $ua->cookie_jar($jar);
}

$req = new HTTP::Request GET => "http://www.yahoo.com/";;
$ua->request($req);

$req = new HTTP::Request GET => "file://home/thayer/.bashrc";
$ua->request($req);

## error:
# Can't locate object method "port" via package "URI::file" at 
# /usr/lib/perl5/site_perl/5.8.1/HTTP/Cookies.pm line 127.

---------------------------------------------
perlbug -d output:
---------------------------------------------

---
Flags:
    category=
    severity=
---
Site configuration information for perl v5.8.1:

Configured by thayer at Thu Oct  2 00:32:08 CDT 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.4.19, archname=i686-linux-thread-multi
    uname='linux localhost.localdomain 2.4.19 #11 sun may 4 19:19:05 cdt 2003 i686 
unknown '
    config_args='-Dusethreads -Dprefix=/usr -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O3',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing 
-I/usr/include/gdbm'
    ccversion='', gccversion='3.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lposix
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -lposix
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.1:
    /home/thayer/spool/scripts/lib
    /usr/lib/perl5/5.8.1/i686-linux-thread-multi
    /usr/lib/perl5/5.8.1
    /usr/lib/perl5/site_perl/5.8.1/i686-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.1
    /usr/lib/perl5/site_perl
    .

---
Environment for perl v5.8.1:
    HOME=/home/thayer
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=en_US
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    
PATH=/home/thayer/spool/scripts:/home/thayer/bin:/usr/local/j2sdk1.4.1/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
    PERL5LIB=/home/thayer/spool/scripts/lib
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Reply via email to