BioX-FedDB

 view release on metacpan or  search on metacpan

lib/BioX/FedDB/Base.pm  view on Meta::CPAN

        }

        sub _sum {
                my ( $self, @values ) = @_;
		my $total             = 0;
		foreach my $value ( @values ) {
			$total += $value;
		}
		return $total;
        }

	sub _sql_escape { 
		my ( $self, $string ) = @_;
		if ($string) { $string =~ s/(['"\\])/\\$1/g; }
		return $string; 
	}
	
	sub _html_to_sql {
		my ( $self, $string ) = @_;
		$string = $self->_html_unescape( $string );
		$string = $self->_sql_escape( $string );
		return $string;
	}
	
	sub _html_escape {
		my ( $self, $string ) = @_;
		$string =~ s/'/'/g;
		$string =~ s/"/"/g;
		return $string;
	}
		
	sub _html_encode {
		my ( $self, $string ) = @_;
		$string =~ s/ /%20/g;
		$string =~ s/'/%27/g;
		$string =~ s/\{/%7B/g;
		$string =~ s/\}/%7D/g;
		return $string;
	}
		
	sub _html_unescape {
		my ( $self, $string ) = @_;
		$string =~ s/'/'/g;
		$string =~ s/"/"/g;
		$string =~ s/%20/ /g;
		return $string;
	}
	
	sub _phone_format {
		my ( $self, $string ) = @_;
		$string =~ s/(\d{3})(\d{3})(\d{4})/($1) $2-$3/;
		return $string;
	}
	
	sub _phone_unformat {
		my ( $self, $string ) = @_;
		$string =~ s/[^\d]//g;
		return $string;
	}
	
	sub _commify { # Perl Cookbook 2.17
		my ( $self, $string ) = @_;
		my $text = reverse $string;
		$text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
		return scalar reverse $text;
	}
	


}

1; # Magic true value required at end of module
__END__

=head1 NAME

BioX::FedDB::Base - Select/Resort a Federated BLAST Database with Catalyst and MySQL.


=head1 VERSION

This document describes BioX::FedDB::Base version 0.0.1


=head1 SYNOPSIS

    use BioX::FedDB::Base;

  
=head1 DESCRIPTION


=head1 INTERFACE 



=head1 CONFIGURATION AND ENVIRONMENT

BioX::FedDB::Base requires no configuration files or environment variables.


=head1 DEPENDENCIES


=head1 INCOMPATIBILITIES

None reported.


=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to
C<bug-BioX-feddb-base@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.


=head1 AUTHOR

Roger A Hall  C<< <rogerhall@cpan.org> >>



( run in 0.675 second using v1.01-cache-2.11-cpan-39bf76dae61 )