Re: Password entry field.

2002-08-27 Thread Craig Moynes/Markham/IBM
perldoc -q password How do I ask the user for a password? (This question has nothing to do with the web. See a different FAQ for that.) There's an example of this in L). First, you put the terminal into "no echo" mode, then just read the password normally. You may do this with an old-style i

Re: anonymous reference problems

2002-07-12 Thread Craig Moynes/Markham/IBM
;Jeff 'japhy' Pinyan" To: Craig Moynes/Markham/IBM@IBMCA <[EMA

anonymous reference problems

2002-07-12 Thread Craig Moynes/Markham/IBM
I have a loop, each iteration through the loop the hash %tmpEntry gets a new set of values. And each iteration through the loop I place this hash into another hash, like so: [snip] print "Added entry.\n"; $oncall{$tmpEntry{'StartDate'}} = \%tmpEntry; [snip] tmpEntry is defined outside the loop

Re: Date

2002-07-12 Thread Craig Moynes/Markham/IBM
: Craig Moynes/Markham/IBM@IBMCA Subje

Re: Date

2002-07-12 Thread Craig Moynes/Markham/IBM
You could write a script that reads a file that contains a list of files. Compare the modification file of each file to the current date, if the file is at least two days old try and delete it. Then schedule this script to run everyday, take a look at: man crontab Cheers, -

Re: matching extracharacters

2002-06-24 Thread Craig Moynes/Markham/IBM
@matches = $var =~ m/\w{5}$something\w{5}/g should work I believe - Craig Moynes [EMAIL PROTECTED]

Re: Writing to an existing MS Excel file

2002-06-12 Thread Craig Moynes/Markham/IBM
As far as I know this isn't possible. Admittedly reading in an existing Excel file and then writing it out with changes is not as elegant is it an option ? - Craig Moynes Student-On-Call netCC Development Tel: (905) 316-3486 [EMAIL PROTECTED]

Re: Clearing Idle User login sessions - Re: Killing Idle Users

2002-06-12 Thread Craig Moynes/Markham/IBM
drieux <[EMAIL PROTECTED]To: "Akens, Anthony" <[EMAIL PROTECTED]> om> cc: <[EMAIL PROTECTE

RE: Killing Idle Users

2002-06-11 Thread Craig Moynes/Markham/IBM
<[EMAIL PROTECTED]> To: "Akens, Anthony" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> cc: Craig Moynes/Markham/IBM@IBMCA

RE: Killing Idle Users

2002-06-11 Thread Craig Moynes/Markham/IBM
Something like this perhaps ?: #!/usr/bin/perl -w use strict; my $USER_IDLE = 40; my @input = qx!w -l!; shift @input; shift @input; foreach my $entry ( @input ) { my ($user, $port, undef, $idle) = split('\s+', $entry); if ( $idle =~ /^\d+$/ && $idle > 0 ) {

Re: String with no contents and length of 21

2002-05-14 Thread Craig Moynes/Markham/IBM
Ok it was my fault :) It appears to be the sequence I use to set the title of my xterm, I guess it is grabbing it from my .profile when it tries to execute a command. Thanks :) - Craig Moynes [EMAIL PROTECTED]

String with no contents and length of 21

2002-05-14 Thread Craig Moynes/Markham/IBM
Somehow I got myself into a pickle. I have a string being set by a command that is executing (and the command is failing). I strip out the newline characters. The length is returned as 21, when split into an array the size is 21. Yet when I try: print "!$returned!\n"; I get returned: !! Any id

Re: Installing modules without a C compiler

2002-05-13 Thread Craig Moynes/Markham/IBM
On Mon, 2002-05-13 at 15:01, Craig Moynes/Markham/IBM wrote: > Hi all, > Our servers are set up with a single development box, that contains > all the compilers and what not. All the modules I need to install have to > be compiled on the development box, and then install

Installing modules without a C compiler

2002-05-13 Thread Craig Moynes/Markham/IBM
Hi all, Our servers are set up with a single development box, that contains all the compilers and what not. All the modules I need to install have to be compiled on the development box, and then installed on each server (make install). This works for now, (thanks to nfs) but I would like t

