LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2008, 05:58 PM   #1
stu7
Member
 
Registered: Jun 2007
Posts: 95

Rep: Reputation: 16
howto rename a perl command ?


...there used to be a way to do this... involving glob

I'd like to rename a perl command... for instance,
for the perl command [ print ] use PR instead.

I can do this in a script, but Id like to use it
system wide for perl. Anyone seen this or know a
way to do it ?

thx
 
Old 07-19-2008, 06:29 AM   #2
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
I'm pretty sure you don't want to rename a command as basic as print system wide - not unless you want to rewrite every script on the system that relies on Perl.
 
Old 07-20-2008, 08:53 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Concur with Telmachos
 
Old 07-20-2008, 01:10 PM   #4
stu7
Member
 
Registered: Jun 2007
Posts: 95

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by stu7 View Post
Earlier, I asked: "There used to be a way to do this - involving glob.
I'd like to rename a perl command... for instance,
for the perl command [ print ] use PR instead".
However, the reply here has convinced me this might cause more
problems than it would fix... so... perhaps a better way to
approach this would be TO ADD A NEW COMMAND(name), so,
for instance, my [ PR ] alternative would -also- be available,
instead of just replacing all instances of [ print ] all together.

Any suggestions ?

re-thanks
 
Old 07-20-2008, 08:40 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
As I meant to add before (but forgot), can you please explain, pref with an example, exactly why/what you are trying to do and then we will be able to give you detailed advice.
It sounds like you want a customised version of the print cmd (see also printf http://perldoc.perl.org/functions/printf.html, but see the warning there on the last line).

Think of Perl as like C, but easier. Just write a new sub desc_print() (where desc = short description of why its different/what it does) and then call that when you want a 'custom' print, instead of just 'print'.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Me....Howto rename Physical Name mefaizal Linux - Newbie 5 04-08-2008 01:27 PM
rename - perl regex for autonumbering aroyce Linux - General 2 03-01-2007 03:36 PM
perl rename ryedunn Programming 2 09-14-2006 02:55 PM
Rename perl interpreter cramer Programming 6 08-01-2006 10:38 PM
rename command or PERL perlexpr? malaka56 Linux - Software 1 08-24-2005 12:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration