RE: Time being displayed is off my 7 hours

2002-04-21 Thread Timothy Johnson

 
I figured Wags would have checked, but I just had to ask, because sometimes
it's some little thing like that that ends up biting us in the butt.  BTW, I
should have been clearer, but what I was asking was if the machines were set
to the same time zone in the time settings.  It does appear that one system
is giving out the GMT.  Out of curiosity (and a desire to avoid as much pain
in the future as possible), what are you doing that results in the different
times?  Is it a particular function or module?

-Original Message-
From: drieux
To: [EMAIL PROTECTED]
Sent: 4/20/02 9:16 PM
Subject: Re: Time being displayed is off my 7 hours


On Saturday, April 20, 2002, at 07:21 , [EMAIL PROTECTED] 
wrote:

>   Yes. Two feet from each other. Time on machines are
correct(PDT), but 
> something within perl is 7 hours off.
>
> Wags ;)

I presume that you are checking these with how the
system clock is set on both?

you might want to check how they do with resolving

a) to GMT time
b) is there a ntp server around?

we ran into this with some java code on the offset issues
between NT and win2000

it turned out that one system was handing out GMT time
as the default to the applications or some such...


ciao
drieux

---


-- 
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]




Re: Time being displayed is off my 7 hours

2002-04-21 Thread José Nyimi


Which perl's function (or module) are you using to print out time information ?

Could you write down the syntax you are using ?

José.



-
Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !



Re: Passing a variable to a DOS batch file

2002-04-21 Thread Michael Lamertz

On Sat, Apr 20, 2002 at 08:07:09PM -0400, Paul Lombardo wrote:
> 
> I need to do the following:
> 
> if the perl script fails I need to pass a variable to the batch file so it 
> can exit with a proper failure message
>  when the perl script succeeds I need to pass a variable to the batch file 
> so it can exit with a proper success message.
> 
> I have tried setting ENV{ERRORLEVEL} on failure I have tried exit()  and 
> nothing seems to work.

Nope, that won't work, since the Environment is only passed over to
child processes, not parents.  Since the NT shell lacks critical
features like backquotes, the only thing I see that's left is a kind of
status file that you write on error.  You can check the existance and
content of that file if your script returns an error.

-- 
   If we fail, we will lose the war.

Michael Lamertz|  +49 221 445420 / +49 171 6900 310
Nordstr. 49|   [EMAIL PROTECTED]
50733 Cologne  | http://www.lamertz.net
Germany|   http://www.perl-ronin.de 

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




Re: Passing a variable to a DOS batch file

2002-04-21 Thread Elias Assmann

On Sun, 21 Apr 2002, Michael Lamertz wrote:
> On Sat, Apr 20, 2002 at 08:07:09PM -0400, Paul Lombardo wrote:
> > I need to do the following:
> >
> > if the perl script fails I need to pass a variable to the batch file so it
> > can exit with a proper failure message
> >  when the perl script succeeds I need to pass a variable to the batch file
> > so it can exit with a proper success message.
> >
> > I have tried setting ENV{ERRORLEVEL} on failure I have tried exit()  and
> > nothing seems to work.
>
> Nope, that won't work, since the Environment is only passed over to
> child processes, not parents.  Since the NT shell lacks critical
> features like backquotes, the only thing I see that's left is a kind of
> status file that you write on error.  You can check the existance and
> content of that file if your script returns an error.

Hm, I got bitten by the missing backquotes a while ago too...

But I'm not sure if they are what Paul wants, that depends on what he
wants to do I think.

If the Perl script is the last thing the batch file executes, I don't
really see a problem, since you could just let the Perl script emit
the error/success message. That might leave you with the problem of
exiting the batch script with the correct exit code, but I don't know
how the NT shell does these things (Bash shells exit with the exit
code their last command exited with IIRC; an eval might also take care
of the problem).

If the future course of actions of the batch script depends on the
success/failure of the Perl script, then you could do that with a
temporary file, like Micheal suggested, or you might also ressort to
exit codes -- there has to be *some* way to capture them, don't you
think?

Or you could pipe the output of the Perl script to another script (be
it Perl or batch or what-not) that could interpret it... But really,
I'd just get rid of the NT shell and re-write the thing in all-Perl
:-)

Elias

-- 
"There are people who don't like capitalism, and there are people who don't like PCs,
but there's no one who likes the PC who doesn't like Microsoft."
 -- Bill Gates


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




pack / unpack

2002-04-21 Thread Jon Howe

I am trying to convert a file into hex from text with a view to doing some 
manipulation before turning it back to text.

#! /usr/bin/perl -w

undef $/;
open(IN, "< file") || die "no on file";
   $file = ;

print unpack('H*',"$file");

print "\n\nCONV TO TXT HERE\n\n";

print pack('H*',"$file");

print $file;


the hex conversation appears of but the return output from pack garbage (well not 
text).
I am shure its me missing something or not understanding any ideas ?



Re: pack / unpack

2002-04-21 Thread Jonathan E. Paton

> I am trying to convert a file into hex from text
> with a view to doing some manipulation before
> turning it back to text.

One has to ask: WHY???
(Unless using tools that already exist)

