Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > All Other Coding Languages

Reply
 
LinkBack Thread Tools Display Modes
Old 06-23-2005, 08:52 AM   #1 (permalink)
powah
Registered User
 
Join Date: Jun 2005
Posts: 1
powah is on a distinguished road
change the empty function from the old format to the new format

I have about 300 files which has the function getDBBackend().
How to write a program to change the empty function from the old format to the new format?

Old empty function format are either:
function getDBBackend()
{
// Not available
} // getDBBackend


or:
function getDBBackend()
{

} // getDBBackend


New empty function format is:
function getDBBackend()
{
// DB backend not applicable, use test backend
getTestObject();
} // getDBBackend


If the function is not empty, then it will not be changed:
function getDBBackend() {
$msg = db_start_dget(MIO_DGET_DATA);
//...
}
powah is offline   Reply With Quote
Old 07-10-2005, 01:23 PM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 596
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
I didn't really test this but here's some perl you could clean up.
Code:
perl -pi .bak -e 's/function getDBBackend\(\)\n\{\n+.*\n*}.*\n/function getDBBackend()\n{\n\/\/ DB backend not applicable, use test backend\n}\n/mg'
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
php function to change to lower case trevor PHP 9 02-11-2003 08:27 PM


All times are GMT -8. The time now is 02:11 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting