develooper Front page | perl.perl5.porters | Postings from May 2003

[perl #22224] updated patches

Thread Next
From:
Jim Cromie
Date:
May 25, 2003 07:32
Subject:
[perl #22224] updated patches
Message ID:
3ED0C537.3070702@divsol.com


-------- Original Message --------
Subject: 	Re: [perl #22224] patch perldiag.pod for POSIX functions, 
diagnostics.t
Date: 	Thu, 22 May 2003 22:42:37 -0600
From: 	Jim Cromie <jcromie@divsol.com>
To: 	perl-qa@perl.org
References: 	<20030520133002.25016.qmail@web41812.mail.yahoo.com>



Hi all,

This updates the RT#22224 patches to replace the Q&D backtick 
approach with this;
 
package Test::Nul;
require "./t/test.pl";
package main;
 
ok(exists &Test::Nul::fresh_perl_like, "fresh_perl_like is available");
 
Test::Nul::fresh_perl_like ( 'use POSIX; POSIX::acos()',
                             qr{Usage: POSIX::acos}, 'verbose',
                             'got Usage err for POSIX::acos()');
 

For this to work, I had to hack at t/test.pl a tiny bit; 
I added -I./lib so that fresh_perl could find POSIX.pm.  
Since its after the -I../lib, it seems safe enough...

One teensy shortcut - test.pl has its own "my $tests", so I just 
referred to them as sub-tests, rather than try to wire the $test
variables together.

With these (3) patches, the full test-suite passes (modulo 1 unrelated 
charnames failure, #22223);

That said, pls verify that following L<> in diag.patch is correct; 
Im on Linux, and couldnt load Win32 to test a bad usage.
  See  L<Win32/"Alphabetical Listing of Win32 Functions"> for information,


thanks,
-jimc

PS. diagnostics.pm.diff is not production ready, more of a
'is it worthwhile' probe.


PPS: 

Many more Usages (642 of them, in ~55 packages) are un-diagnosable, 
ie they need a suitable entry in perldiag.pod.  Following the pattern
I started, they could be diagnosed with 55 new entries like the
following, with __PACKAGE__ replaced appropriately;

=item __PACKAGE__::%s(%s)

(F or W) youve used __PACKAGE__ function $1 incorrectly, 
see <__PACKAGE__/$1> for correct usage, and other information.

In covering 642 usage error messages with 55 entries, its likely that
several within each package will clash on (F) vs (W).  This is why
the (F or W) appears above; both types of errors are covered by this
package-specific wildcard item.  This is hopefully tolerable.


PPPS:

longer term, it would be nice if each diagnositc had an example usage
resulted in its issuance.  This would probably help many users to see
their errors.  Im not familiar enough with pod specs, but I think 
theres a way to have code be shown by perldoc, and to be extracted
for use in a lib/diagnostics-examples.t  Whether this belongs in a 
centralized place, or should be in a =head1 DIAGNOSTICS section
is a subject for debate.

=for code example

  { use POSIX(); print POSIX::acos() }

If this gets consensus (he says, jumping the gun), please send such 
code snippets to perl-qa, Ill collect them there.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About