Perl can handle both text and binary information,
and you can do all your binary manipulations as
if you were manipulating strings.

use byte; #Perl 5.6 and greater - I think

E.g.

$data =~ s/^\x41/\x42/;

will replace the first byte (an ASCII 'A') into
(an ASCII 'B').  For more information type:

perldoc byte

Which I hope works :)

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Re: pack / unpack

2002-04-21 Thread Jon Howe

I should have been more specific or my be I have missed the point again :(
the file is UTF-8 encoded which is fine
for what I want.

However, I need to get at bullet points within the text. these apear as the
entity â~@¢ in vi.

So I thought if could the hex value It would able to deal with any
regexification in that form and the go back to text.

Does the solution you surgest still apply?

Jon




- Original Message -
From: "Jonathan E. Paton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 21, 2002 1:37 PM
Subject: Re: pack / unpack


> > I am trying to convert a file into hex from text
> > with a view to doing some manipulation before
> > turning it back to text.
>
> One has to ask: WHY???
> (Unless using tools that already exist)
>
> Perl can handle both text and binary information,
> and you can do all your binary manipulations as
> if you were manipulating strings.
>
> use byte; #Perl 5.6 and greater - I think
>
> E.g.
>
> $data =~ s/^\x41/\x42/;
>
> will replace the first byte (an ASCII 'A') into
> (an ASCII 'B').  For more information type:
>
> perldoc byte
>
> Which I hope works :)
>
> Jonathan Paton
>
> __
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> 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]




Re: SOAP::Lite documentation?

2002-04-21 Thread Todd Wade


"Tara Calishain" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is there SOAP::Lite documentation for Perl novices? Everything I've found
> so far seems
> to be written for more advanced users.

perl.com did a two parter. The articles there always give a good foundation
on using modules

http://www.perl.com/pub/a/2001/01/soap.html

and

http://www.perl.com/pub/a/2001/04/24/soap.html

have fun,

trwww



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




RE: Time being displayed is off my 7 hours

2002-04-21 Thread Wagner-David

Everything looks fine from a 'windows perspective' and this is not a new load 
though it was not setup for last year when the daylight savings switched over.  I 
assume it has something to do with that, but now shows a 7 hour lapse.  I believe that 
that is the difference in GM time to Pacific
Time since we are now one hour faster due to daylight time.

So is there some variable that Perl uses. I notice that TZ is set to PST vs 
PDT, but do not see any other environment variables.

Wags ;)

-Original Message-
From: drieux [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 20, 2002 21:16
To: [EMAIL PROTECTED]
Subject: Re: Time being displayed is off my 7 hours



On Saturday, April 20, 2002, at 07:21 , [EMAIL PROTECTED] 
wrote:

>   Yes. Two feet from each other. Time on machines are correct(PDT), but 
> something within perl is 7 hours off.
>
> Wags ;)

I presume that you are checking these with how the
system clock is set on both?

you might want to check how they do with resolving

a) to GMT time
b) is there a ntp server around?

we ran into this with some java code on the offset issues
between NT and win2000

it turned out that one system was handing out GMT time
as the default to the applications or some such...


ciao
drieux

---


-- 
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]




Re: what is this syntax mean?

2002-04-21 Thread Jenda Krynicky

From: bob ackerman <[EMAIL PROTECTED]>

> could someone explain how this syntax works?
> does the call to member function 'proxy' return the object which is
> then used to call function 'uri' which returns the object which is
> used to call function 'hi' which returns the object which is used to
> call method 'result'?
> 
> use SOAP::Lite;
> print SOAP::Lite
>  -> proxy('http://services.soaplite.com/hibye.cgi')
>  -> uri('http://www.soaplite.com/Demo')
>  -> hi()
>  -> result;

Yes, exactly. You could rewrite it as

$obj1 = SOAP::Lite->proxy('http://services.soaplite.com/hibye.cgi');
$obj2 = $obj1->uri('http://www.soaplite.com/Demo');
$obj3 = $obj2->hi();
print $obj3->result;


> and then what is this syntax?:
> use SOAP::Lite +autodispatch =>
>  uri => 'http://www.soaplite.com/Temperatures',
>  proxy => 'http://services.soaplite.com/temper.cgi';
> 
> i can't even guess.

1) The plus seems like it doesn't do anything. I don't know why did 
they put it there.

2) => is the same as a comma except for the fact that if the thing 
before => looks like a word it is "quoted".

use SOAP::Lite 'autodispatch',
 'uri', 'http://www.soaplite.com/Temperatures',
 'proxy', 'http://services.soaplite.com/temper.cgi';

This loads the SOAP::Lite module and calls its import() function 
with parameters
('autodispatch',
 'uri', 'http://www.soaplite.com/Temperatures',
 'proxy', 'http://services.soaplite.com/temper.cgi')

The import() function will install a handler into your package (if you 
don't know what a package is, assume it installs a handler 
FULLSTOP) that will catch all undefined functions and interpret 
them as SOAP remote method calls.

See "Autoloading" in perldoc perlsub

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

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




Re: pack / unpack

2002-04-21 Thread Jonathan E. Paton

