Re: checking groups on unix

2001-06-27 Thread Matt Cauthorn
Check out the stat function -- it returns a long list of info., which will be of use to you: perl -e ' @list=stat("."); foreach(@list){printf "%o \n",$_;} ' The " printf %o " part prints the value in octal, which is what you're after. The 3rd value in the returned array $list[2] is the mode. on

Re: Net::Telnet

2001-06-23 Thread Matt Cauthorn
Here's some code that works well for us to bounce some apache instances across a cluster(obviously truncated). Notice how you stuff STDOUT from your remote call into an array that you print for output locally. This module rocks, and is (for us) blistering fast and super flexible. Also, I used Te

A Term::ReadKey question -- keep cursor put!

2001-06-13 Thread Matt Cauthorn
I'm trying something like: for ($i=0; $i<10; $i++){print $i;} and have the numbers iterate in ONE PLACE at the cursor (i.e. print, then backspace, print the new number, etc). I'm having problems figuring this out. Any ideas? Thanks Matt __ Do Y

Re: CGI parser and stuff

2001-06-10 Thread Matt Cauthorn
I always point new Linux folks to: http://linuxnewbie.org. There you'll find board after board of useful stuff, dealing with almost anything you can think of. Click on the "discussion" link near the top of the page and you're off. As for editors on Linux, I use vim, which does sytax highlighting

Re: extracting substr

2001-06-10 Thread Matt Cauthorn
This works for me... #!/usr/bin/perl -w while (<>){ print if $_=~/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/; } Regards, Matt --- William <[EMAIL PROTECTED]> wrote: > hi, > > i want to be able to read a text file and extract only the valid > ip addresses. however, along with valid ip addres

Re: Cannot detect environment variables

2001-06-10 Thread Matt Cauthorn
George -- Make sure to use 'export' on your env. variables when setting them in a shell. So this should work: export MYVARIABLE=astring on my Red Hat box this did the trick: [mcauthorn@bubba mcauthorn]$ export MYVAR=testing [mcauthorn@bubba mcauthorn]$ perl -e 'print "$ENV{MYVAR}\n"'

Re: Regrex question

2001-05-23 Thread Matt Cauthorn
$test=~ s/(dav)/$1 Smith/ig; print "$test "; gives the following result: dav Smithe Dav Smithid Dav Smithy ### $test=~ s/(dav)w+/$1 Smith/ig; Gives us: dav Smith Dav Smith Dav Smith The \w+ says "one or more word characters". Sticking that on the end gave us a bit more control over the resul

Re: Similar mail lists for Linux/Unix??

2001-05-23 Thread Matt Cauthorn
Check out Linuxnewbie.org. A great site, in a similar vein as Perl Monks. Tons and tons of help there, and as the name implies it's geared toward promoting Linux and it's use to neophytes and intermediate folk like myself. ~Matt C. --- Tony Cook <[EMAIL PROTECTED]> wrote: > On Wed, 23 May 2001

Re: APACHE with MOD_PERL

2001-05-23 Thread Matt Cauthorn
I strongly recommend that you let mod_perl do the apache build for you. Just make sure it can find the src directory under apache. Here's a script that I use. Hasn't failed me yet, although YMMV as I'm doing this on Solaris and Linux, not HP-UX. Don't see why it would be significantly different,

Re: Yet another @INC question...Disregard

2001-05-19 Thread Matt Cauthorn
Please Disregard my earlier post...it's TermReadKey, not Term::Readkey. Oops. Works as you would expect now. Sorry! Matt C. --- Matt Cauthorn <[EMAIL PROTECTED]> wrote: > This one has me puzzled. I installed Term::Readkey. Totally standard, all tests > passed. Here's wha

Yet another @INC question...

2001-05-19 Thread Matt Cauthorn
This one has me puzzled. I installed Term::Readkey. Totally standard, all tests passed. Here's what I get when I try and run my script (OS is Solaris 8): Can't locate Term/Readkey.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.0/sun4-solaris /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/si

Re: ftp

2001-05-19 Thread Matt Cauthorn
I've got Net::ftp on my win2k machine, and have used it many many times without issue. I recall just grabbing the Bundle::LWP ppm and it did the rest. I'm certain that this module should install into active state perl without grief. Good luck. http://aspn.activestate.com/ASPN/Products/ActivePerl/

Re: Using SSL and Perl to Gather Process Information

2001-05-17 Thread Matt Cauthorn
You may want to check this out: http://search.cpan.org/doc/BTROTT/Net-SSH-Perl-1.13/lib/Net/SSH/Perl.pm I bet this will get you where you want to go. ~Matt C. --- Ken Hammer <[EMAIL PROTECTED]> wrote: > > I need to write a perl script that will gather system information > from remote machine

Recovered windows files and dos name limitations -- Ideas?

2001-05-12 Thread Matt Cauthorn
A friend of mine just had a drive crash on him. He was able to save some of the files in dos, as his win98 couln't boot. Now all of his mp3s have the dos 8 character limit on them, but winamp in his new win98 can actually read the long version of the name on 80% of them. This tells me there must

