Sponsored Content
Full Discussion: Code Consolidation
Top Forums UNIX for Dummies Questions & Answers Code Consolidation Post 302137127 by porter on Saturday 22nd of September 2007 09:52:25 AM
Old 09-22-2007
Quote:
Originally Posted by misterpinkey
Is there a way to use a loop or something to consolidate this to make it smaller?
You could make each option a function, then have the case statement call each function for each option.

Or have each functions name be a prefix followed by a number, then read the number, append to the function prefix then call that.
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Apache Subnet consolidation script/routine help needed

I have a rather simple routine that I would like to fine tune. I am having scripters block if that exists. Trying to tally up that amount of subnets after I performed an awk and uniq from zipped apache logs. For instance, on a solaris 10 system: This does work gunzip -c access_log1.200834.gz |... (2 Replies)
Discussion started by: NYG71
2 Replies

2. UNIX for Dummies Questions & Answers

RRDtool consolidation not going as expected

Hello all, I am new to RRDtool and have made a RRDtool database with one data-source. Information of this data-source is stored in four different RRA's with different intervals for different time spans. Database create command: rrdtool create /root/mde.rrd --step 300 \... (2 Replies)
Discussion started by: ArtOfLosing
2 Replies
Agent::Driver::Default(3pm)				User Contributed Perl Documentation			       Agent::Driver::Default(3pm)

NAME
Log::Agent::Driver::Default - default logging driver for Log::Agent SYNOPSIS
# Implicit use use Log::Agent; logconfig(-prefix => "prefix"); # optional # Explicit use use Log::Agent; require Log::Agent::Driver::Default; my $driver = Log::Agent::Driver::Default->make("prefix"); logconfig(-driver => $driver); DESCRIPTION
The default logging driver remaps the logxxx() operations to their default Perl counterpart. For instance, logerr() will issue a warn() and logwarn() will call warn() with a clear "WARNING: " emphasis (to distinguish between the two calls). The only routine of interest here is the creation routine: make($prefix) Create a Log::Agent::Driver::Default driver whose prefix string will be $prefix. When no prefix is configured, the first letter of each logged string will be uppercased. CHANNELS
The "error", "output" and "debug" channels all go to STDERR. BUGS
If logdie() is used within an eval(), the string you will get in $@ will be prefixed. It's not really a bug, simply that wrapping a code into eval() and parsing $@ is poor's man exception handling which shows its limit here: since the programmer using logdie() cannot foresee which driver will be used, the returned string cannot be determined precisely. Morality: use die() if you mean it, and document the string as an exception. AUTHOR
Raphael Manfredi <Raphael_Manfredi@pobox.com> SEE ALSO
Log::Agent::Driver(3), Log::Agent(3). perl v5.10.0 2009-07-23 Agent::Driver::Default(3pm)
All times are GMT -4. The time now is 11:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy