Re: peer review for first CPAN module? (JavaScript minification)

2007-05-24 Thread Adriano Ferreira

On 5/24/07, Peter Michaux [EMAIL PROTECTED] wrote:

Hi,

I'm writing a new version of JavaScript::Minification on CPAN. This is
my first CPAN module and first Perl project! If someone is willing to
take a look to see if I've done something terribly wrong packaging the
code I would greatly appreciate any feedback.

Currently the new module is in a subversion repository. If you have
subversion you should be able to check it out and test it with

svn co http://dev.michaux.ca/svn/random/JavaScript-Minifier
cd JavaScript-Minifier
perl MakeFile.PL
make test


Some comments on packaging:
* it may be a good idea to add a LICENSE parameter to Makefile.PL
(supported by ExtUtils::MakeMaker = 6.31)
* you might like to add POD and POD coverage tests (for CPANTS' sake)

Some comments on code:
* it does not look like Perl code, but C code translated literally to Perl.

If you review the code using a Perlish approach, you may be surprised
about how short the result may be. For example,

sub isInfix {
 my $x = shift;
 return ($x eq ',' || $x eq '=' || $x eq ';' ||
 $x eq '?' || $x eq ':' || $x eq '' ||
 $x eq '%' || $x eq '*' || $x eq '|' ||
 $x eq '' || $x eq '' || $x eq \n);
}

may be replaced by code using regular expressions

sub isInfix {
  my $x = shift;
  $x =~ /^[,=;?:%*|\n]$/
}

But this in turn may be further improved by not working in a
character-by-character base as the current code does. For instance,
you may drop the anchors in the regexp above and even the subroutine
itself and replace it with the regexp itself (avoiding sub calls):

my $is_infix_re = qr/[,=;?:%*|\n]/;

# and where you would say isInfix($x), the call would be replaced by
# $x =~ / $is_infix_re /xms or something like that

Best,
Adriano.


Thank you,
Peter
--
http://peter.michaux.ca
http://forkjavascript.org



Re: Modules are missing on CPAN

2007-05-24 Thread Graham Barr

On May 23, 2007, at 4:28 PM, Andy Lester wrote:
At first I thought I might have deleted two revisions of  
WWW::Mechanize by mistake, but it's not just Mech:  SOAP::Lite is  
missing revisions.


http://search.cpan.org/dist/SOAP-Lite/ only shows SOAP::Lite up to  
0.60a, but I know for a fact that there's been a 0.67.


There is a 0.69 at http://search.cpan.org/~byrne/SOAP-Lite-0.69/

But it contains a module SOAP::Packager that cpanid BYRNE does not  
have permission to upload. Permission is given to KBROWN due to first- 
come


But you will not see this dist under /dist/SOAP-Lite/ because it  
contains unauthorized modules.


http://search.cpan.org/dist/WWW-Mechanize/ shows 1.29_01 that I  
uploaded earlier in the week, but 1.26 has disappeared.


I do not see WWW-Mechanize-1.26.tar.gz  in

http://www.cpan.org/authors/id/P/PE/PETDANCE/

but it is on backpan at

http://backpan.perl.org/authors/id/P/PE/PETDANCE/

Did you delete it via PAUSE ?


Different mirrors have different sets of modules.  For example:

* http://mirrors.ibiblio.org/pub/mirrors/CPAN/authors/id/P/PE/ 
PETDANCE/

  shows 1.24 and 1.29_01
* http://mirror.datapipe.net/CPAN/authors/id/P/PE/PETDANCE/

Please tell me someone's aware of this besides me.


Not all mirrors update at the same interval from the CPAN master. So  
some will appear to be older than others.


search.cpan.org monitors mirrors for freshness and any download  
link is redirected to a mirror which should be new enough to have the  
required file.


Graham.



Re: Modules are missing on CPAN

2007-05-24 Thread Andy Armstrong

On 24 May 2007, at 14:29, Graham Barr wrote:

I do not see WWW-Mechanize-1.26.tar.gz  in

http://www.cpan.org/authors/id/P/PE/PETDANCE/

but it is on backpan at

http://backpan.perl.org/authors/id/P/PE/PETDANCE/

Did you delete it via PAUSE ?


Another data point:

Missing: http://cpan.hexten.net/authors/id/P/PE/PETDANCE/

Present: http://backpan.hexten.net/authors/id/P/PE/PETDANCE/

--
Andy Armstrong, hexten.net



Re: Modules are NOT missing on CPAN, Andy screwed up

2007-05-24 Thread Andy Lester

Ok, yes, I screwed up twice.  All is fine.
--
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance






Re: (Create a new ?) namespace for applications on CPAN

2007-05-24 Thread David Nicol

On 5/23/07, Andy Lester [EMAIL PROTECTED] wrote:

I meant about his irrelevant parallels to program being what you
get at the opera, and script the lines of a play.


So if you find non-geek usage irrelevant, what is the scope of the
target demographic whose usage you seek to correct then?

--
It is not possible to make a mistake. (customary greeting given by
Bokononists when meeting a shy person)


Re: peer review for first CPAN module? (JavaScript minification)

2007-05-24 Thread James E Keenan

Peter Michaux wrote:

Hi,

I'm writing a new version of JavaScript::Minification on CPAN. This is
my first CPAN module and first Perl project! If someone is willing to
take a look to see if I've done something terribly wrong packaging the
code I would greatly appreciate any feedback.

Currently the new module is in a subversion repository. If you have
subversion you should be able to check it out and test it with

svn co http://dev.michaux.ca/svn/random/JavaScript-Minifier
cd JavaScript-Minifier
perl MakeFile.PL
make test


1.  Makefile.PL:  Do you really need to use Perl version 5.008006 to use 
this module?  Why won't just 5.8, or 5.6 do?


2.  README:  Replace boilerplate content.

3.  POD:  section on EXPORT should indicate which subs/variables are 
exportable on demand.


4.  See attached for test coverage.  Quite good for a first effort, and 
better than most CPAN distros.  However, the excessive, C-ish use of || 
conditions mentioned by Adriano lowers your condition coverage and means 
your code is actually less well tested than it may first appear.


5.  This is perfectly acceptable for a 0.01.  Go ahead and upload it to 
CPAN so that others have easier access to it and can send you patches.


Thank you very much.
Jim Keenan
Reading database from /Users/jimk/work/jsm/cover_db


 -- -- -- -- -- -- --
File   stmt   bran   condsubpod   time  total
 -- -- -- -- -- -- --
...ib/JavaScript/Minifier.pm   97.3   88.8   79.0  100.00.0  100.0   83.9
Total  97.3   88.8   79.0  100.00.0  100.0   83.9
 -- -- -- -- -- -- --


Run:  t/JavaScript-Minifier.t
Perl version: 5.8.8
OS:   darwin
Start:Thu May 24 23:02:16 2007
Finish:   Thu May 24 23:02:16 2007

blib/lib/JavaScript/Minifier.pm

line  err   stmt   bran   condsubpod   time   code
1 package 
JavaScript::Minifier;
2 
3  1119   use strict;
   1  4   
   1 24   
4  1122   use warnings;
   1  3   
   1 20   
5 
6 require Exporter;
7 our @ISA = qw(Exporter);
8 our @EXPORT_OK = 
qw(minify);
9 
10our $VERSION = '1.0';
11
12# 
-
13
14sub isAlphanum {
15***327  327  0974 my $x = shift;
16  #return true if the 
character is allowed in identifier.
17   327   10017422 return (($x ge 'a'  
$x le 'z') || ($x ge '0'  $x le '9') ||
   100
   100
   100
   100
  ***   66
  ***   66
  ***   66
  ***   66
18  ($x ge 'A'  
$x le 'Z') || $x eq '_' || $x eq '$' ||
19  $x eq '\\' || 
ord($x)  126);
20}
21
22sub isSpace {
23***   2067 2067  0  13590 my $x = shift;
24***   20676631917 return ($x eq ' ' || $x 
eq \t);
25}
26
27sub isEndspace {
28***   2069 2069  0   5538 my $x = shift;
29***   20696651764 return ($x eq \n || 
$x eq \r || $x eq \f);
  ***   66
30