Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have some queries...can anyone help me ??? 1

Status
Not open for further replies.

archit

Programmer
Aug 22, 2002
19
US
1. How do you enforce Perl code re-use?
2. How do you ensure your Perl code will require minimum maintenance in the future?
3. What measures do you use to make sure that your Perl code is efficient? Please provide details.
4. Do you enforce OO Perl concepts? When? How? And to what extent?
5. What kind of error handling disciplines do you enforce?
6> Explain Perl 5 performance tuning
7> What measures do you use to make sure your Perl code scales
 
Mostly it's simple to reuse subs if you use them a lot. Just add a line as 1; and require.if something needs changing you don't need to change every program you made.
So you can store your error messages in such a sub too.
if you use cgi input from a user you must never trust it.
To verify it don't use $email =~ /[^\*`´'%\/]/ but
$valu =~ /^(\w+(-|_|\.))*\w+@\w+\.?\w*\.?\w+\.[a-zA-Z]{2,4}$/
 
vikul,

Subroutines keep their internal variables private and pass information in and out with parameters and values and oop helps perl scriptss hide complexities of programs' low level details and helps keep you from touching the messy stuff.

For example on use of LWP::Simple where you can use the module's head funtion to do a http head request on a url. The messy stuff is done for you by the use of object oriented perl. =================
Bad Company Music
=================
 
3) always use strict subroutines and warnings to catch any inefficient coding:

#!c:\perl -w
use strict;

5) anytime you run a command that would effect the functionality of your script, causing complete failure, use the die command.

opendir(DIR,$someDirectory) || die $!; # die and display error.

These are some basics. Just my 2 cents!
 
vikul,

did you just copy and paste your homework questions? Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
that was really gorgor, can u give me some insight into the
4 th question abt oops . Mike , that is no home work my company wanted some information abt perl thing , and me not being into it , thought of asking u guys abt it ....


rgds
Vikul
 
Ok, fair enough :)

Perl doesn't enforce much.

Code Re-Use

You can make code reuse in Perl very easy, but you can't make it mandatory; not without going through each line of code your programmers write that is.

You can make it worth their while to use the predefined routines though. Make the predefined routines useful, get your programmers (all of them, not just the senior ones) to take responsibility for defining and writing the modules that everyone uses, make sure the timescales for each persons work reflect the fact that they will be re-using the code and not re-writing it.

If you can't tell whether someone's using the predefined modules or not by looking at how long they take to do the job - then some things are going wrong.
[ul]
[li]your modules may be too trivial to be of value - in other words, the work in them can be duplicated without losing any time[/li]
[li]you may be specifying too much work at a time - if you can't tell how long an individual will take to complete something then this is almost certainly the case[/li]
[li]your modules may be just fine but no-one is using them because they don't know what anything does, because they're not documented[/li]
[/ul]

The questions you've been asked to answer are not trivial. You could write a book (or two) answering most of them. Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top