[12117] in Perl-Users-Digest
Perl-Users Digest, Issue: 5717 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 18 18:07:21 1999
Date: Tue, 18 May 99 15:01:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 18 May 1999 Volume: 8 Number: 5717
Today's topics:
Re: Simple Time Manipulation (hymie!)
Re: Sorting a colon separated file <baliga@synopsys.com>
Re: Telnet Prompt <baliga@synopsys.com>
Re: Tie Fighter (Chris Nandor)
Re: Tie Fighter (Chris Nandor)
Re: Tie Fighter <gbartels@xli.com>
Re: Tie Fighter (Chris Nandor)
Re: Tie Fighter (Chris Nandor)
Verilog and VHDL <gbartels@xli.com>
Verilog and VHDL <gbartels@xli.com>
Writing a log file in a CGI script (Alan Chu)
Re: Writing a log file in a CGI script <bie@connect.ab.ca>
Re: Writing a log file in a CGI script (Alastair)
Re: Writing a log file in a CGI script <jeromeo@atrieva.com>
Re: Y2K. localtime(time) (Ethan H. Poole)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 May 1999 20:21:25 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: Simple Time Manipulation
Message-Id: <7hsi45$ad2$1@news.smart.net>
In our last episode, the evil Dr. Lacto had captured our hero,
Jonathan Stowe <gellyfish@gellyfish.com>, who said:
>Newsworthy <hannum@ohio.edu> wrote:
>> Hello,
>>
>> I want to be able to add 24 hours to the (timelocal) funciton. Could
>> somebody tell me how I can best do this?
>>
>
>I assume you mean localtime ?
>
>$time = localtime(time + 86400);
>
>Which of course might fail at some places at certain times of the year but
>its usually good enough ;-}
Why will this fail? Daylight savings time doesn't change the fact that
24 hours is 86,400 seconds.
..hymie! http://www.smart.net/~hymowitz hymie@lactose.smart.net
===============================================================================
You're never gonna lose the anger; you'll just feel it in a different way.
--Billy Joel
===============================================================================
------------------------------
Date: Tue, 18 May 1999 14:34:14 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Sorting a colon separated file
Message-Id: <3741DCD5.8B6364D2@synopsys.com>
read the man page of "sort" command on UNIX.
-- Baliga
eliot5581@my-dejanews.com wrote:
> Hi,
>
> I'm fairly new to perl and have written a script which manipulates a
> colon separated file of the form;
>
> 1:Joe:05:18:08:00:10:00:Meeting client:Mobile
> 2:Joe:05:19:10:00:12:30:Board Meeting:Not contactable
> 3:Joe:05:17:12:30:14:00:Lunch with sales team:Mobile
> (the fields are entry_no, name, month, day, start_hour, start_minutes,
> end_hour, end_minutes, location, contact_details)
>
> Basically the script reads the file, strips out field 1, sorts it on
> the 2nd, 3rd and 4th fields (month, day, start hour,) via an unwieldy
> shell script and a temp file, and then reads the temp file and writes
> it with new entry_no to the original file. The problem is that the file
> starts off as an ascii text file but the last part of the manipulation
> (reading lines from temp file , inserting entry_no at start and then
> writing to original file) causes the file type to be changed to data
> and the contents become unusable.
>
> I'm very puzzled by this as although I'll admit the code isn't exactly
> pretty I can't see why the file type changes.
>
> Any help would be appreciated.
>
> Regards
> Eliot Finnigan
> Network Analyst, Netstore Group Ltd
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
------------------------------
Date: Tue, 18 May 1999 14:49:52 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Telnet Prompt
Message-Id: <3741E080.AD66456A@synopsys.com>
It wait for the prompt matching the given regular expression. For creating
a new
Telnet connection, the string should be ending with colon character.
So $t = new Net::Telnet ( Timeout => 5, Prompt => '/[$%:]$/' );
-- Baliga
"Puddister, Shannon" wrote:
> I'm writing a program to connect to a remote server by way of Telnet,
> and having a little diffculty understanding the Prompt construct of the
> Telnet module. Does this prompt refer to the expected prompt of my
> computer, or that of the host? I'm using :
> $t = net Net::Telnet(Timeout=>5,Prompt=>'/[\$]/');
> Does the Prompt, as above wait for the '$' on my computer? How exactly
> does this syntax work?
> Thanks all around,
> Shannon
------------------------------
Date: Tue, 18 May 1999 20:51:47 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Tie Fighter
Message-Id: <pudge-1805991651500001@192.168.0.77>
In article <3741C38B.10E8BBD9@xli.com>, Greg Bartels <gbartels@xli.com> wrote:
# I have a subroutine which ties a variable passed into it by using $_[0]
# to access the actual variable for tying.
#
# sub my_tie{ tie ($_[0], 'package_name'); }
#
# using it looks like this:
#
# my_tie(my $tied_var);
#
# is there a way to do this so that instead of being an input parameter,
# it
# is a return value? like this:
#
# my $tied_var = my_tie();
#
# in other words, is there a way to directly access the variable that gets
# the return value, similar to the way you can directly access the input
# parameters?
No. But you could do:
sub my_tie { return tie my $tied, 'Foo' }
That looks like it will do what you want.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Tue, 18 May 1999 21:10:53 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Tie Fighter
Message-Id: <pudge-1805991710550001@192.168.0.77>
In article <pudge-1805991651500001@192.168.0.77>, pudge@pobox.com (Chris
Nandor) wrote:
# In article <3741C38B.10E8BBD9@xli.com>, Greg Bartels <gbartels@xli.com> wrote:
#
# # I have a subroutine which ties a variable passed into it by using $_[0]
# # to access the actual variable for tying.
# #
# # sub my_tie{ tie ($_[0], 'package_name'); }
# #
# # using it looks like this:
# #
# # my_tie(my $tied_var);
# #
# # is there a way to do this so that instead of being an input parameter,
# # it
# # is a return value? like this:
# #
# # my $tied_var = my_tie();
# #
# # in other words, is there a way to directly access the variable that gets
# # the return value, similar to the way you can directly access the input
# # parameters?
#
# No. But you could do:
#
# sub my_tie { return tie my $tied, 'Foo' }
#
# That looks like it will do what you want.
Oops, you really need:
sub my_tie { tie my $tied, 'Foo'; return $tied }
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Tue, 18 May 1999 17:20:46 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: Tie Fighter
Message-Id: <3741D9AE.C2D26D9B@xli.com>
Chris Nandor wrote:
>
> In article <pudge-1805991651500001@192.168.0.77>, pudge@pobox.com (Chris
> Nandor) wrote:
>
> # In article <3741C38B.10E8BBD9@xli.com>, Greg Bartels <gbartels@xli.com> wrote:
> #
> # # I have a subroutine which ties a variable passed into it by using $_[0]
> # # to access the actual variable for tying.
> # #
> # # sub my_tie{ tie ($_[0], 'package_name'); }
> # #
> # # using it looks like this:
> # #
> # # my_tie(my $tied_var);
> # #
> # # is there a way to do this so that instead of being an input parameter,
> # # it
> # # is a return value? like this:
> # #
> # # my $tied_var = my_tie();
> # #
> # # in other words, is there a way to directly access the variable that gets
> # # the return value, similar to the way you can directly access the input
> # # parameters?
> #
> # No. But you could do:
> #
> # sub my_tie { return tie my $tied, 'Foo' }
> #
> # That looks like it will do what you want.
>
> Oops, you really need:
>
> sub my_tie { tie my $tied, 'Foo'; return $tied }
>
nope, that doesn't seem to work either. If $tied is initialized,
the correct value gets returned. But the return seems to strip
out just the value. it doesn't return $tied, it returns the value
of $tied. so the relationship to the 'Foo' package is gone.
> --
> Chris Nandor mailto:pudge@pobox.com http://pudge.net/
> %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Tue, 18 May 1999 21:25:34 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Tie Fighter
Message-Id: <pudge-1805991725360001@192.168.0.77>
Ack, no, that won't work either, because the value is FETCHed. Silly
little scalars! I guess it is a good reason to not use tied scalars, then
... I don't think there is a way to pass a tied scalar around, because
when you do, FETCH is called. You could just treat it as an object:
sub mytie { return tie my $self, 'Foo' }
my $tied = mytie();
print $tied->FETCH;
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Tue, 18 May 1999 21:27:55 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Tie Fighter
Message-Id: <pudge-1805991727570001@192.168.0.77>
In article <3741D9AE.C2D26D9B@xli.com>, Greg Bartels <gbartels@xli.com> wrote:
# nope, that doesn't seem to work either. If $tied is initialized,
# the correct value gets returned. But the return seems to strip
# out just the value. it doesn't return $tied, it returns the value
# of $tied. so the relationship to the 'Foo' package is gone.
Yeah, I was thinking in terms of passing around tied hashes and arrays.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Tue, 18 May 1999 17:13:46 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Verilog and VHDL
Message-Id: <3741D80A.934B6A16@xli.com>
I've written a perl module that enables you to write
code that describes hardware in perl and simulate it.
it is similar in structure to Verilog and VHDL, but
it has all the handy, easy-to-use, features that comes
with the perl language. the module is called phdl.pm.
I created it at work because I wanted a way to quickly
describe some hardware and find out if it would work or
not, before I started writing VHDL code. (I'm an electrical
engineer.)
I was thinking about submitting it to CPAN, but I wanted to
see if there was any interest in the module or not.
The module supports signals (vhdl style), variables, simulation time,
multiple parallel processes, sensitivity lists, and all event
scheduling,
event handling, etc.
The original problem I was working on was trying to simulate
a FIFO which was reading at one frequency and writing at
another frequency. this is impossible to simulate with
normal software approaches. the module can simulate design
problems like this.
Think of it as a lightweight version of Verilog or VHDL.
Anyone interested?
Greg Bartels
gbartels@xli.com
(hey, my network connection is still up...)
------------------------------
Date: Tue, 18 May 1999 17:14:55 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Verilog and VHDL
Message-Id: <3741D84F.A7876742@xli.com>
I've written a perl module that enables you to write
code that describes hardware in perl and simulate it.
it is similar in structure to Verilog and VHDL, but
it has all the handy, easy-to-use, features that comes
with the perl language. the module is called phdl.pm.
I created it at work because I wanted a way to quickly
describe some hardware and find out if it would work or
not, before I started writing VHDL code. (I'm an electrical
engineer.)
I was thinking about submitting it to CPAN, but I wanted to
see if there was any interest in the module or not.
The module supports signals (vhdl style), variables, simulation time,
multiple parallel processes, sensitivity lists, and all event
scheduling,
event handling, etc.
The original problem I was working on was trying to simulate
a FIFO which was reading at one frequency and writing at
another frequency. this is impossible to simulate with
normal software approaches. the module can simulate design
problems like this.
Think of it as a lightweight version of Verilog or VHDL.
Anyone interested? please reply directly to my email address,
my network connection may go down at any minute.
Greg Bartels
gbartels@xli.com
------------------------------
Date: 18 May 1999 21:14:47 GMT
From: achu@cs.ualberta.ca (Alan Chu)
Subject: Writing a log file in a CGI script
Message-Id: <7hsl87$ign$1@scapa.cs.ualberta.ca>
Hi,
For some mysterious reasons, the CGI Perl script is not able to open a log file and write something to it. Anyone knows why?
thanx,
Alan
--
=^^= Alan Chu
------------------------------
Date: Sun, 16 May 1999 15:30:15 -0600
From: Tim <bie@connect.ab.ca>
Subject: Re: Writing a log file in a CGI script
Message-Id: <373F38E7.4D3B@connect.ab.ca>
"THE cgi perl script" ?
There are just a few more perl scripts then one around.
Alan Chu wrote:
>
> Hi,
>
> For some mysterious reasons, the CGI Perl script is not able to open a log file and write something to it. Anyone knows why?
>
> thanx,
>
> Alan
> --
> =^^= Alan Chu
------------------------------
Date: Tue, 18 May 1999 21:45:47 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Writing a log file in a CGI script
Message-Id: <slrn7k3rf8.5o.alastair@calliope.demon.co.uk>
Alan Chu <achu@cs.ualberta.ca> wrote:
>Hi,
>
>For some mysterious reasons, the CGI Perl script is not able to open a log file and write something to it. Anyone knows why?
Permissions maybe? Who knows? What about using ;
use CGI::Carp 'fatalsToBrowser';
and checking the errors from 'open' ($!).
HTH.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Tue, 18 May 1999 14:45:01 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Alan Chu <achu@cs.ualberta.ca>
Subject: Re: Writing a log file in a CGI script
Message-Id: <3741DF5D.3D961E26@atrieva.com>
Alan Chu wrote:
>
> Hi,
>
> For some mysterious reasons, the CGI Perl script is not able to open a log file and write something to it. Anyone knows why?
The mysterious variable $! will prognosticate the answer to your query.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Tue, 18 May 1999 15:18:53 -0400
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: Y2K. localtime(time)
Message-Id: <q0FUENWo#GA.200@rejz.ij.net>
Keywords: y2k, localtime
[Posted and Emailed] In article <7hfqbg$fk_001@its.csiro.au>,
hans.xie@its.CSIRO.AU says...
>
>Hi,
>
>I am in the middle of our Y2K testing. I am puzzled by the localtime()
return
>value. Out system date is: Sun Jan 2 10:10:51 EST 2000
>
>I noticed a strange thing. I put it in the below script to make the
>situation simple and clear:
> #!/usr/local/bin/perl
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> print $year;
>
>It prints 100, instead of 2000 or 00.
>
>Any idea? Thanks in advance.
For crying out loud, read the documentation for localtime() and you'd have
your answer in a heartbeat. localtime() is behaving *exactly* as documented,
current year minus 1900.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day, Inc.--
| http://www.interact2day.com/
=======FREE WEBSITE DESIGN PROMOTION UNTIL 5/31/99!=======
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5717
**************************************