FW: Time arithmetics...

2002-04-02 Thread Richard Smith


This is a problem for us historians.  I would hope that perl designers, among others, 
are thinking about wide date ranges...
Thanx,
Smiddy
( About that log message from AD 61, ... )
-Original Message-
From:   Michael Kelly [SMTP:[EMAIL PROTECTED]]
Sent:   Tuesday, April 02, 2002 11:42 AM
To: [EMAIL PROTECTED]
Subject:Re: Time arithmetics...

On 4/2/02 1:54 AM, Jonathan E. Paton [EMAIL PROTECTED] wrote:

 for instance between feb 28, 200 and
 jan 30, 2002...
 
 You must be a historian of some sort, nobody
 else is interested in such large 'stages' of
 time ;-)

The question is, what are you doing with log files from the year 200 in the
first place? ;)

-- 
Michael


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




FW: How to thread in Perl?

2002-03-27 Thread Richard Smith


Actually, it is a *NIX thing.  There are non-blocking ways to reap 
children, at least in most modern *NIX systems. You probably also want to 
look at the documentation for the wait() function.  It may explain why your 
experiment appeared to work.  Anybody know how to do non-blocking waits in 
perl?  I couldn't find anything, unless system() is used somehow.
Thanx,
Smiddy

-Original Message-
From:   Chas Owens [SMTP:[EMAIL PROTECTED]]
Sent:   Tuesday, March 26, 2002 5:08 PM
To: Ahmed Moustafa
Cc: [EMAIL PROTECTED]
Subject:Re: How to thread in Perl?

I wrote some experimental code and it looks like you don't have to reap
the children (maybe this is just a C thing).



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: nice, perl, fork and exec

2002-03-19 Thread Richard Smith

In *nix, he child process inherits the nice value of the parent process, 
and, unless the process owner is the super-user, the child process cannot 
be given a higher priority.  This would also apply to calls to system() and 
backticks, since they all basically use the same mechanism.  It also 
applies to exec(), though that is a separate OS operation.  Just out of 
curiosity, how is this handled in windows?
Thanx,
Smiddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How long can $_ be?

2002-03-14 Thread Richard Smith


My Perl doesn't know what strlen is. Is it part of a module?

Oops.  Don't get your perl mixed up with your C, Smiddy.

I meant length($_)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




FW: How long can $_ be?

2002-03-13 Thread Richard Smith

Hi Folks,
This got me wondering.  Is the behavior you see caused by limitations for $_, or by 
limitations of the print function?  You might try:
print strlen( $_ ), \n;
Thanks,
Smiddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: sort order of hash keys

2002-02-26 Thread Richard Smith

Try the fields module.  This sounds like an ideal place to use a pseudo-hash

Thanx,
Smiddy
..


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sockets in an array

2002-02-25 Thread Richard Smith


   $newsocket[$i] = IO::Socket::INET-new($address) or die $@;

How are you declaring newsocket?  I would probably decare it as local rather than 
as my.
Worth a try anyway.  Unfortunately I can't try it here.
Thanks,
Smiddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sockets in an array

2002-02-25 Thread Richard Smith

Hi Jenda,
I have had problems using my when refering to File Handles, especially 
when I wish to pass them to subroutines.  I have also had problems 
declaring them with $ or @, and have been
forced to use:
local   *logHandle;
Is this because I am declaring the actual filehandle, and not a reference 
to it?
Thanx,
Smiddy

 How are you declaring newsocket?  I would probably decare it as
 local rather than as my. Worth a try anyway.  Unfortunately I
 can't try it here. Thanks, Smiddy

Please don't. The rule of thumb should be : ...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Caching Large Data Structures To Disk

2002-02-15 Thread Richard Smith

Hi Jess,
Tied variables might work, but I was also browsing CPAN this afternoon, and 
I noticed that there is  a whole SAS module under Commercial Software.  I 
have no idea what it does, but you might find it interesting to look at.
Thanx,
Smiddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Parsing a .csv file

2002-02-12 Thread Richard Smith

You might try splitting on quotes first., e.g.
my @quotes_array = spilt //, $input;
my @final_array;
# Array members with odd idices will be quoted strings, split others on comma.
for ( my $index = 0; $index  @quotes; $index++ )
{
if ( $index % 2 )
{
push @final_array, ( split /,/, $quotes_array[ $index ] );
}
else
{
push @final_array, $quotes_array[ $index ]
}
}

Some one else may be able to think of a less Cish way...
Smiddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




flock() failure - possible Perl compile problem?

2002-02-08 Thread Richard Smith

Hi Folks,
I posted this awhile back, but then had problems with my mailer and saw no 
responses.
I have also attempted to clarify the froblem.

When I run the following program under Linux ( Red Hat 7.1, Perl 5.6.0 ) it 
works fine.
If I run the program under Solaris, it fails with Bad File Number ( 
EBADF).  I have two
Solaris machines, a Sun 450 running Solaris 2.6 on which I have compiled 
Perl 5.6.1 using
gcc 2.8.1, and a Compaq running Solaris 8i with the installed Perl 
5.005003.  In config.h
on both Solaris boxes HAVE_FLOCK is not defined, but HAVE_FCNTL is defined. 
 I thought that Solaris perl emulated flock() using fcntl(), but the 
emulation appears not to work.

Do I need to define any special flags when I compile perl in order to get 
the emulation?

Unfortunately I am not in a position to upgrade my gcc or my OS at the 
present time.

Thanks,
Smiddy

P.S. As you can probably tell from the commented out line, I have also 
tried:

flock( fileno( dataHandle ), LOCK_EX );

#!/usr/bin/perl -w

use strict;
use Fcntl qw( :DEFAULT :flock );

# Put your data file name here.
my $datafile = './test_file';

open( dataHandle,  $datafile ) or
die( Cannot open data file $datafile: $! );

# my $file_num = fileno( dataHandle );

flock( dataHandle, LOCK_EX ) or
die( Cannot lock data file $datafile: $! );

print Ready to use file $datafile.\n;

close( dataHandle );
exit( 0 );



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]