> I should have been more specific or maybe I have missed the point again :(
> the file is UTF-8 encoded which is fine for what I want.
>
> However, I need to get at bullet points within the text. these apear as the
> entity â~@¢ in vi.

Have you got the hex code for that one?  I presume this is the only
character causing difficulty - hence we really want to avoid turning
the whole string into hex numbers - which are harder to process.

> So I thought if could the hex value it would able to deal with any
> regexification in that form and the go back to text.

Okay, here is my slightly modified strategy if you are just wanting
to parse the file:

my $bullet = qr/\x00/; # qr = quoted regex

then you can say:

my ($extracted = $line) =~ /${bullet}(.*)$/;

to extract the text between that character, and the end of the line.

Alternatively, use the "tr" function to map the bullet to something
better:

tr/\x000/\x000/; # Put in the right hex codes

Either way, you need to know what the hex code for the bullet is.

> Does the solution you suggest still apply?

If as understood, then definately!

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




RE: Time being displayed is off my 7 hours

2002-04-21 Thread Wagner-David

Just doing a call to :

sub get_time {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time - $diff);
$mon++;
 }  # end of get_time

where $diff equals zero.

If I type date at my ksh ( MKS Korn Shell) I get:

Sun Apr 21 07:58:25 PDT 2002

It is the same on both machines, but if I run the perl script on both machines:

w2k:
aapl079.pl:   Load Bible Hash St  : 15:00:09
MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs: 1019401209
110  18  40 437 478
110  19  12 205 217
Read Job 40 and Hebrews 12 for ( 4/21/ 2):
Reading Books of Psalms:
Normal  :  21,  51,  81, 111, 141
Backward: 130, 100,  70,  40,  10
Random  :   1,  78,  85, 101, 110
aapl079.pl:   Load Bible Hash En  : 15:00:09

nt 4.0:
aapl079.pl:   Load Bible Hash St  : 08:00:09
MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs: 1019401209
110  18  40 437 478
110  19  12 205 217
Read Job 40 and Hebrews 12 for ( 4/21/ 2):
Reading Books of Psalms:
Normal  :  21,  51,  81, 111, 141
Backward: 130, 100,  70,  40,  10
Random  :   1,  78,  85, 101, 110
aapl079.pl:   Load Bible Hash En  : 08:00:09

The actual time is 08:00.

Wags ;)

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 01:15
To: 'drieux '; '[EMAIL PROTECTED] '
Subject: RE: Time being displayed is off my 7 hours


 
I figured Wags would have checked, but I just had to ask, because sometimes
it's some little thing like that that ends up biting us in the butt.  BTW, I
should have been clearer, but what I was asking was if the machines were set
to the same time zone in the time settings.  It does appear that one system
is giving out the GMT.  Out of curiosity (and a desire to avoid as much pain
in the future as possible), what are you doing that results in the different
times?  Is it a particular function or module?

-Original Message-
From: drieux
To: [EMAIL PROTECTED]
Sent: 4/20/02 9:16 PM
Subject: Re: Time being displayed is off my 7 hours


On Saturday, April 20, 2002, at 07:21 , [EMAIL PROTECTED] 
wrote:

>   Yes. Two feet from each other. Time on machines are
correct(PDT), but 
> something within perl is 7 hours off.
>
> Wags ;)

I presume that you are checking these with how the
system clock is set on both?

you might want to check how they do with resolving

a) to GMT time
b) is there a ntp server around?

we ran into this with some java code on the offset issues
between NT and win2000

it turned out that one system was handing out GMT time
as the default to the applications or some such...


ciao
drieux

---


-- 
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]

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




Re: pack / unpack

2002-04-21 Thread Jon Howe

re:Have you got the hex code for that one?  I presume this is the only
> character causing difficulty - hence we really want to avoid turning
> the whole string into hex numbers - which are harder to process.



$values = unpack('H*',"$file");

output for the  entity â~@¢

HEX: e280a20a

Jon

- Original Message -
From: "Jonathan E. Paton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 21, 2002 3:54 PM
Subject: Re: pack / unpack


> > I should have been more specific or maybe I have missed the point again
:(
> > the file is UTF-8 encoded which is fine for what I want.
> >
> > However, I need to get at bullet points within the text. these apear as
the
> > entity â~@¢ in vi.
>
> Have you got the hex code for that one?  I presume this is the only
> character causing difficulty - hence we really want to avoid turning
> the whole string into hex numbers - which are harder to process.
>
> > So I thought if could the hex value it would able to deal with any
> > regexification in that form and the go back to text.
>
> Okay, here is my slightly modified strategy if you are just wanting
> to parse the file:
>
> my $bullet = qr/\x00/; # qr = quoted regex
>
> then you can say:
>
> my ($extracted = $line) =~ /${bullet}(.*)$/;
>
> to extract the text between that character, and the end of the line.
>
> Alternatively, use the "tr" function to map the bullet to something
> better:
>
> tr/\x000/\x000/; # Put in the right hex codes
>
> Either way, you need to know what the hex code for the bullet is.
>
> > Does the solution you suggest still apply?
>
> If as understood, then definately!
>
> Jonathan Paton
>
> __
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> 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]




Re: How to thread in Perl?

2002-04-21 Thread Chas Owens

On Fri, 2002-04-19 at 21:38, Ahmed Moustafa wrote:
> Chas Owens wrote:
> > my $terminate = 0;
> > $SIG{TERM} = sub { $terminate = 1 };
> > until ($terminate) {
> > #do stuff
> > }
> > 
> > #cleanup
> > 
> > 
> > You should definitely provide some means of cleanly bring down your
> > daemon.
> 
> Cleaning up is application specific, isn't? Or, is there a standard 
> procedure?
> 
> How can a child process be forced to be killed (in the cleaning up)?
> 
> -- 
> Ahmed Moustafa
> http://pobox.com/~amoustafa

The daemon should not come down until all of its children are finished. 
That is why you need intercept SIGTERM.

-- 
Today is Sweetmorn the 38th day of Discord in the YOLD 3168
Kallisti!

Missile Address: 33:48:3.521N  84:23:34.786W


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




Re: pack / unpack

2002-04-21 Thread Jonathan E. Paton

> re:Have you got the hex code for that one?  I presume this is the only
> > character causing difficulty - hence we really want to avoid turning
> > the whole string into hex numbers - which are harder to process.
> 
> $values = unpack('H*',"$file");
> 
> output for the  entity â~@¢
> 
> HEX: e280a20a

Okay, don't use 'tr' - the bullet has been multibyte encoded, and I'm
not sure if it'll work if you map 4 bytes onto 1 byte.

This *should* work:

