Re: Look ma, no barewords!

2002-12-08 Thread Dave Cross
On Sun, Dec 08, 2002 at 03:25:17PM +1100, Damian Conway ([EMAIL PROTECTED]) wrote: [ Aren't you supposed to be taking a well-earned break? ] Kate L Pugh wrote: [hummous: kake]$ perl -MData::Dumper -we 'use strict; my $foo = [ -foo ]; print Dumper $foo' $VAR1 = [ '-foo'

Re: Look ma, no barewords!

2002-12-08 Thread Lusercop
On Sun, Dec 08, 2002 at 11:13:17AM +, Dave Cross wrote: On Sun, Dec 08, 2002 at 03:25:17PM +1100, Damian Conway ([EMAIL PROTECTED]) wrote: set_lang( -name='Perl', -paradigm='hybrid', -motto='TMTOWTDI' ); I thought that was using = quotes its left-hand operand magic quoting, not unary

Re: Look ma, no barewords!

2002-12-08 Thread mass
[hummous: kake]$ perl -we 'use strict; print -foo . \n' -foo [hummous: kake]$ Its in common use too... Gtk.pm et al use it in the latter versions for C enums. For example, The three arguments which specify the expand/shrink/fill behaviour for a particular cell consist of an arrayref

Re: Look ma, no barewords!

2002-12-08 Thread Damian Conway
Dave Cross wrote: [ Aren't you supposed to be taking a well-earned break? ] Yes, I am. I'm following a strict policy of only posting off-topic to newsgroups. Hence I post about Perl here. ;-) I thought that was using = quotes its left-hand operand magic quoting, not unary - quotes its

Perl and Time zones.

2002-12-08 Thread Tamsin
I'm asking in the hope that someone has done something like this before and can point me in the right direction. Does anyone know how I'd go about finding out the time zone offset for a given time zone name? I know that most Unix boxes set the local time zone using some time zone files...

Re: Perl and Time zones.

2002-12-08 Thread David Cantrell
On Sun, Dec 08, 2002 at 05:17:19PM +, Tamsin wrote: Does anyone know how I'd go about finding out the time zone offset for a given time zone name? Time::Zone and Time::ZoneInfo look promising. -- The future's bright, the future's orange! You are Leon and I claim my five pounds. --

Re: Perl and Time zones.

2002-12-08 Thread Lusercop
On Sun, Dec 08, 2002 at 05:35:01PM +, David Cantrell wrote: On Sun, Dec 08, 2002 at 05:17:19PM +, Tamsin wrote: Does anyone know how I'd go about finding out the time zone offset for a given time zone name? Time::Zone and Time::ZoneInfo look promising. The future's bright, the

Re: Perl and Time zones.

2002-12-08 Thread Tamsin
You will also need the descriptions or the compiled (with zic(8)) versions, for both of these versions. Presumably, though, these came with whatever system you're using. What is Zic(8) and how would I know if it is there or not? I got Time::ZoneInfo running on OSX, but I had to put a zone.tab

Re: Look ma, no barewords!

2002-12-08 Thread Paul Makepeace
On Sun, Dec 08, 2002 at 11:31:01AM +, Lusercop wrote: I think that the definition of a word is /\b(\w+)\b/ and '-' will cause a Why do you have the \b in there? Paul (asking this for the second time in $short_period) -- Paul Makepeace ...

Re: Perl and Time zones.

2002-12-08 Thread Mark Blackman
use Time::Local; $ENV{TZ}=Australia/Sydney; my @gmt=gmttime; my $tzdiff = timegm(@gmt)-timelocal(@gmt); is the kludgey way to do it, $tzdiff is in seconds. - Mark On Sunday, December 8, 2002, at 05:17 pm, Tamsin wrote: I'm asking in the hope that someone has done something like this

Re: [cam.pm] Christmas Perl Programming

2002-12-08 Thread David Cantrell
[beware of the cross-posting] I decided what I was going to write, wrote it, but then ran out of enthusiasm* and couldn't be bothered to munge it to fit the template. However, because it may be of interest, what I wrote is below. * - or more accurately, I had a crack-addled idea for a far less

Re: Look ma, no barewords!

2002-12-08 Thread Nicholas Clark
On Sun, Dec 08, 2002 at 03:25:17PM +1100, Damian Conway wrote: Kate L Pugh wrote: [hummous: kake]$ perl -MData::Dumper -we 'use strict; my $foo = [ -foo ]; print Dumper $foo' $VAR1 = [ '-foo' ]; [hummous: kake]$ Where's this documented? The perlop

Re: Perl and Time zones.

2002-12-08 Thread Tamsin
use Time::Local; $ENV{TZ}=Australia/Sydney; my @gmt=gmttime; my $tzdiff = timegm(@gmt)-timelocal(@gmt); is the kludgey way to do it, $tzdiff is in seconds. gmttime was a deliberate error? I was hoping for something a little more ... elegant. But it works, (yay! thanks!). Well to clarify it

Re: Look ma, no barewords!

2002-12-08 Thread Lusercop
On Sun, Dec 08, 2002 at 08:48:45PM +, Paul Makepeace wrote: On Sun, Dec 08, 2002 at 11:31:01AM +, Lusercop wrote: I think that the definition of a word is /\b(\w+)\b/ and '-' will cause a Why do you have the \b in there? In this case, becaues I didn't specify anything about where the

Re: Look ma, no barewords!

2002-12-08 Thread Paul Makepeace
On Sun, Dec 08, 2002 at 11:16:54PM +, Lusercop wrote: On Sun, Dec 08, 2002 at 08:48:45PM +, Paul Makepeace wrote: On Sun, Dec 08, 2002 at 11:31:01AM +, Lusercop wrote: I think that the definition of a word is /\b(\w+)\b/ and '-' will cause a Why do you have the \b in there?

Re: Perl and Time zones.

2002-12-08 Thread Lusercop
On Sun, Dec 08, 2002 at 08:36:56PM +, Tamsin wrote: You will also need the descriptions or the compiled (with zic(8)) versions, for both of these versions. Presumably, though, these came with whatever system you're using. What is Zic(8) and how would I know if it is there or not? The

Re: Look ma, no barewords!

2002-12-08 Thread Damian Conway
Nicholas Clark complained: But barewords are not allowed under strict. So why is -bareword being allowed? Because it's not a bareword. ;-) No more than any of these are: key = value; $hash{ key } qw( unbare ); In each case, a sequence of \w characters is marked as a string in some way.

Re: Look ma, no barewords!

2002-12-08 Thread Nicholas Clark
On Mon, Dec 09, 2002 at 10:27:20AM +1100, Damian Conway wrote: Nicholas Clark complained: But barewords are not allowed under strict. So why is -bareword being allowed? Because it's not a bareword. ;-) But, but, but you said: : The perlop manpage: : : Unary - performs arithmetic

Re: Perl and Time zones.

2002-12-08 Thread Paul Makepeace
On Sun, Dec 08, 2002 at 11:44:21PM +, Mark Blackman wrote: Elegant it ain't.. In fact, there is a much nicer way via C and the localtime libc function (at least in FreeBSD) where localtime returns a tm struct with the final member 'gmtoff', GMT offset in seconds, but for some reason perl

Re: Perl and Time zones.

2002-12-08 Thread Dirk Koopman
and bitter experience tells me that you can't rely on these values being correct or, indeed, based on any semblance of reality at all. On Sun, 2002-12-08 at 23:54, Paul Makepeace wrote: On Sun, Dec 08, 2002 at 11:44:21PM +, Mark Blackman wrote: Elegant it ain't.. In fact, there is a much

Re: Look ma, no barewords!

2002-12-08 Thread Kate L Pugh
(Thanks to everyone for their comments, and especially to Damian for pointing me at the right bit of the manual.) Damian quoted the perlop manpage: If the operand is an identifier, a string consisting of a minus sign concatenated with the identifier is returned. Nick wrote: But

DBD::SQLite confusion

2002-12-08 Thread Kate L Pugh
Hello. -- #!/usr/bin/perl -w use strict; use DBI; my $db_name = test.db; unlink $db_name; my $dbh = DBI-connect( dbi:SQLite:dbname=$db_name, , ); my $table = test; $dbh-do( CREATE TABLE $table ( foo LONGBLOB ) ); my $sth =

Re: Crazy maths proof

2002-12-08 Thread Chris Ball
So, another maths exercise. I'll award a pint at the January social meet for the first correct post with the next number in the sequence, and another for an explanation of the sequence itself. 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 60 Good luck, :-) - Chris. -- $a=printf.net;

Re: Perl and Time zones.

2002-12-08 Thread Mark Fowler
On Sun, 8 Dec 2002, Tamsin wrote: I'm asking in the hope that someone has done something like this before and can point me in the right direction. In addition to following all the other useful comments that people have already posted to this list, I'd like to suggest you might also consider

Re: Crazy maths proof

2002-12-08 Thread Mark Fowler
On Mon, 9 Dec 2002, Chris Ball wrote: So, another maths exercise. I'll award a pint at the January social meet for the first correct post with the next number in the sequence, and another for an explanation of the sequence itself. list-moderator-hat New rule: no random guessing

Re: Perl and Time zones.

2002-12-08 Thread Paul Makepeace
On Sun, Dec 08, 2002 at 11:54:11PM +, Paul Makepeace wrote: FWIW, intuition tells me, if I were doing this, to look at tzset(3). #!/usr/bin/perl -w use strict; use Inline C = 'EOC'; #include time.h #include stdlib.h #include stdio.h int tz_offset(char *tz) { extern long timezone;

Re: Perl and Time zones.

2002-12-08 Thread David M. Wilson
On Sun, Dec 08, 2002 at 11:27:09PM +, Lusercop wrote: 6 - Games The maddest bit of it all is that games have their own man page section -- even on commercial unixes. What the hell? I mean, take section 2 for instance, it could be split up. Then take 3, it _needs_ split up, but oooh no, we

Re: Crazy maths proof

2002-12-08 Thread Chris Devers
On Mon, 9 Dec 2002, Mark Fowler wrote: I don't know, showing this to a load of Perl coders. Of course we're not going to try and work it out, we're going to try and hack the system. This is such an incitement for a script that sends all the numbers from one to hundred thousand to the list

Re: Crazy maths proof

2002-12-08 Thread Kate L Pugh
On Sun 08 Dec 2002, Chris Devers [EMAIL PROTECTED] wrote: Consider the word wored 'chewed'. It has two personal pronouns in it -- 'he' and 'we'. Can you find a six letter word that has six pronouns it it? You utter, utter bastard. Look what you made me do: