develooper Front page | perl.perl5.porters | Postings from September 2012

RE: Changing the Perl error message when a module is not found

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
September 20, 2012 04:42
Subject:
RE: Changing the Perl error message when a module is not found
Message ID:
alpine.DEB.2.02.1209200731060.12587@fractal.phys.lafayette.edu
On Wed, 19 Sep 2012, Konovalov, Vadim (Vadim)** CTR ** wrote:

> > From: Konovalov, Vadim (Vadim)** CTR ** 
> > > > Given your concerns we eagerly anticipate the patch that strips the
> > > > "Can't locate" out of those strings in a nice sane way.
> > > 
> > > stripping just "Can't locate" will save approx 60+ bytes with 
> > > a cost of adding complexity, so it hardly worth it.
> > 
> > I've tried with latest git, (v5.17.3-485-gdd76683)
> > I made a change to sv.c which eliminates a few strings,
> > namely, instead of 
> > 
> > Can't coerce %s to integer in %s
> > Can't coerce %s to number in %s
> > Can't coerce %s to string in %s
> > Can't coerce readonly %s to string
> > Can't coerce readonly %s to string in %s
> > 
> > I replaced these with one single following string:
> > 
> > Can't coerce %s%s to %s%s%s
> > 
> > with a simple change that is attached.
> 
> now attaching same simple patch but with corrected typo
> 
> > 
> > For not very well understood by me reasons, perl517.dll became a
> > bit larger, not smaller,
> > it became 974,927 bytes instead of 974,922 bytes without my patch.

Similarly, on Linux x86_64 with gcc-4.7.1 with the default optimization
level of -O2, sv.o actually grows a tiny bit from 168160 to 168328 bytes.
The added work involved in handling the extra arguments to sprintf()
ends up outweighing the space savings.

So it was a nice idea to try, but I don't think it's worth applying.

> > > Saving could be done with extracting error messages into 
> > > separate text file,
> > > with adding benefit of e.g. translatibility,
> > > and with the same cost of added complexity, thus maintainability,
> > 
> > I am not sure, if it worth the effort, and - if it does - I am very 
> > welcoming general ideas on the matter, eg. how such error messages
> > could be organized.

That might indeed be a useful project, but I've never looked into how
other big projects handle similar issues, so I don't have any good ideas.

-- 
    Andy Dougherty		doughera@lafayette.edu

Thread Previous | 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