Re: New cross-language web development framework called Jasper



"biggus" <sourceforge@xxxxxxxxxxxxx> wrote in
news:1145542611.298497.290640@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

I've just finished a new cross-language web developement framework
called Jasper. It supports several (four, in fact) platforms and
languages, Perl amongst them.

I am posting this new thread since I want others to have a go with
Jasper, and hopefully provide some helpful comments.

package StringUtils;

sub chomp {
my $str = shift;
$str =~ s/[\n\r]+$//;
return ( $str );
}

Read perldoc -f chomp to see what chomp actually does.

sub toLower {
my $str = shift;
$str =~ tr /A-Z/a-z/;
return ( $str );
}

sub toUpper {
my $str = shift;
$str =~ tr /a-z/A-Z/;
return ( $str );
}

Perl builtins lc and uc should be used in preference.

sub equals {
my $first = shift;
my $second = shift;

return ( $first eq $second );
}

You should directly use the eq operator in your code as opposed to
relagating the comparison to a silly subroutine.

sub len {
my $str = shift;
return ( length( $str ) );
}

Again, directly call the Perl builtin.

sub split {
my $str = shift;
my $divider = shift;
return split( /$divider/, $str );
}

Ditto.

In summary, most of the code you have written is completely unnecessary.
Most of the code which is not necessary is either wrong, or bug-prone.

I use frameworks and modules written by others to make it easier to
solve *new* problems, not to experience the same problems over and over
again.

Sinan


--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
.



Relevant Pages

  • Re: Shifting Away
    ... are there two armed camps of Perl monks throwing gazillion megawatt ... daily at shift change and shout "When should I use an en dash?" ... become a bit less paranoid now but it's hard to let go of formal params. ... in the argument list and the sub could still change that. ...
    (comp.lang.perl.misc)
  • Re: New to Perl, OOP inheritance
    ... I'm new to Perl (from C, JavaScript, Ruby) and going through the Camel ... my $invocant = shift; ... sub toString { ...
    (comp.lang.perl.misc)
  • Re: reflection in perl
    ... > i'm new to perl and i want to know if perl has reflection like java? ... > how can i acces reflection and how powerfull is the reflection in perl? ... my $class = shift(); ... sub print { ...
    (perl.beginners)
  • Re: Passing "class" objects to a function
    ... Inside a sub, shift without a parameter will shift @_. ... A beginner in Perl "should" be explicit when they program...it may be redundant, but with the current pricing of disks, those few extra bytes won't hurt and it helps them remember what the defaults are. ... Maybe there should be a separation between "what Perl programming practices you would suggest to a beginner" and "what you do yourself"... ...
    (perl.beginners)
  • Re: New cross-language web development framework called Jasper
    ... languages, Perl amongst them. ... Jasper, and hopefully provide some helpful comments. ... my $arr = shift; ... sub keyExistsAndNonEmpty ...
    (comp.lang.perl.misc)

Loading