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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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


In reply to looking at tests was: cpan warning by Aldebaran
in thread cpan warning for XML::DoubleEncodedEntities by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found