More problems printing dereferencing an array within an struct

2001-08-23 Thread Craig Moynes/Markham/IBM
Wags helped me with the last problem (though we are still unsure of the reason for the behavior). This round I have encountered another similar problem. The code sample works for printing out the scalars, but when I attempt to print out the arrays instead the size of the arrays are printed, cau

Printing an array reference from within a struct

2001-08-22 Thread Craig Moynes/Markham/IBM
Hey Perl'ers, I can't seem to print the array reference within the struct correctly ( I get a blank rather than the expected data). I grabbed this idea Chapter 12, pg 336 of Programming Perl and it looks like I followed their sample but something doesnt seme to be working correctly. Cheers,

Reading from a large file (CISCO master MIB)

2001-08-21 Thread Craig Moynes/Markham/IBM
Hi all, I have been tasked with reading and parsing a large MIB file. I eventually have to create the traps but that's beyond this post. Currently I am looking for a certain line of text, and for the most part what I have written works. Looking for lines similar to this: dot3ChipS

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

2001-08-08 Thread Craig Moynes/Markham/IBM
perldoc -f select $timeToSleep=0.3; select(undef, undef, undef, $timeToSleep); - Craig Moynes Internship Student netCC Development IBM Global Services, Canada Tel: (905) 316-3486 [EMAIL PROTECTED]

Re: how to get date before say 20 days ?

2001-07-24 Thread Craig Moynes/Markham/IBM
>hello, >is there something in perl through which i can get >date previous to some specified days ,say 20 days befores date >i need to know only dd-mm-yy and not time >is there any module function for it >thanks >shweta I have seen several people mention Date::Calc, I believe that is overkill

Array element replacement with array