Re: beginner here - with basic cgi trouble

2001-05-11 Thread Matt Cauthorn
: > -- Original Message -- > From: Matt Cauthorn <[EMAIL PROTECTED]> > Date: Thu, 10 May 2001 08:43:34 -0700 (PDT) > > >Chip -- try this in your cgi bin. Type perldoc CGI for more info. > > > > #!/usr/bin/perl -w > > use CGI qw/:standard/; > &g

Re: Net::Telnet and context

2001-05-11 Thread Matt Cauthorn
:08 PM 5/11/01 -0700, Matt Cauthorn wrote: > > my @results=$s->cmd(String=>$string,Prompt=>'/root\@.*/') || warn > > $s->errmsg > >,"\n"; > > > > print "@results\n"; > > $s->close(); > >

Net::Telnet and context

2001-05-11 Thread Matt Cauthorn
Here's a snippet of code. It will be used to iterate through a cluster of machines and bounce apache if needed. For now, a test command... foreach my $server (@cluster) { my $s=Net::Telnet->new(Host=>$server,Input_log=>'telnet.txt'); my $string='uname -n'; $s->login(Name

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Matt Cauthorn
Chip -- try this in your cgi bin. Type perldoc CGI for more info. #!/usr/bin/perl -w use CGI qw/:standard/; print header, start_html('hello world'), h1('hello world'), end_html; -- Cgi.pm makes everything easy. In your code below, you fogot to put the first tag... ---

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Matt Cauthorn
Type "which perl" at the command line to see the path to your perl interpreter. --- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Thu, 10 May 2001, lemoninsz wrote: > > > hi,i have the same problem,when i do ./emailupload.cgi,error like this: > > "bash: ./emailupload.cgi: No such file or dir

Re: Environment variable question

2001-05-08 Thread Matt Cauthorn
If you're using Unix (I think even a dos shell can do this sort of thing too), why couldn't you just do a system call to the shell? i.e. system(" export MY_Variable=whatever "); I haven't tried this, but it sure seems like it would work -- provided you're running and exiting the script as the sa

Re: Regexp: Grouping and replacing with an unknown number of groups

2001-05-08 Thread Matt Cauthorn
Not sure if this will help you at this point, but I strongly recommend the Date::Manip module for anything involving parsing dates. It does everything you can imagine with dates and more. Tell it to parse your dates, and boom you can print them however you want, get differences, etc. There are ple

Re: calling a Java class and also its memeber functions from Perl.

2001-05-04 Thread Matt Cauthorn
I'm quickly getting out of my league here, but it sounds like you may want to consider using SOAP::Lite for a remote call like that. I've never used this module, but have perused the docs and it looks very very cool and easy to use. --- Srinivas Samavedam <[EMAIL PROTECTED]> wrote: > Hi, > > M

Re: How to recursively tar ?

2001-05-04 Thread Matt Cauthorn
Why isn't the standard tar utility working for you? Try and avoid making things more complicated than they need to be. Once I spend 45 minutes making a perl script only to realize that I could get the same results with a one-liner and pipes on the command line! ~Matt --- [EMAIL PROTECTED] wrote

Re: CGI Problem

2001-05-02 Thread Matt Cauthorn
It's almost certainly (to my mind) your http header. Make sure and use the CGI.pm module, as it makes this type of thing extremely easy to write. --- "J. Patrick Lanigan" <[EMAIL PROTECTED]> wrote: > I am getting an "Internal Server Error" returned to my browser. The error > log shows the follow

Re: FTP package

2001-05-02 Thread Matt Cauthorn
I may be wrong, but it looks like machine 2 doesn't have the Net::FTP module installed. Try this to see if it is: perldoc Net::Ftp If it's installed, you'll see some text pop up straight away. As for machine one, I'm not too sure. I'm sure someone on the list can help! ~Matt C. --- [EMAIL P

Re: DBI tutorial

2001-04-30 Thread Matt Cauthorn
If you plan to use mysql, pick up " MySQL " from New Riders press. Paul DuBois writes a nice tutorial on the DBI / DBD that will have you doing plenty very quickly. Matt C. __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great price

RE: Net::DNS::MX data

2001-04-24 Thread Matt Cauthorn
Don't mean to beat this horse, but I ran across an MX script that really worked out for us at work. Here it is. Hope it helps someone out there. Comments welcome, as I've got a long way to go!! I think most of it comes from the docs, though: #!/usr/bin/perl -w # This one compares mx data from 2

Re: mod_perl

2001-04-24 Thread Matt Cauthorn
Check out http://www.activestate.com/ for information on a mod_perl windows environment. Be warned that Apache is still considered somewhat experimental with Windows! ~Matt __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great pric

Re: Archiving

2001-04-22 Thread Matt Cauthorn
I looked up what I had read about the Net::Telnet module and ssh. Truth be told, it seemed a bit tricky to make it work. The Net::SSH::Perl seems to have some pretty slick features, for sure. Thanks for pointing that out. Went to CPAN straight away, and I'll surely use it as opposed to the Net::Te

