in reply to Re: XML::Twig Support for Parameter Entities (installed?)
in thread XML::Twig Support for Parameter Entities

Do you have the module URI or URI::File or LWP installed?...

:) I thought of that too, op said I have installed Strawberry Perl v.5.22.0.1 on Windows 7 and therefore use so http://strawberryperl.com/release-notes/5.22.0.1-32bit.html

they are installed

XML::Twig docs warn that these parts are not well tested, heck they're not even documented

  • Comment on Re^2: XML::Twig Support for Parameter Entities (installed?)

Replies are listed 'Best First'.
Re^3: XML::Twig Support for Parameter Entities (errors)
by tye (Sage) on Aug 13, 2015 at 04:05 UTC

    I did look at Corelist and got the impression that none of these are "core" modules. But I didn't look at what non-"core" modules Strawberry includes by default.

    Looking at the code for _use():

    sub _use ## no critic (Subroutines::ProhibitNestedSubs); { my( $module, $version)= @_; ... if( eval "require $module") { ...

    Perhaps they have something loaded that is changing the return value from 'require'? It is pretty darn rare for people to care about the return value from a 'require', which is why I'd write such code as:

    if( eval "require $module; 1" ) { ...

    I'd also try "require LWP" and see what Perl says in response. It would be good to change Twig so that $@ from one of the _use() calls would be appended to the "cannot expand %dtd; - cannot load 'http://127.0.0.1:5000/parameterEntity_core.dtd'" error messages. [ People often seem to underrate the value of error messages. :) ]

    - tye        

      It is pretty darn rare for people to care about the return value from a 'require'

      I used that quite often, as in

      use Data::Dumper; sub DEVEL() { 1 }; # get sample data my hashref = DEVEL ? require 'sampledata.pl' : do_something_costly(); # later on if ( DEVEL ) { open my $fh, 'sampledata.pl' or die "sampledata.pl: $!"; print Dumper($hashref); }

      Also, I use function files for autoloading (function.al) which return an anonymous sub and encapsulate private data in their lexical file scope (see also AutoReloader).

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

        Maybe you should stop, then. There is good reason for most people not paying attention to the return value from 'require'.

        For your use case, 'do' would be more appropriate than 'require'.

        $ echo 13 > lucky.pl $ perl -l print do 'lucky.pl'; print require 'lucky.pl'; print do 'lucky.pl'; __END__ 13 1 13 $

        Which actually makes me a little sad. Being able to reasonably use the return value from 'require' would have some nice benefits.

        - tye        

      Hi, I use LWP in my unit tests.
      Example code:
      require LWP::UserAgent; [other stuff] #reset the counter $ua = LWP::UserAgent->new; $request = $ua->get($URL.'/reset'); [other stuff]
      However I also included "require LWP;" in my sample code.
      I get no error messages/warnings; The code still works fine. Chris