2001-07-17 Thread Craig Moynes/Markham/IBM
This is a small test program I wrote to test the feasibility of what I want to do. Basically if an element in the array exists as a package group in the hash, the array element be replace with the elements of the package group. A package group is a hash ( I think its actually a scalar reference

Re: A simple question

2001-07-10 Thread Craig Moynes/Markham/IBM
From: Jie Meng <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 10, 2001 5:02 PM Subject: A simple question > > Dear all, > > I plan to write a simple remote connection script, and then "ls" the content > > of the current directory, input like > > telnet hostname > > username > >

Re: Directories

2001-07-10 Thread Craig Moynes/Markham/IBM
> Calling perl gurus, > Hello, help please!!! Looking to delete empty directories, I have a script > for that but if the directories have files in them, it dies. Either can I > add some type of script to delete them also or can I just avoid them all > together and just delete the empty ones. A

Re: STDIN and STDOUT

2001-07-10 Thread Craig Moynes/Markham/IBM
>Hello, >I sent an email yesterday, but never heard anything. Maybe it was the word >'php' in the subject, but let me just simplify and ask another way. >Is there a way to automatically direct all STDERR output to STDOUT. A module I >have installed automatically creates STDERR output, but I want t

Re: Using getopt::std return hash with value of 1 rather than argument

2001-07-05 Thread Craig Moynes/Markham/IBM
>The perldoc for getopt::std states: >Hash keys will be x (where x is the switch name) with key >values the value of the argument or 1 if no argument is >specified This is true for getopt, but not getopts. Getopts puts the parameter in the hash table (I am working on 5.005_03 built for aix ) per

Re: environment-Variable from korn-schell to perl

2001-06-25 Thread Craig Moynes/Markham/IBM
>I have to source a KORN-Shell Script, so that the environment-Variables >created by >KORN-Shell is available in my PERL-Script. Ho do I that The hash %ENV stores the environment variables. if ( $ENV{HOME} =~ /dave/ ) { print "Good morning Dave."; } http://www.perldoc.com/perl5.6/pod

Re: Well...it kinda sorta works

2001-06-22 Thread Craig Moynes/Markham/IBM
I noticed from the sample execution (from the cmd line that you showed) it seemed that maybe the commands should be passed with a carriage return after each parameter. so instead of: > > echo "@" >>/dev/term/a [enter] > echo "2" >>/dev/term/a [enter] > echo "2" >>/dev/term/a [enter] > do somet

Re: I discovered the problem BUT...

2001-06-22 Thread Craig Moynes/Markham/IBM
>A second is quite a bit of time to wait in a program, so you may want to use >Time::HiRes and usleep for a few milliseconds. Another option is to use: select( undef, undef, undef, x ) where x can be fractions of a second: select( undef, undef, undef, 0.26 ) select( undef, undef, undef, 0.76 ) s

Executing commands, getting both STDOUT and STDERR from command

2001-06-19 Thread Craig Moynes/Markham/IBM
Hi, I am running several commands within my perl script (on AIX 4.3.3). These commands include find, chmod, etc. What I am wondering is if anyone has a sample script kicking around where they execute the command and check the return code, grabbing any output (stderr or stdout) and printing it

IO::Socket::INET cannot find despite existence

2001-06-06 Thread Craig Moynes/Markham/IBM
I am trying to write a simple little client server relationship. I receive the error: Uncaught exception from user code: Uncaught exception from user code: Can't locate IO/Socket/INET.pm in @INC (@INC contains: /usr/opt/perl5/li b/5.00503/aix /usr/opt/perl5/lib/5.00503 /usr/opt/pe

Re: append / prepend lines in a file

2001-06-06 Thread Craig Moynes/Markham/IBM
I am not sure exactly what you need help with in this question. The appending can be handled by something like: $line = qq[Open\n"].$line.qq["\narbitary config setting 1\n\narbitrary config setting 2\n\n]; Where $line already contains the line from the file. Check this out for help with the '

Descriptive Subjects - was (Re: help!)

2001-06-05 Thread Craig Moynes/Markham/IBM
Please try and be more descriptive with the subject lines. - Craig Moynes [EMAIL PROTECTED] "chris

Re: Beginners Training books

2001-06-04 Thread Craig Moynes/Markham/IBM
To: Craig Moynes/Markham/IBM@IBMCA , [EMAIL PROTECTED] wustl.edu> Subject: Re: Beginners Traini

Re: Beginners Training books

2001-06-04 Thread Craig Moynes/Markham/IBM
Programming Perl is really quite good. Tons of info about the internals ...Chapter 5 right now for me ...lots to go. Perl in a Nutshell is a good desk side reference once you have a handle on the language. I hear the Cookbook is also really good. "If your bookshelf isn't full of perl, you don'

Re: append a file to another file

2001-06-01 Thread Craig Moynes/Markham/IBM
from a newbie to another newbie something like: [snip] my $newfile = "newfile name" # can get from parameters if you so desire my $line; unless(open( FILE, ">$newfile" ) ) { # do fail stuff } foreach my $file ( @files ) # Setup @files with the list of filenames you want to open { # You m

Re: writing to a text file ... sorry

2001-05-31 Thread Craig Moynes/Markham/IBM
HANG ON :) Brain kicked into gear after I sent the last message. open() returns a positive value if it succeeds ...what you want is | | V unless(open(LOG,">$logfile")) { print "Content-type: text/html\n\n"; print "Couldn't open $logfile. $!\n"; print "At $date, $ENV{'REMOTE_

Re: writing to a text file

2001-05-31 Thread Craig Moynes/Markham/IBM
Uhm what about an ending " at your file name. if(! open(LOG, ">xxx.txt")) { instead of : >if(! open(LOG, ">xxx.txt)) { > print "Content-type: text/html\n\n"; > print "Can't open xxx.txt\n"; > exit; >} - Craig Moynes Internship Student netCC Developm

Re: regexp Help