Re: Archiving

2001-04-22 Thread Matt Cauthorn
Dennis -- Sorry, I put the wrong module in my post (I had just written a script using Net::FTP, hence the mix up)! Although Net::FTP is a great one, I was thinking of Net::Telnet, which you can use to easily telnet into your server, even if it requires SSH (although I've only *read* about the SSH

Re: help me understand $_

2001-04-22 Thread Matt Cauthorn
Sean O'Leary -- Damn that was a good explaination! I felt like I understood $_ very well before, but I understand it even better now. A very perlish post indeed. Larry the linguist would be proud! Matt __ Do You Yahoo!? Yahoo! Auctions - buy the th

Re: Perl documentation (Net::DNS::RR::MX)

2001-04-22 Thread Matt Cauthorn
Matt - This worked for me from my linux box at work, but not on my home network using win2k...I guess you just need to hit the right server. BTW, I just yanked this from the documentation. #!/usr/bin/perl -w use Net::DNS; $name = 'perl.org'; $res = new Net::DNS::Resolver; @mx = mx($res, $name); i

Re: Archiving

2001-04-22 Thread Matt Cauthorn
Hmmm. Still not 100% clear on exactly what you want to accomplish, but it sounds like a simple shell or Perl script setup as a cron may do the trick. In Perl, maybe something like: my $count=`ls | wc -l`; # this captures the amount of lines in your posting directory. Then setup an if statement:

Re: How do I know which modules are installed?

2001-04-21 Thread Matt Cauthorn
Sorry -- David H. Adler pointed out that I should've left off the .pm from the command ' perldoc CGI.pm ' . He is 100% correct. I should've given you a screenshot, which would've caught my mistake. Anyhow, here's one now: C:\Documents and Settings\mcauthor\Desktop>perldoc CGI NAME CGI - Si

Re: How do I know which modules are installed?

2001-04-20 Thread Matt Cauthorn
If you're looking for a specific module, you can do this: perldoc CGI.pm to see if the docs are installed (they are, as CGI.pm is part of the standard distro.) Or, you can do this from the command line: perl -MCGI.pm ...if the prompt then just sits there waiting for you without messages, it's

Re: parsing multiple files

2001-04-20 Thread Matt Cauthorn
Hey Jen: This may not be the cleanest way, but you can setup a regex for each string type you're interested in and push the results into an array... If you're running Unix, it may REALLY help you to go ahead and strip out all of the unwanted crap via a command-line grep, then pipe the results int

Re: Perl Man Pages

2001-04-20 Thread Matt Cauthorn
Yes -- type " perldoc perl " a the dos or shell prompt and roll from there. perldoc -f [function] will give you specific info. about a function you're interested in...here's a copy from one of my machines (this one uses win2k, the others are Solaris and Linux). C:\Documents and Settings\mcauthor

Re: Where do I set global environment variables --Linux

2001-04-20 Thread Matt Cauthorn
Set your environment variables in your .profile file in your home directory, or edit /etc/profile. Remember that a script will run under the current env. of the shell calling it...something I've run into with crontab files not getting the expected env. variables. I also am not 100% sure about th

Re: CGI problem, no luck so far

2001-04-20 Thread Matt Cauthorn
Pam -- this is a bit of a shot in the dark, but ensure that perl is not messing up your http header in it's buffer by using: $|=1; # This sets autoflush to flush the buffer after every print, printf and write (from the Camel). Hope it helps. We're using your Solaris and Perl versions at work wit

Re: Perl CGI (Getting started.)

2001-04-20 Thread Matt Cauthorn
You've got a couple of options: 1) If you're using Cgi.pm (you should!!), you can run it in "offline mode" and capture the html it produces. Then just point your IE or Netscape to that html and it will display. 2) Unless your script was doing something unusual, it should not have interfered with

Re: Comparing arrays

2001-04-20 Thread Matt Cauthorn
Here's a nice way to do what Stuart Watts recommended (chomping the array): open (FILE, "whatever"); chomp (my @array=); And boom the newlines are killed in one fell swoop. I've used this with fantastic results. Stuart's way works well too, but I figured I'd throw this in...very 'perlish'. ~Mat

Re: Running a script

2001-04-18 Thread Matt Cauthorn
make sure that the directory you have the script in is in your path. try this: echo $PATH and you should see all the directories your shell looks for executables in. The easist way to solve your problem is to move your script to something like /usr/local or one of the obvious directories listed

Re: referencing and subroutines

2001-04-17 Thread Matt Cauthorn
To get a value out of a subroutine you need to use the return function. So if your sub creates the hash and you want to do something with it in the script outside, do something like; %newhash=subroutine(values); I believe you may also simply reference the hash within the subroutine, but you shou

Re: regular expression match?

2001-04-16 Thread Matt Cauthorn
It REALLY helps me to verbally walk through a regex. Your original one (m/$\w+\_/) says something like: "match the end of the line ($) followed by one or more word characters followed by ??? Not sure, because the "_" doesn't need to be escaped. If you want to match *any* string with the last cha