Re: Can I use PERL to add/remove /etc/passwd entries

2001-12-12 Thread Karthik Krishnamurthy
I have coded a module, which I plan on releasing soon. It has routines to add/remove/update users (/etc/passwd, /etc/shadow, /etc/group, /etc/gshadow), and handles locking issues correctly on a Linux machine. The code will be updated soon to work transparently on Solaris, FreeBSD too. If you wou

Re: Is A File Encrypted?

2001-12-06 Thread Karthik Krishnamurthy
The -T won't work of the data can be uuencoded. /kk On Thu, Dec 06, 2001 at 09:06:19AM -0800, Ray Murphy wrote: > Hello, > > Want to make sure I'm not missing anything here. My > task is to see if a file looks like it's encrypted. > I'm splitting the path/filename/extension via > File::Basenam

Re: Timing Out A Loop

2001-11-29 Thread Karthik Krishnamurthy
On Thu, Nov 29, 2001 at 03:16:04PM -0500, Ken Hammer wrote: > Hi all, > > I have a script that goes out and "grabs" > a specific HTML page. I then search through > the page, gathering the info I want. > Sometimes, the site I'm hitting is either > bogged down or unresponsive. I'd like to > inclu

Re: PERL instead of crontab

2001-11-29 Thread Karthik Krishnamurthy
This would be the rough pseudocode (a very rudimentary one). $SIG{ALRM} = sub { exec (self) }; alarm (2 mins); do stuff; There is a race between the alarm and do stuff. How it would affect your program, you can judge better /kk On Thu, Nov 29, 2001 at 08:25:58AM -0500, Bob Showalter wrote: >

suppressing automatic conversion of a scalar

2001-11-23 Thread Karthik Krishnamurthy
Hello list, I have a scalar variable that can contain either 0, 1, or 'any_str' and I need to take different decision depending on the value. 'some_str' automatically gets converted to 0, when compared to an integer. If I decide to change the allowable values to 1, 2, 'any_str', if any_st

Re: problem in the #/usr/local/bin line

2001-11-17 Thread Karthik Krishnamurthy
the #!/file/to/interpreter line is not specific to perl, but to unix. so look for something else under windows. /kk On Sat, Nov 17, 2001 at 03:57:25AM -0800, Karthik wrote: > My Problem: > > I run a web server(PWS) on a Windows 98 machine. My > perl.exe(perl interpreter) is located in > c:\ro

Re: Off-Topic (200%) - Where are you from?

2001-11-16 Thread Karthik Krishnamurthy
i am from india too /kk On Fri, Nov 16, 2001 at 09:21:11PM +0530, Kilaru Sambaiah wrote: > > Hi, > >I am from Chennai city located in India. > > regards, > Sambaiah Kilaru > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To un

Re: Sendmail alternatives

2001-11-15 Thread Karthik Krishnamurthy
postfix is a drop in replacement for sendmail. as such the sendmail commandline can still be used for delivering mails. Qmail has also been coded with security in mind. However (this is not thro personal experience), postfix seems to be quicker than qmail as far as queueing is concerned. Also po

Re: Validate the regex

2001-09-04 Thread Karthik Krishnamurthy
regex itself. use regular expressions to check for validity /kk On Tue, Sep 04, 2001 at 05:26:05PM -0400, neeraj arora wrote: > Hey > i am writing a piece of code that reads a regex and matches it with a > file name. > Is there anything using which i can validate that the regex i input is > vali

Re: Passing References To Subroutines

2001-08-29 Thread Karthik Krishnamurthy
> sub foo { >my @this_array = ( "one", "two", "three" ); > >bar ( @this_array ); > } > > sub bar { >my @that_array = @_; > } > > So I'd pass a reference instead: > > sub foo { >my @this_array = ( "one", "two", "three" ); > >bar ( \@this_array ); > } > > sub bar { >my

Re: Detecting if a pipe exists

2001-08-21 Thread Karthik Krishnamurthy
wouldn't it be better to check ARGV to see if arguments have been passed. if so use that as input. else read on STDIN. /kk On Tue, Aug 21, 2001 at 12:10:22PM -0800, Michael Fowler wrote: > On Tue, Aug 21, 2001 at 03:44:05PM -0400, Andrew G.McArthur wrote: > > > squareroot 100 1000 25 > > > >

Re: Reading from a large file (CISCO master MIB)