2001-05-30 Thread Craig Moynes/Markham/IBM
from your small code sample everything checks out. I would be inclined to ensure that the parameter is being read in correctly with no trailing spaces or strange characters. If you need more help send a bigger code sample for us to peruse. - Craig Moynes [

Sleeping for less than a second

2001-05-30 Thread Craig Moynes/Markham/IBM
Hi all, my DNS server is down so I can't check online. Is there anyway to sleep for less than a second using the default installation of perl ? And if not what CPAN module should I use when I get my internet connection back up ? - Craig Moynes Internship

Cleaning up 'uninitialized value'

2001-05-30 Thread Craig Moynes/Markham/IBM
I have a script that when it runs (with no parameters) I have warnings displayed (we have all seen them but) : >Use of uninitialized value at ./log_prune.pl line 14. Here is the beginning of my code that gives the warning: #!/usr/bin/perl -w use strict; use Getopt::Std; use LogUtil; #help(); #

Regexp - missing matches

2001-05-25 Thread Craig Moynes/Markham/IBM
I have the following regexp: @matches = $params{f} =~ /(%[aAbBcCdDehHIjmMnprStTuUVwWyY%])/g; If I have a script: [snip] my @matches; my ( %params ); getopts('DRSa:f:s:d:r:b:w:n:h?', \%params); print "$params{f}\n"; print "@matches\n"; [snip] I am passing -f "some string" in on the command lin

Re: script that runs all the time to monitor log file

2001-05-24 Thread Craig Moynes/Markham/IBM
This is a problem with tail that I have run into as well. If the file size gets reset the stored location of EOF remains the same which is a problem. As the file is written too the size is still below that of what tail is looking at. You can add a stat check to watch filesize and reset the coun

Re: PARSE CLUSTAL

2001-05-24 Thread Craig Moynes/Markham/IBM
First I have some questions. Why is ALIGNMENT not a hash ? It seems perfect for what you are need. If you use ALIGNMENT as a hash, then you can do away with the ID array. Also you are checking for existence in alignment not ALIGNMENT, this will be causing problems. Simplify like this: mine: [

Re: user script to logout users from unix

2001-05-24 Thread Craig Moynes/Markham/IBM
Ok heres my two cents Hi guys, [snip] >sub DEBUG () { 1 }; # set level of debugness. I have never seen this before, why do you use it ? [snip] >open (STDERR, "/tmp/userlog.log") or die $!; [snip] Personally I always include the 'arrow' I am using so in this case: open (STDERR, ">/tmp/userlog.

Quick rounding to nearest integer

2001-05-18 Thread Craig Moynes/Markham/IBM
I looked through my book (perl nutshell) and PP has not arrived yet, so I will ask here. I have an number that needs to be rounded to the nearest whole number. This is my solution: if ( $archives_needed =~ /\.\d+/ ) { ($remainder = $archives_needed) =~

Getting options from the command line

2001-05-17 Thread Craig Moynes/Markham/IBM
I tried using the getopts, and getopt but I can't seem to have mandatory parameters with optional parameters. I have something like this for my usage perl scp_logs.pl -u username -h hostname -l local_directory [-r remote_directory] Any thoughts on ways to manually parse the parameteres from @ARG

Problems with EOF marker

2001-05-16 Thread Craig Moynes/Markham/IBM
I am reading in a logfile, writing the records that are to be pruned from the top to an archived file. I then open a temp file store the modification time of the logfile and write the remainder of the log to the tempfile. Then I check the current modification time of the logfile if it has chang

Instance variables vs parameter passing

2001-05-16 Thread Craig Moynes/Markham/IBM
Some of you may remember hearing about the logfile pruning/archiving tool I was working on (with the date parsing from the record and second calculations etc). I am wondering about the 'perl way' or using variables. I have created a class for a generic 'logfile'. I then have a series of instan

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

2001-05-09 Thread Craig Moynes/Markham/IBM
, but I've used Date::Manip and can say that it is awesome. Check it out. --- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote: > Continuing with the problems for my 'date formatting' script. > > I am reading in a complete record from a logfile. I check to

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

2001-05-08 Thread Craig Moynes/Markham/IBM
Tue, 8 May 2001, Craig Moynes/Markham/IBM wrote: > $values =~ s/.*$self->{DF_REGEXP}.*/$replaceString/g; Perhaps you actually want: @values_arr = $values =~ /.*$self->{DF_REGEXP}.*/ This will give you an array of the atomized matches in your regexp, and you don't need to fool ar

Regexp: Grouping and replacing with an unknown number of groups

2001-05-08 Thread Craig Moynes/Markham/IBM
Continuing with the problems for my 'date formatting' script. I am reading in a complete record from a logfile. I check to see if the regexp matches to something inside the record. Then I want to find the what each grouped mini-regexp matched up with in the monster one at the bottom of the email

Re: Parsing a string....(SOLVED)

2001-05-07 Thread Craig Moynes/Markham/IBM
Thanks, I don't know why I was having so much trouble with that. I was trying to use the $1, $2 etc variables but that didn't seem to work. Have to buy a good perl book in addition to my O'Reilly Nutshell Book. thanks again for the borrowing of your brains --

Parsing a string....

2001-05-07 Thread Craig Moynes/Markham/IBM
Ok I know I know how to do this but I just can't get it out of my brain I have a string like this: $string1 = "[%a %H:%M:%S %c] - - etc.etc.etc"; I need to parse out all the substrings that are similar to "%x" (where x is any letter) I have thought about tackling this using the regexp (%\w) usi

Re: More hash trouble

2001-05-07 Thread Craig Moynes/Markham/IBM
interesting ideas. I will definitely use the self-documenting variable creation method, extra assignments be damned :) Would it also be wise to use the qr// ? Such as: my $shortDayName = qr/(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/; then for example I could do: my $abcXYZ = qr/$shortDayNa

More hash trouble

2001-05-07 Thread Craig Moynes/Markham/IBM
Stumped on this problem my ( %self ); $self->{DF_SPEC} = { a => '(Mon|Tue|Wed|Thu|Fri|Sat|Sun)', A => '(Monday|Tuesday|Wednesday|Thursday|Friday)', b => '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)', B => '(January|February|March|April

Hash help

2001-05-04 Thread Craig Moynes/Markham/IBM
First sorry for asking this, I only keep select emails from this list and couldn't find an answer among them. I declare my hash like this: my ( %FS_XCPTN ); # hash table, key is mount point, # value is FS's special case H_LIMIT and C_LIMIT I use it

Nested Hashes Help

2001-05-04 Thread Craig Moynes/Markham/IBM
Continuing on with my earlier Date formatting program I have run into an 'ugly' issue. I have created a Date formatting hash table like so: ( this is the shortened version) $self->{DF_SPEC} = { a => '(Mon|Tue|Wed|Thu|Fri|Sat|Sun)', A =

Fun with Date formatting

2001-05-03 Thread Craig Moynes/Markham/IBM
My task is to create a Log file pruner for multiple types of logfiles. Now this being reality both record seperators and date formats vary from log to log. I have already nailed the record seperator problem by allowing the user to input a regular expression as a parameter to define when a record

A couple issues with Find and directories

2001-05-02 Thread Craig Moynes/Markham/IBM
Hi, I am passing a directory into my perl program. I want to list all files only within that directory (do not descend to sub-directories). I have tried using the File::Find::find command but to no avail. Here are some code snippets: xi#!/usr/bin/perl -w ##

Re: Strange chop behaviour

2001-05-01 Thread Craig Moynes/Markham/IBM
] "Stephen P. Potter" To: Craig Moynes/Markham/IBM@IBMCA <[EMAIL PROTECTED] cc: [EMAIL PROTEC

Re: traversing dir tree and reading in files

2001-05-01 Thread Craig Moynes/Markham/IBM
Wanted is where you want to change this. Within the function place a regular expression or file-test ...anything that will give you a true/false answer that you can use. To get a list of executable files you would change >sub wanted { > print "$File::Find::name\n"; >} to: sub wanted

Strange chop behaviour

2001-05-01 Thread Craig Moynes/Markham/IBM
A little background. I am running an scp process within a perl script and redirecting the error to a file (scp_err). I then read in the lines of this file and attempt to place them in an error string to log to syslog. Code Sample: #!/usr/bin/perl -w open ( ERR, "; chop $in; pr

Clarification - Re: Include directory as location of perl script

2001-04-27 Thread Craig Moynes/Markham/IBM
I cannot use a fixed library path as the script will be installed in different directories on different systems. the idea is it will be executed as: /home/dbncc/perl/scripts/.pl and the library will also be located in the same directory. - Craig Moyne

Include directory as location of perl script

2001-04-27 Thread Craig Moynes/Markham/IBM
Hi all, I am executing a perl script from a directory other than the one it is located in. I have a package that the script is using located in the same directory as the script, but the script cannot find this package because the package is not in the include directory. I need a way to incl