Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: cpan warning for XML::DoubleEncodedEntities

by Aldebaran (Curate)
on Jan 02, 2023 at 05:54 UTC ( [id://11149272] : note . print w/replies, xml ) Need Help??


in reply to Re: cpan warning for XML::DoubleEncodedEntities
in thread cpan warning for XML::DoubleEncodedEntities

You didn't say which version of cpan you have, super search is your friend -> Re^4: pod2html: link (L<...>) formatting code (timeloop)

Thx, marto. I know that's not gonna quote well, but your link led to correction: choroba's response in Re^5: pod2html: link (L<...>) formatting code (timeloop). Essentially, the fix is:

rm /home/ken/.cpan/sources/authors/id/?/??/*/CHECKSUMS

Regarding Super Search, I haven't been able to make useful queries with it lately. Is that just me being Super Rusty?

Continuing:

root@laptop:~/.cpan# pwd /root/.cpan root@laptop:~/.cpan# ls sources/authors/id/?/??/*/CHECKSUMS sources/authors/id/B/BL/BLIAKO/CHECKSUMS ... sources/authors/id/C/CO/CORION/CHECKSUMS ... sources/authors/id/D/DA/DAGOLDEN/CHECKSUMS ... sources/authors/id/D/DC/DCANTRELL/CHECKSUMS ... sources/authors/id/D/DR/DROLSKY/CHECKSUMS ... sources/authors/id/M/MI/MIYAGAWA/CHECKSUMS ... sources/authors/id/R/RU/RURBAN/CHECKSUMS sources/authors/id/S/SA/SALVA/CHECKSUMS

Those are certainly the usual suspects, and when I have a problem implementing software with such names on it, I strongly suspect that the problem is local, either on my machine or between my ears. Proceeding:

root@laptop:~/.cpan# rm sources/authors/id/?/??/*/CHECKSUMS root@laptop:~/.cpan# ls sources/authors/id/?/??/*/CHECKSUMS ls: cannot access 'sources/authors/id/?/??/*/CHECKSUMS': No such file +or directory root@laptop:~/.cpan# cpan

Alles klar...und...

cpan[1]> install Astro::SIMBAD::Client

I went over this install very closely, reading many of the sources:

The simbadc script is a simple wrapper for Astro::SIMBAD::Client, whic +h may be used interactively or as a Unix filter. >>>> NOTICE <<<< As of version 0.032_01 the simbadc script is installed by default. If you do not wish it installed. run this script with the -n option. The +-y option is still accepted for backward compatibility. ... Running Build test for WYANT/Astro-SIMBAD-Client-0.046.tar.gz t/basic.t .... 1/? # http://simbad.u-strasbg.fr/: SIMBAD4 1.8 - 2022-1 +2 t/basic.t .... ok #I verified this one in the debugger t/release.t .. ok t/simple.t ... ok t/vo.t ....... ok t/yaml.t ..... ok All tests successful. Files=5, Tests=13, 65 wallclock secs ( 0.07 usr 0.01 sys + 1.59 cusr + 0.23 csys = 1.90 CPU) Result: PASS ... Installing /usr/local/share/perl/5.30.0/Astro/SIMBAD/Client.pm Installing /usr/local/share/perl/5.30.0/Astro/SIMBAD/Client/WSQueryInt +erfaceService.pm Installing /usr/local/man/man3/Astro::SIMBAD::Client.3pm Installing /usr/local/bin/simbadc WYANT/Astro-SIMBAD-Client-0.046.tar.gz ./Build install -- OK cpan[2]> quit

And then, and then, and gentleman and then:

root@laptop:~/.cpan# perl -MAstro::SIMBAD::Client -le '$s=Astro::SIMBA +D::Client->new;@q=split /\n/, $s->url_query(id => Ident => "$ARGV[0]" +, NbIdent => 1);@r=grep/ICRS/,@q;print for @r' aldebaran Coordinates(ICRS,ep=J2000,eq=2000): 04 35 55.23907 +16 30 33.4885 (Op +t ) A [7.38 5.70 90] 2007A&A...474..653V root@laptop:~/.cpan#

Q1) How can I repeat the tests in a comprehensive fashion?

I stepped through one of the tests in the debugger:

DB<1> n + main::(basic.t:8): require_ok 'Astro::SIMBAD::Client' main::(basic.t:9): or BAIL_OUT q{Can't do much testing if can't + load module}; DB<1> n + ok 1 - require Astro::SIMBAD::Client; main::(basic.t:12): my $smb = Astro::SIMBAD::Client->new (); DB<1> n + main::(basic.t:14): ok $smb, 'Instantiate Astro::SIMBAD::Client' main::(basic.t:15): or BAIL_OUT "Test aborted: $@"; DB<1> n + ok 2 - Instantiate Astro::SIMBAD::Client main::(basic.t:17): is $smb->get( 'debug' ), 0, 'Initial debug sett +ing is 0'; DB<1> n + ok 3 - Initial debug setting is 0 main::(basic.t:19): $smb->set( debug => 1 ); DB<1> p debug + debug DB<2> p $smb->get('debug') + 0 DB<3> n + main::(basic.t:21): is $smb->get( 'debug' ), 1, 'Able to set debug +to 1'; DB<3> n + ok 4 - Able to set debug to 1 main::(basic.t:23): $smb->set( debug => 0 ); DB<3> p $smb->get('debug') + 1 24 25 { 26: my $scheme = Astro::SIMBAD::Client::_is_scheme_valid( 27 $ENV{ASTRO_SIMBAD_CLIENT_SCHEME} ) ? 28 'http' : 29: lc $ENV{ASTRO_SIMBAD_CLIENT_SCHEME}; DB<6> n + main::(basic.t:26): my $scheme = Astro::SIMBAD::Client::_is_sch +eme_valid( main::(basic.t:27): $ENV{ASTRO_SIMBAD_CLIENT_SCHEME} ) ? main::(basic.t:28): 'http' : DB<6> c + ok 5 - Default scheme is 'http' # http://simbad.u-strasbg.fr/: SIMBAD4 1.8 - 2022-12 1..5 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<6>

I lengthened Tom's one-liner to a lexical script:

#!/usr/bin/perl -w use v5.030; use Astro::SIMBAD::Client; use Data::Dumper; my $s = Astro::SIMBAD::Client->new; my @q = split /\n/, $s->url_query( id => Ident => "$ARGV[0]", NbIdent +=> 1 ); my @r = grep /ICRS/, @q; print Dumper(@r); #print Dumper(@q);

Output with various choices of ARGV, and a few (edited) runs dumping @q:

fritz@laptop:~/Documents$ ./1.simbad.pl Aldebaran $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 04 35 55.23907 +16 30 33 +.4885 (Opt ) A [7.38 5.70 90] 2007A&A...474..653V'; fritz@laptop:~/Documents$ ./1.simbad.pl Betelgeuse $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 55 10.30536 +07 24 25 +.4304 (Opt ) A [9.04 5.72 90] 2007A&A...474..653V'; ... fritz@laptop:~/Documents$ ./1.simbad.pl Mintaka $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 32 00.40009 -00 17 56 +.7424 (Opt ) A [4.92 2.38 90] 2007A&A...474..653V'; $VAR1 = 'C.D.S. - SIMBAD4 rel 1.8 - 2023.01.01CET05:30:56'; $VAR2 = ''; $VAR3 = 'Mintaka'; $VAR4 = '-------'; $VAR5 = ''; $VAR6 = 'Object * del Ori --- SB* --- OID=@799898 (@@17013,0) - +-- coobox=6469'; $VAR7 = ''; $VAR8 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 32 00.40009 -00 17 56 +.7424 (Opt ) A [4.92 2.38 90] 2007A&A...474..653V'; $VAR9 = 'Coordinates(FK4,ep=B1950,eq=1950): 05 29 27.02698 -00 20 04. +4178'; $VAR10 = 'Coordinates(Gal,ep=J2000,eq=2000): 203.85592217 -17.7397340 +0 '; $VAR11 = 'hierarchy counts: #parents=2, #children=2, #siblings=0'; $VAR12 = 'Proper motions: 0.64 -0.69 [0.56 0.27 0] A 2007A&A...474..65 +3V'; $VAR13 = 'Parallax: 4.71 [0.58] A 2007A&A...474..653V'; ... fritz@laptop:~/Documents$ ./1.simbad.pl Alnilam $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 36 12.81335 -01 12 06 +.9089 (Opt ) A [3.69 1.67 90] 2007A&A...474..653V'; ... $VAR3 = 'Alnilam'; $VAR8 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 36 12.81335 -01 12 06 +.9089 (Opt ) A [3.69 1.67 90] 2007A&A...474..653V'; fritz@laptop:~/Documents$ ./1.simbad.pl Alnitak $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 40 45.52666 -01 56 33 +.2649 (Opt ) A [5.19 2.29 90] 2007A&A...474..653V';

Finally, while I am writing up this simbad install project with what I'm calling success, the site and the client that gets it seem to be going just fine SOAP or no SOAP. (I still don't know what that is.) marto was completely correct that the interface had nothing to do with the problem reported. This is how you get this info with your browser:

https://simbad.cds.unistra.fr/simbad/sim-id?Ident=betelgeuse&submit=su +bmit+id

or betelgeuse.

Thanks all for comments,

Replies are listed 'Best First'.
Re^3: cpan warning for XML::DoubleEncodedEntities
by kcott (Archbishop) on Jan 02, 2023 at 07:11 UTC

    [Minor attribution issue: s/link led to Corion's response/link led to choroba's response/ (2nd paragraph)]

    After successful "rm sources/authors/id/?/??/*/CHECKSUMS", I'd suggest the first thing to do would be to upgrade CPAN. As I indicated in "Re: cpan warning for XML::DoubleEncodedEntities", the vulnerability exists in v2.28; it's fixed in v2.29 (I left some notes about that in "Re^8: pod2html: link (L<...>) formatting code (timeloop)"); the current version is v2.34.

    "Q1) How can I repeat the tests in a comprehensive fashion?"

    For this, I'd generally use the prove utility.

    On the Astro::SIMBAD::Client page, there's a direct link to the tarball, there's also a link to the GitHub repository if you prefer that. Unpack the tarball and run the usual "perl Makefile.PL" followed by "make". At this point, the next step would normally be "make test"; instead of that, run prove here.

    There are a host of options. Some suggestions:

    # Run all tests with verbose output (possibly very lengthy) $ prove -vb t/*.t # Run individual test scripts, e.g. $ prove -vb t/basic.t

    You can run those tests as many times as you want.

    I can't see a "Q2) ...?". :-)

    — Ken

      looking at tests

      Thanks for your reply, kcott. As the world turns, you or Athanasius are the monks who take a first gander with what I am posting in SoPW. I want you to know that I respect you, and I try to adopt your perl style when you offer it. I traffic in a lot of exotic wide characters that I barely understand unless I can relate them to what I know, and when I'm knocking on the monastery door, my encodings are usually less than successful, and anything but well-ordered. I don't think the game is always winnable with some data sets, and I get them too. I'm working on better ways to represent translated data on the command line, but that's still in the works.

      I'd like to take 2 hot seconds to thank the author(s) of Astro::SIMBAD::Client. If there is anything here that reads as criticism, it is that I'm trying to make good software better. I'm delighted that the utility exists.

      For this, I'd generally use the prove utility. On the Astro::SIMBAD::Client page, there's a direct link to the tarball, there's also a link to the GitHub repository if you prefer that. Unpack the tarball and run the usual "perl Makefile.PL" ...

      Q1) How do I make a merge request on this project to change the documentation?

      I've been around the track a couple times with this software, and I'm starting to get the sense of it. I've learned that SOAP is a relative of SMTP. If half the things I know about SMTP apply to SOAP, then I would say that it is an issue that is superceded by the current script.

      So where does the text come from that hits STDOUT during:

      fritz@laptop:~/Documents/perlmonks/Astro-SIMBAD-Client-0.047$ perl Ma +kefile.PL The following optional modules were not available: * SOAP::Lite is not available. This module is required for the query() method. If you do not intend to use this method, SOAP::Lite is not needed. It is not necessary to install these now. If you decide to install the +m later, this software will make use of them when it finds them. The simbadc script is a simple wrapper for Astro::SIMBAD::Client, whic +h may be used interactively or as a Unix filter. >>>> NOTICE <<<<

      Specifically, adiosing the lines:

      The following optional modules were not available: * SOAP::Lite is not available. This module is required for the query() method. If you do not intend to use this method, SOAP::Lite is not needed. It is not necessary to install these now. If you decide to install the +m later, this software will make use of them when it finds them.

      Q1) (^^^specifically) How do I make a merge request on this project to change the documentation?

      I get a really good look at basic.t in the debugger at the precipice before it succeeds:

      >> n # http://simbad.u-strasbg.fr/: SIMBAD4 1.8 - 2022-12 main::(basic.t:36): 1; >> y $smb = Astro::SIMBAD::Client=HASH(0x558df742b510) 'autoload' => 1 'debug' => 0 'delay' => 3 'emulate_soap_queries' => 1 'format' => HASH(0x558df797c188) 'script' => '' 'txt' => '---\\nname: \'%IDLIST(NAME|1)\'\\ntype: \'%OTYPE\'\\nl +ong: \'%OTYPELIST\'\\nra: %COO(d;A)\\ndec: %COO(d;D)\\nplx: %PLX(V)\\ +npm:\\n - %PM(A)\\n - %PM(D)\\nradial: %RV(V)\\nredshift: %RV(Z)\\n +spec: %SP(S)\\nbmag: %FLUXLIST(B)[%flux(F)]\\nvmag: %FLUXLIST(V)[%flu +x(F)]\\nident:\\n%IDLIST[ - \'%*\'\\n]' 'vo' => 'id(NAME|1),otype,ra(d),dec(d),plx_value,pmra,pmdec,rv_v +alue,z_value,sp_type,flux(B),flux(V)' 'parser' => HASH(0x558df796e728) 'script' => '' 'txt' => '' 'vo' => '' 'post' => 1 'scheme' => 'http' 'server' => 'simbad.u-strasbg.fr' 'type' => 'txt' 'verbatim' => 0 >> #p $smb{server} >> r 1..5 Debugged program terminated. Use q to quit or R to restart,

      This is using the following save/source file:

      #source 2.basic.txt #source 2.basic.txt n n n n n n n n n n n n n n s v s n n #v n #save 3.basic.txt #v b 1147 n n n n n n n n n n y #p $smb{server} r #save 4.basic.txt

      Q2) p $smb{server} wasn't the right syntax to print that value. What is? (I'm rusty)

      Moving on to proving.

      fritz@laptop:~/Documents/perlmonks/Astro-SIMBAD-Client-0.047$ prove - +vb t/basic.t t/basic.t .. ok 1 - require Astro::SIMBAD::Client; ok 2 - Instantiate Astro::SIMBAD::Client ok 3 - Initial debug setting is 0 ok 4 - Able to set debug to 1 ok 5 - Default scheme is 'http' # http://simbad.u-strasbg.fr/: http://simbad.u-strasbg.fr/simbad/: 500 + Can't connect to simbad.u-strasbg.fr:80 (Name or service not known) +at t/basic.t line 35. 1..5 ok All tests successful. Files=1, Tests=5, 11 wallclock secs ( 0.03 usr 0.01 sys + 0.19 cusr + 0.03 csys = 0.26 CPU) Result: PASS fritz@laptop:~/Documents/perlmonks/Astro-SIMBAD-Client-0.047$

      We've got a couple issues here. Does the # commented line represent a test?

      As we look deeper, the answer is: yes and no. I might call it a "test on the sly:"

      eval { diag join ': ', $smb->__build_url(), scalar $smb->release(); 1; } or do { my $err = $@; diag join ': ', $smb->__build_url(), $err; };

      So, when I fired up that prove command, I populated the southern end of this routine with values. Yes, the error was successfully reported, and I don't know that I would want to write software that gets blamed for failing when the internet is off, so it represents a bit of a quandary for me.

      As it is, I kick my network manager in the rear, and then repeat:

      alias bounce alias bounce='sudo service network-manager restart ' fritz@laptop:~/Documents/perlmonks/Astro-SIMBAD-Client-0.047$ bounce [sudo] password for fritz: fritz@laptop:~/Documents/perlmonks/Astro-SIMBAD-Client-0.047$ prove -v +b t/basic.t t/basic.t .. ok 1 - require Astro::SIMBAD::Client; ok 2 - Instantiate Astro::SIMBAD::Client ok 3 - Initial debug setting is 0 ok 4 - Able to set debug to 1 ok 5 - Default scheme is 'http' # http://simbad.u-strasbg.fr/: SIMBAD4 1.8 - 2022-12 1..5 ok All tests successful. Files=1, Tests=5, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.20 cusr + 0.01 csys = 0.24 CPU) Result: PASS fritz@laptop:~/Documents/perlmonks/Astro-SIMBAD-Client-0.047$

      Q3) How would we lend this routine official test status?

      Q4) How would we write code to trap this error and then do something useful about it (that is, bouncing the network, waiting 15 seconds and trying again)?

      Q5) How do you get privileges for a script that didn't start with them?

      I'm not sure what the answer is to Q5, but I won't call it a proper answer if it involves me tapping around the keyboard to enter a password. It occurs to me that there might need to be a place where scripts can read the word that makes them sudoed, for example:

      fritz@laptop:~/Documents/repo1$ cat 1.example.config.txt [deepl] url=https://api-free.deepl.com/v2/translate key=redacted [pass] password=shazam!!! fritz@laptop:~/Documents/repo1$

      Q6) Are there more subtle ways to do this?

      I can't see a "Q2) ...?". :-)

      I've always got more questions. I'm trying to pick the right battles. :-)

      Cheers

        I've learned that SOAP is a relative of SMTP.

        That's certainly not how I would phrase it. Perhaps you can explain how you think they are "relatives"?

        Specifically, adiosing the lines:

        The following optional modules were not available: * SOAP::Lite is not available. This module is required for the query() method. If you do not intend to use this method, SOAP::Lite is not needed. It is not necessary to install these now. If you decide to install the +m later, this software will make use of them when it finds them.

        I never use Module::Build when I have the choice but it looks to me like that is Module::Build boilerplate. The only way you are going to remove this is to change the distribution's dependencies such that SOAP::Lite is no longer a recommended dependency.

        Does the # commented line represent a test?

        No. It is a diagnostic message output by the test script which is not part of TAP. You can safely ignore it if all your tests pass. I think this means we can safely bypass Q3, Q4 and Q5. :-)

        Q6) Are there more subtle ways to do this?

        Dear $DEITY I hope not. That's an unattended privilege escalation and is 100% asking for trouble. Don't even go there.


        🦛

        ... you or Athanasius are the monks who take a first gander with what I am posting in SoPW. I want you to know that I respect you, ...

        ++ Thanks for your kind words.

        Both Athanasius and I are in Australia. I suspect our daytime coincides with your nighttime, astronomy activities; other monks in Americas/Europe are possibly tucked up in bed when you post.

        Q1 .. Q6

        I don't think I've had any direct experience with any of these, but here are some hopefully useful links.

        — Ken

Re^3: cpan warning for XML::DoubleEncodedEntities
by Anonymous Monk on Jan 02, 2023 at 18:15 UTC
    > I lengthened Tom's one-liner to a lexical script:

    Tom didn't do that, it was just another perl hacker :)

    Also, your "Output with various choices" wrt "Mintaka" suggests it didn't work, but it does. I guess a few extra lines got pasted cause there's two "$VAR1".