s/\xe2\x80\xa2\x0a/*/g; # /g replaces globally in the string

If you need something more specific (i.e. you don't know how to
proceed) then please post an attachment with the textfile.  Hopefully
the mail program doesn't trim off attachments ;-)  Keep it under 5k
though.

Until next time... take care,

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Re: Passing a variable to a DOS batch file

2002-04-21 Thread Michael Lamertz

On Sun, Apr 21, 2002 at 01:45:27PM +0200, Elias Assmann wrote:

> If the Perl script is the last thing the batch file executes, I don't
> really see a problem, since you could just let the Perl script emit
> the error/success message. That might leave you with the problem of
> exiting the batch script with the correct exit code, but I don't know
> how the NT shell does these things (Bash shells exit with the exit
> code their last command exited with IIRC; an eval might also take care
> of the problem).

But the old DOS shells don't have 'eval' either.

> If the future course of actions of the batch script depends on the
> success/failure of the Perl script, then you could do that with a
> temporary file, like Micheal suggested, or you might also ressort to
> exit codes -- there has to be *some* way to capture them, don't you
> think?

The exit code can be found in the $ERRORLEVEL environment variable on
DOS shells.

> Or you could pipe the output of the Perl script to another script (be
> it Perl or batch or what-not) that could interpret it...

Not necessarily, since you can't redirect STDERR with the DOS shell.

> But really,
> I'd just get rid of the NT shell and re-write the thing in all-Perl
> :-)

Yepp, Ditto.  Or at least install Cygwin...

-- 
   If we fail, we will lose the war.

Michael Lamertz|  +49 221 445420 / +49 171 6900 310
Nordstr. 49|   [EMAIL PROTECTED]
50733 Cologne  | http://www.lamertz.net
Germany|   http://www.perl-ronin.de 

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




Re: Time being displayed is off my 7 hours

2002-04-21 Thread drieux


On Sunday, April 21, 2002, at 08:01 , [EMAIL PROTECTED] wrote:

>   Just doing a call to :
>
> sub get_time {
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
> localtime(time - $diff);
> $mon++;
>  }  # end of get_time

This Always worries me - make the drieux FEEL saver -

sub get_time {
my ($diff) = shift;
 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time - $diff);
 $mon++;
  }  # end of get_time

this way - since we KNOW who is setting and passing it around

a) you should have 'perl -w' - for the warnings
b) you MUST have 'use strict' - we may find that there is
some place where "$diff" is getting set and scragged
[..]

you might check with:

[jeeves:~] drieux% perl -e 'print localtime(time) . "\n"' ;
Sun Apr 21 09:11:17 2002
[jeeves:~]

on both machines - but lets peek at the data you sent..

> w2k:
> aapl079.pl:   Load Bible Hash St  : 15:00:09
> MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs: 
> 1019401209
[..]

> aapl079.pl:   Load Bible Hash En  : 15:00:09
>
> nt 4.0:
> aapl079.pl:   Load Bible Hash St  : 08:00:09
> MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs: 
> 1019401209

[..]

> aapl079.pl:   Load Bible Hash En  : 08:00:09
>
>   The actual time is 08:00.


if I assum that 'MyCurrSecs' is the traditional 'seconds' since
the epoch - ala

[jeeves:~] drieux% perl -MTime::localtime -e 'print ctime(1019401209) . 
"\n" ; '
Sun Apr 21 08:00:09 2002
[jeeves:~] drieux%

so a part of the question seems to be if the w2k perl function
'localtime' is a part of your 'issue' = hence you should be using


use Time::localtime;

cf: also perldoc Time::Local 

wherein we find

"  timelocal() is implemented using the same cache.  We just
assume that we're translating a GMT time, and then fudge
it when we're done for the timezone and daylight savings
arguments. "

you may also want to check  perl -e 'print $ENV{'TZ'} . "\n";'
which should return you 'nothing' - unless there is some funk
being played on your win2k box...




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




Re: pack / unpack

2002-04-21 Thread drieux


On Sunday, April 21, 2002, at 07:49 , Jon Howe wrote:

> I should have been more specific or my be I have missed the point again :
> (
> the file is UTF-8 encoded which is fine
> for what I want.
>
> However, I need to get at bullet points within the text. these apear as 
> the
> entity â~@¢ in vi.
>
> So I thought if could the hex value It would able to deal with any
> regexification in that form and the go back to text.
>
> Does the solution you surgest still apply?

what you want is something ala the old 'man ascii' but
of the form 'man uft-8' so that you can see the pretty
table for the 'non-ascii' stuff - such as this bullet points?

hence would know how to 'find' the bullet points?

http://www.google.com/search?hl=en&q=%22UTF-8%22+%2B+perl

Much Much is findable about how to do the

use uft8

ciao
drieux

---

OH MY GOD WE ARE OUT OF COFFEE
Later dude...


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




$1 $2 $3 variables

2002-04-21 Thread pat

I've just started with perl and have 2 questions:-
Ques 1) If someone would kindly show me the code to split the following into
the special variables $1 $2 $3 upto $9. I have spent the best part of today
on it and I can separate the 08:45:50 and separate the string if there were
','s in it - which I do not want. I would like to place 'Mar' in $1, 17 in
$2, 08:48:50 in $3 and so on.

$line = "Mar 17 08:48:50 msasa pppd[6404]: Connect: ppp0 <--> /dev/ttyS1"

Ques 2) Where in the linux documentation do I find an example?  I have
RH7.1.


Many thanks

Pat




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




Re: $1 $2 $3 variables

2002-04-21 Thread Jeff 'japhy' Pinyan

On Apr 22, pat said:

>I've just started with perl and have 2 questions:-
>Ques 1) If someone would kindly show me the code to split the following into
>the special variables $1 $2 $3 upto $9. I have spent the best part of today
>on it and I can separate the 08:45:50 and separate the string if there were
>','s in it - which I do not want. I would like to place 'Mar' in $1, 17 in
>$2, 08:48:50 in $3 and so on.
>
>$line = "Mar 17 08:48:50 msasa pppd[6404]: Connect: ppp0 <--> /dev/ttyS1"

Well, there's no need to put them into $1, $2, etc.  That can only be done
with a regex, and there's no need to do

  $line =~ /(\S+)\s+(\S+)\s+.../;

Why not just do:

  @parts = split ' ', $line;

>Ques 2) Where in the linux documentation do I find an example?  I have
>RH7.1.

If you have perl installed, you have perldoc installed.

  japhy% perldoc -f split
  [...]

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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




Re: browsing html pages

2002-04-21 Thread Elaine -HFB- Ashton

Martin [[EMAIL PROTECTED]] quoth:
*>
*>As a Perl rookie I've got a serious problem trying to find out how to write
*>a code which should do the following stuff: connect to specified URL using
*>HTTP, send GET / PUT messages and process the output (web page) from the
*>server. I went throug my Perl guidebook but found nothing according to this
*>subject. Can anybody give me a hint (and/or suggest a good reference guide
*>for
*>Perl on the internet) ?

If you can wait until July Perl and LWP,
http://www.amazon.com/exec/obidos/ASIN/0596001789, is an outstanding book
for this sort of stuff. 

There is 'perldoc lwpcook' as well.

e.

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




RE: Time being displayed is off my 7 hours

2002-04-21 Thread Timothy Johnson

 
That IS strange.  I've been using localtime on NT Servers and Workstations
for a while now without seeing this disparity.  Do both machines have the
MKS Toolkit installed?  Are you running the script from the command prompt
or ksh?  If it's ksh, do you see the same thing if you run it from the
command prompt?  I'm just shooting out ideas.  I'm pretty much perplexed.
If you figure it out let us know, since this could potentially be a nasty
little problem for any of us.

-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 4/21/02 8:01 AM
Subject: RE: Time being displayed is off my 7 hours

Just doing a call to :

sub get_time {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time - $diff);
$mon++;
 }  # end of get_time

where $diff equals zero.

If I type date at my ksh ( MKS Korn Shell) I get:

Sun Apr 21 07:58:25 PDT 2002

It is the same on both machines, but if I run the perl script on
both machines:

w2k:
aapl079.pl:   Load Bible Hash St  : 15:00:09
MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs:
1019401209
110  18  40 437 478
110  19  12 205 217
Read Job 40 and Hebrews 12 for ( 4/21/ 2):
Reading Books of Psalms:
Normal  :  21,  51,  81, 111, 141
Backward: 130, 100,  70,  40,  10
Random  :   1,  78,  85, 101, 110
aapl079.pl:   Load Bible Hash En  : 15:00:09

nt 4.0:
aapl079.pl:   Load Bible Hash St  : 08:00:09
MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs:
1019401209
110  18  40 437 478
110  19  12 205 217
Read Job 40 and Hebrews 12 for ( 4/21/ 2):
Reading Books of Psalms:
Normal  :  21,  51,  81, 111, 141
Backward: 130, 100,  70,  40,  10
Random  :   1,  78,  85, 101, 110
aapl079.pl:   Load Bible Hash En  : 08:00:09

The actual time is 08:00.

Wags ;)

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 01:15
To: 'drieux '; '[EMAIL PROTECTED] '
Subject: RE: Time being displayed is off my 7 hours


 
I figured Wags would have checked, but I just had to ask, because
sometimes
it's some little thing like that that ends up biting us in the butt.
BTW, I
should have been clearer, but what I was asking was if the machines were
set
to the same time zone in the time settings.  It does appear that one
system
is giving out the GMT.  Out of curiosity (and a desire to avoid as much
pain
in the future as possible), what are you doing that results in the
different
times?  Is it a particular function or module?

-Original Message-
From: drieux
To: [EMAIL PROTECTED]
Sent: 4/20/02 9:16 PM
Subject: Re: Time being displayed is off my 7 hours


On Saturday, April 20, 2002, at 07:21 , [EMAIL PROTECTED] 
wrote:

>   Yes. Two feet from each other. Time on machines are
correct(PDT), but 
> something within perl is 7 hours off.
>
> Wags ;)

I presume that you are checking these with how the
system clock is set on both?

you might want to check how they do with resolving

a) to GMT time
b) is there a ntp server around?

we ran into this with some java code on the offset issues
between NT and win2000

it turned out that one system was handing out GMT time
as the default to the applications or some such...


ciao
drieux

---


-- 
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]

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




RE: browsing html pages

2002-04-21 Thread Ron Goral

I have recently taken a stab at this myself.  There is probably an easier
way, but I could not make ::TreeBuilder respond well.  I had to sub-class
it.  I'm sure that drieux has some wisdom about this and how to do it more
easily.  =)

Peace In Christ -
Ron Goral
[EMAIL PROTECTED] 


> -Original Message-
> From: drieux [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 20, 2002 10:03 AM
> To: [EMAIL PROTECTED]
> Subject: Re: browsing html pages
>
>
>
> On Friday, April 19, 2002, at 01:22 , Martin wrote:
>
> > Hi Yo!
> >
> > As a Perl rookie I've got a serious problem trying to find out how to
> > write
> > a code which should do the following stuff: connect to
> specified URL using
> > HTTP, send GET / PUT messages and process the output (web page) from the
> > server. I went throug my Perl guidebook but found nothing according to
> > this
> > subject. Can anybody give me a hint (and/or suggest a good
> reference guide
> > for
> > Perl on the internet) ?
>
> while Not A Good Illustration but one that I know works
>
> http://www.wetware.com/drieux/src/unix/perl/UglyCode.txt
>
> my Illustration of how to do this for a friend is:
>
> http://www.wetware.com/drieux/CS/lang/Perl/Beginners/for_thog.txt
>
>
> The Funk is in 'parsing the webPage' - and for that I
> have found that having HTML::TreeBuilder is OBLIGATORY
> unless you want to do all the heavy lifting on your own.
>
>
>
> ciao
> drieux
>
> ---
>
>



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




Re: Passing a variable to a DOS batch file

2002-04-21 Thread Elias Assmann

On Sun, 21 Apr 2002, Michael Lamertz wrote:

> On Sun, Apr 21, 2002 at 01:45:27PM +0200, Elias Assmann wrote:
>
> > If the Perl script is the last thing the batch file executes, I don't
> > really see a problem, since you could just let the Perl script emit
> > the error/success message. That might leave you with the problem of
> > exiting the batch script with the correct exit code, but I don't know
> > how the NT shell does these things (Bash shells exit with the exit
> > code their last command exited with IIRC; an eval might also take care
> > of the problem).
>
> But the old DOS shells don't have 'eval' either.

Did I say eval? Oops, I meant exec of course :-)

Elias

-- 
"There are people who don't like capitalism, and there are people who don't like PCs,
but there's no one who likes the PC who doesn't like Microsoft."
 -- Bill Gates


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




RE: Time being displayed is off my 7 hours

2002-04-21 Thread Wagner-David

Both have the same setup and both from a ksh give the same data output. I 
tried it from the command prompt and it gave me the same time offset of 7 hours while 
from the nt 4.0 it gave me the right time.

I know that it has something to do with the time switch, but otherwise I am at 
loss myself.

I rechecked the timesone and it is for gmt-0800 Pacific Time.

Wags ;) ps Thanks for responding and I will keep on trying.

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 11:42
To: Wagner, David --- Technical Specialist I ---WGO; Timothy Johnson;
'[EMAIL PROTECTED] '; '[EMAIL PROTECTED] '
Subject: RE: Time being displayed is off my 7 hours


 
That IS strange.  I've been using localtime on NT Servers and Workstations
for a while now without seeing this disparity.  Do both machines have the
MKS Toolkit installed?  Are you running the script from the command prompt
or ksh?  If it's ksh, do you see the same thing if you run it from the
command prompt?  I'm just shooting out ideas.  I'm pretty much perplexed.
If you figure it out let us know, since this could potentially be a nasty
little problem for any of us.

-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 4/21/02 8:01 AM
Subject: RE: Time being displayed is off my 7 hours

Just doing a call to :

sub get_time {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time - $diff);
$mon++;
 }  # end of get_time

where $diff equals zero.

If I type date at my ksh ( MKS Korn Shell) I get:

Sun Apr 21 07:58:25 PDT 2002

It is the same on both machines, but if I run the perl script on
both machines:

w2k:
aapl079.pl:   Load Bible Hash St  : 15:00:09
MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs:
1019401209
110  18  40 437 478
110  19  12 205 217
Read Job 40 and Hebrews 12 for ( 4/21/ 2):
Reading Books of Psalms:
Normal  :  21,  51,  81, 111, 141
Backward: 130, 100,  70,  40,  10
Random  :   1,  78,  85, 101, 110
aapl079.pl:   Load Bible Hash En  : 15:00:09

nt 4.0:
aapl079.pl:   Load Bible Hash St  : 08:00:09
MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs:
1019401209
110  18  40 437 478
110  19  12 205 217
Read Job 40 and Hebrews 12 for ( 4/21/ 2):
Reading Books of Psalms:
Normal  :  21,  51,  81, 111, 141
Backward: 130, 100,  70,  40,  10
Random  :   1,  78,  85, 101, 110
aapl079.pl:   Load Bible Hash En  : 08:00:09

The actual time is 08:00.

Wags ;)

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 01:15
To: 'drieux '; '[EMAIL PROTECTED] '
Subject: RE: Time being displayed is off my 7 hours


 
I figured Wags would have checked, but I just had to ask, because
sometimes
it's some little thing like that that ends up biting us in the butt.
BTW, I
should have been clearer, but what I was asking was if the machines were
set
to the same time zone in the time settings.  It does appear that one
system
is giving out the GMT.  Out of curiosity (and a desire to avoid as much
pain
in the future as possible), what are you doing that results in the
different
times?  Is it a particular function or module?

-Original Message-
From: drieux
To: [EMAIL PROTECTED]
Sent: 4/20/02 9:16 PM
Subject: Re: Time being displayed is off my 7 hours


On Saturday, April 20, 2002, at 07:21 , [EMAIL PROTECTED] 
wrote:

>   Yes. Two feet from each other. Time on machines are
correct(PDT), but 
> something within perl is 7 hours off.
>
> Wags ;)

I presume that you are checking these with how the
system clock is set on both?

you might want to check how they do with resolving

a) to GMT time
b) is there a ntp server around?

we ran into this with some java code on the offset issues
between NT and win2000

it turned out that one system was handing out GMT time
as the default to the applications or some such...


ciao
drieux

---


-- 
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]

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




RE: Time being displayed is off my 7 hours

2002-04-21 Thread Wagner-David

Thanks, Drieux. Somewhere along the line and for reasons I realy don't 
remember, I added a variable TZ set to PST. Up til the switchover, I know the time 
outputted for my scripts was correct.  I removed from the environment. Re-booted 
machine and I am back in sync with the correct time.

I quess maybe a Perl guru can tell us if someone knows why the TZ envirionment 
variable would not affect the output of correct tims when not on Daylight Saving time 
and affect it when we switched over?

Again, very sorry for the amount of time people  spent on this. I know that I 
would not just have put in the TZ variable without some input from a perl source or 
something? Other than the MKS Korn shell, I don't use Unix setup. So I just don't know.

Again thanks to the list in helping me get it back in order.

Wags ;)

-Original Message-
From: drieux [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 09:27
To: [EMAIL PROTECTED]
Subject: Re: Time being displayed is off my 7 hours



On Sunday, April 21, 2002, at 08:01 , [EMAIL PROTECTED] wrote:

>   Just doing a call to :
>
> sub get_time {
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
> localtime(time - $diff);
> $mon++;
>  }  # end of get_time

This Always worries me - make the drieux FEEL saver -

sub get_time {
my ($diff) = shift;
 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time - $diff);
 $mon++;
  }  # end of get_time

this way - since we KNOW who is setting and passing it around

a) you should have 'perl -w' - for the warnings
b) you MUST have 'use strict' - we may find that there is
some place where "$diff" is getting set and scragged
[..]

you might check with:

[jeeves:~] drieux% perl -e 'print localtime(time) . "\n"' ;
Sun Apr 21 09:11:17 2002
[jeeves:~]

on both machines - but lets peek at the data you sent..

> w2k:
> aapl079.pl:   Load Bible Hash St  : 15:00:09
> MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs: 
> 1019401209
[..]

> aapl079.pl:   Load Bible Hash En  : 15:00:09
>
> nt 4.0:
> aapl079.pl:   Load Bible Hash St  : 08:00:09
> MyDisp: 0 -> Passed to proc_step1 MySecs:  978350400  MyCurrSecs: 
> 1019401209

[..]

> aapl079.pl:   Load Bible Hash En  : 08:00:09
>
>   The actual time is 08:00.


if I assum that 'MyCurrSecs' is the traditional 'seconds' since
the epoch - ala

[jeeves:~] drieux% perl -MTime::localtime -e 'print ctime(1019401209) . 
"\n" ; '
Sun Apr 21 08:00:09 2002
[jeeves:~] drieux%

so a part of the question seems to be if the w2k perl function
'localtime' is a part of your 'issue' = hence you should be using


use Time::localtime;

cf: also perldoc Time::Local 

wherein we find

"  timelocal() is implemented using the same cache.  We just
assume that we're translating a GMT time, and then fudge
it when we're done for the timezone and daylight savings
arguments. "

you may also want to check  perl -e 'print $ENV{'TZ'} . "\n";'
which should return you 'nothing' - unless there is some funk
being played on your win2k box...




-- 
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]




Re: How to thread in Perl?

2002-04-21 Thread drieux


On Sunday, April 21, 2002, at 08:09 , Chas Owens wrote:
[..]
> The daemon should not come down until all of its children are finished.
> That is why you need intercept SIGTERM.
[..]

technically the correct structure for RFC compiance is

The daemon MUST NOT come down until all of its children
have finished and exited.

'must not' is more declarative than 'should' as to 'responsibility.

If the coder breeds children - they must be reaped.

SysAdmins are Allowed to Fire Volley's of Shot, and shell,
at coders who fail on this point


ciao
drieux

---


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




Re: $1 $2 $3 variables

2002-04-21 Thread drieux


On Sunday, April 21, 2002, at 11:41 , Jeff 'japhy' Pinyan wrote:

> On Apr 22, pat said:
[..]
>> $line = "Mar 17 08:48:50 msasa pppd[6404]: Connect: ppp0 <--> /dev/ttyS1"
>
> Well, there's no need to put them into $1, $2, etc.  That can only be done
> with a regex, and there's no need to do
>
>   $line =~ /(\S+)\s+(\S+)\s+.../;

but having stuffed them into $1..$9, doesn't he want to get them
out of there toot sweet - or at least the ones that will need to
be dealt with before doing any subseqent matching that would step
over the values such as deconstructing the 'time' there???

> Why not just do:
>
>   @parts = split ' ', $line;

or the map to hash trick of the form:

 #!/usr/bin/perl -w
 use strict;

 my $line = "Mar 17 08:48:50 msasa pppd[6404]: Connect: ppp0 <--> /dev/
ttyS1";

 my $count = 1 ;
 my %parts = map { $count++ => $_ } (split ' ', $line);

 my $incr = 1;
print "$incr has <$parts{$incr++}> \n"
while ( $incr < $count );

which would allow him to access it by numeric offset and hence
would generate data of the form:

jeeves:~] drieux% perl tmp/perl/silly.pl
1 has 
2 has <17>
3 has <08:48:50>
4 has 
5 has 
6 has 
7 has 
8 has <<-->>
9 has 
[jeeves:~]
{ i put $parts{$incr++} inside the <...> to help him see that split did 
work
the way that we all expect it... }


>> Ques 2) Where in the linux documentation do I find an example?  I have
>> RH7.1.
>
> If you have perl installed, you have perldoc installed.
>
>   japhy% perldoc -f split
>   [...]

ciao
drieux

---


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




References

2002-04-21 Thread Hans Holtan

Hi folks,
The code shown bellow is supposed to de-reference a hash-reference of 
array-references and print everything out nicely. But the array 
references do not get de-referenced.  I really appreciate the help.
Thanks,
Hans


#!usr/bin/perl  -w
use strict;
use warnings;
use diagnostics;
my $alignment_hash;

$alignment_hash = &read_alignment ("Aligned_friz.txt", "%");
foreach my $key (keys (%$alignment_hash)) {
print "{$key}\t=>\t[$$alignment_hash{$key}]\n";
}


sub read_alignment {

my (
$align_file,# The path to the aligned sequence file
$esc# The escape character indicating 
anotation lines in the alignement file
) = @_;
my ($seq, $seq_key, $amino_acids, %alignments);
open (ALIGNMENT, "<$align_file") or die "Could not open 
\"$align_file\". $!\n";
while () {
chomp;
next unless ($_ =~ /\S/); 
# Skip any lines with only white space
if ($_ =~ /$esc/o) { 
# "%" indicates an anotation line
if (not $seq) { # No 
seq yet, must be the first pass ...
$seq_key = $_;  # so 
just get the anottation and goto next
next;
} else {
#turn 
the seq into a list of amino acids
$amino_acids = [split (//, $seq)];
# 
Place the anotation and the seq in a hash
$alignments{$seq_key} = $amino_acids;
$seq = ""; 
# Reset the $seq variable for the next seq
$seq_key = $_;  # 
Store the new key

}
} else { 
# Not anotation:
next unless $seq_key;   # 
Skip any junk at the beginning of the file
$seq .= $_; # Get 
more of the seq.
}
}   # 
Done reding file
close (ALIGNMENT);
$amino_acids = [split (//, $seq)];
$alignments{$seq_key} = $amino_acids; 
# Place the anotation with last seq in hash

return (\%alignments);
}
-- 





Hans E. E. Holtan
Graduate Student
UC Berkeley-Department of Plant and Microbial Biology
Plant Gene Expression Center
800 Buchanan Street
Albany, California 94710
U. S. A.
Phone: (510) 559-5922
FAX: (510) 559-6089
[EMAIL PROTECTED]
_

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