2001-08-21 Thread Karthik Krishnamurthy
the correct way would be to form a small grammer and parse it. there is an article on using Parse::RecDescent for parsing. however this seems really trivial. you can handcode it easily. for example something like sub tokenize { until (defined ($token = shift (@tokens)) {

Re: Best Practices: Error Handling???

2001-08-14 Thread Karthik Krishnamurthy
a while ago i had asked the same question (or one on similar lines). my specific need was error handling for modules to be used by somebody else. in such cases die/eval can become very cumbersome. error handling can be designed after two streams of logic: 1) error to be handled where the error

Re: Telnet ..... send control characters in oct or hex?

2001-08-12 Thread Karthik Krishnamurthy
As an aside ^] needs to be handled by the telnet client itself. /kk On Thu, Aug 09, 2001 at 01:21:49PM -0700, Atul Vohra wrote: > Hi, > > I am using Telnet.pm module where I telnet to a router successfully. Now, I would >like to send some control characters like "ctrl]". Is there a way to send

Re: a little help here please

2001-08-08 Thread Karthik Krishnamurthy
set a SIGALRM handler and an alarm for 5 minutes. set a flag from the handler. do the parsing only if the flag is set. /kk > - Original Message - > From: "Yacketta, Ronald" <[EMAIL PROTECTED]> > To: "Beginners (E-mail)" <[EMAIL PROTECTED]> > Sent: Wednesday, August 08, 2001 5:43 AM > Subj

Re: How can I "sleep" and hundreds milliseconds, shorter than 1 second?

2001-08-08 Thread Karthik Krishnamurthy
check the perl manpage for select. /kk On Wed, Aug 08, 2001 at 11:03:40AM -0700, EriK W wrote: > How can I "sleep" and hundreds million seconds, shorter than 1 second? > > I want to have a short sleep which should be shorter than 1 second, it would > be ideal if it can sleep for a radom short t

Re: very funny...

2001-08-07 Thread Karthik Krishnamurthy
All of the experts you are talking about started out some time as clueless newbies too. They didn't become experts by asking questions, the answers to which they could find themselves. Instead they spent a lot of time sweating it out, trying to find the answers themselves. If a newbie does not

Re: Did I violate?

2001-08-06 Thread Karthik Krishnamurthy
Gnome has nothing specifically to do with Linux. It is a window manager and can be run on top of other OS that run some form of X too. Solaris for instance. most *nix users tend to use very little of GUI inspite of very GUIsh managers available. what you could do is write to the authors, team

Module design

2001-08-04 Thread Karthik Krishnamurthy
hello list, i am creating a general purpose module and am confronted with a small design problem for handling errors. consider this code for locking a file (from marekm's shadow passwd suite for linux) sub __lckfile ($) { my $file = shift; my ($pidfile, $lockfile) = ("

Re: cannot fix an error - "Bus error (core dumped) "

2001-07-31 Thread Karthik Krishnamurthy
you seem to be using a SUN SPARC. A bus error is often induced on these architectures when pointer access is not aligned on word boundary. whether this is caused by the Perl binary itself or the script i don't know /kk On Tue, Jul 31, 2001 at 04:39:54PM +0530, Narendran Kumaraguru Nathan wrot

Re: CPU Priority

2001-07-04 Thread Karthik Krishnamurthy
man nice. perl doesn't seem to have a nice function. so you might have to invoke the nice system call. you could also take a look at setpriority (linux, *BSD, SYSV should support it too). using it you can alter the scheduling priority of a process, children. /kk On Wed, Jul 04, 2001 at 11:15:24AM

Re: background processing (again?)

2001-06-29 Thread Karthik Krishnamurthy
dunno about the select module, but a normal call to select will block. that is why in my other mail i had given you the option of blocking on select in another thread/process /kk On Fri, Jun 29, 2001 at 12:36:20PM -0400, Ronald J. Yacketta wrote: > Maybe I just don't understand.. > but wont there

Re: background processing (again?)

2001-06-29 Thread Karthik Krishnamurthy
this is what i understand from your mail. you need your main code to keep running, while servicing I/O from the netstat FH (or for that matter, any FH). Michael has already suggested pre packaged options, that should be able to help you out. however if you want to roll out your own code ava

Re: background processing (again?)

2001-06-28 Thread Karthik Krishnamurthy
the code that i sent you should be able to do that. /kk On Thu, Jun 28, 2001 at 09:51:19AM -0400, Ronald J. Yacketta wrote: > Folks, > > to make a long story short I have a req to-do the following. > 1) gather continues data from netstat -I hme0 $SLEEPTIME > $netstatTMPFILE & > while still parsin

Re: Running PERL as root

2001-06-28 Thread Karthik Krishnamurthy
Cobalt RaQ runs apache as root so that their front-end can run with root perms. You could use cgiwrap for the same effect, i suppose. there is also webmin, which runs with root priveleges. but webmin has its own httpd server coded in perl (thereby reducing the chances of buffer overflows and such)

Re: Kernel Messages

2001-06-22 Thread Karthik Krishnamurthy
i dont think perl has a syslog function. you could pipe the message to logger though. a better way would be invoke the system call syslog. /kk On Sat, Jun 23, 2001 at 08:07:53AM -0400, Ryan Gralinski wrote: > How do i use perl to log to syslog ? > as a kernel message that comes out in syslog, and

Re: fork .. regex ... etc..

2001-06-20 Thread Karthik Krishnamurthy
On Wed, Jun 20, 2001 at 03:01:00PM -0500, Abdulaziz Ghuloum wrote: > Hello Ron and everybody on this list. > > In order to find the best way to complete the task the fastest way, you need to > first analyse your system and how it's going to react to your algorithm. > Basically your task can be spl

Re: Perl/Linnux/unix question

2001-06-19 Thread Karthik Krishnamurthy
On Tue, Jun 19, 2001 at 08:07:45AM -0700, Dave Young wrote: > (which also "disconnects" it from the current tty. dont know what shell you are talking about. no shell that i have seen bash,ksh or csh works that way. commands are just put in their own process groups. putting a & in front just make

Re: comments and memory

2001-06-19 Thread Karthik Krishnamurthy
from what little i know of parsers, most lexical analyzers (the part that recognizes tokens and such) are designed to ignore comments (just speculation). the whole file is read into the OS buffer cache, comments and all, when the perl interpreter/compiler starts to read the file. but that shou

Re: simultaneous processing

2001-06-18 Thread Karthik Krishnamurthy
On Sun, Jun 17, 2001 at 10:32:16PM -0400, Ronald J. Yacketta wrote: > Folks, > > Can someone shed some light on the ability to kick off simultaneous process > at once within perl. I would like to kick off two system level commands at > the same time, as I mentioned before I am populating 2 arrays

Re: Beginer...Any free resources for Learning Perl

2001-06-15 Thread Karthik Krishnamurthy
On Fri, Jun 15, 2001 at 03:20:51PM +0200, Evgeny Goldin (aka Genie) wrote: > > Nata, Aleks - read http:[EMAIL PROTECTED]/msg04184.html > first. Dave Cross is an author of "Data Munging with Perl" > ~~~ > > To the mat

Re: nested checks

2001-06-15 Thread Karthik Krishnamurthy
On Thu, Jun 14, 2001 at 01:51:29PM -0500, [EMAIL PROTECTED] wrote: > i am running through a series of if/elsif checks on a variable: > > if (($add_alias) && ($add_destination) && (!$selection)) { > >if ( $add_alias =~ /[^\w\.\-]/ ) { > >} elsif ( $add_destination !~ /\@/ ) { > >} e

Re: Kernel Panic because of Perl?

2001-06-13 Thread Karthik Krishnamurthy
would help if you could post the kernel version, any other log messages that you might think would be helpful. the version of apache etc. in my limited knowledge perl scripts on their own cannot cause kernel panic, unless the kernel had a bug which is accidentally being exposed by perl. /kk p.s

Re: Calling touch ...

2001-06-12 Thread Karthik Krishnamurthy
On Wed, 13 Jun 2001, [EMAIL PROTECTED] wrote: > Thanks for pointing me in a better direction. I used this ... > > > > $now = time; > > utime $now, $now, @files; # sets access and modification time > > ... and expanded it to this ... > > $now = time; > > print $now; > > @meters = ("test0612

Re: Pushing more than 1 item onto a list

2001-06-12 Thread Karthik Krishnamurthy
kat@graf-spee:~$ perldoc -f push push ARRAY,LIST Treats ARRAY as a stack, and pushes the values of LIST onto the end of ARRAY. The length of ARRAY increases by the length of LIST. Has the same effect as

Re: Getting Perl to interact with passwd

2001-06-11 Thread Karthik Krishnamurthy
On Tue, 12 Jun 2001, Paul wrote: > --- Daniel Ames <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > This was brought up before, but the archives didn't really answer my > > question. > > > > I'm trying to get my script to reset a password for me via the passwd > > command. Keep in mind, I'm very n

Re: Perl Scope Question

2001-06-10 Thread Karthik Krishnamurthy
with use strict and use warnings putting the hash outside function_one as a lexical or global both seem to work. Even making the hash inside function_one a global seems to generate a warning if use warning is in effect. so putting a function inside another seems to be no different from have it ou