[18792] in Perl-Users-Digest
Perl-Users Digest, Issue: 960 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 22 18:06:12 2001
Date: Tue, 22 May 2001 15:05:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <990569119-v10-i960@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 22 May 2001 Volume: 10 Number: 960
Today's topics:
Re: Array slice: how about the remainder? (glauber)
Building a source for Perl contracts <todd@designsouth.net>
Re: Building a source for Perl contracts <uri@sysarch.com>
Re: Building a source for Perl contracts <mischief@velma.motion.net>
Re: Building a source for Perl contracts <todd@designsouth.net>
Re: Building a source for Perl contracts <mischief@velma.motion.net>
Re: Curious about this I found on the web! <todd@designsouth.net>
Re: Curious about this I found on the web! (Steven M. O'Neill)
Re: Curious about this I found on the web! <mischief@velma.motion.net>
Re: Good source for Perl contracts ? <todd@designsouth.net>
Re: hash reference nobull@mail.com
Re: Help with using fcntl file locking <bernie@fantasyfarm.com>
How can I convert a date (MM/DD/YYYY) to UTC time? <william.c.nelson@gte.net>
Re: How can I convert a date (MM/DD/YYYY) to UTC time? <todd@designsouth.net>
Re: How can I convert a date (MM/DD/YYYY) to UTC time? (John Joseph Trammell)
Re: How can I convert a date (MM/DD/YYYY) to UTC time? <william.c.nelson@gte.net>
Re: How can I convert a date (MM/DD/YYYY) to UTC time? <william.c.nelson@gte.net>
Re: How can I convert a date (MM/DD/YYYY) to UTC time? <todd@designsouth.net>
How to localize error messages for testing? <newspost@coppit.org>
Re: How to store data in the session with perl? <anomie@my-deja.com>
Re: How to store data in the session with perl? (Abigail)
Re: module for combinatorics? (partitions etc) (E.Chang)
Re: module for combinatorics? (partitions etc) <EUSWMCL@am1.ericsson.se>
Re: module for combinatorics? (partitions etc) (Mark Jason Dominus)
Re: module for combinatorics? (partitions etc) <EUSWMCL@am1.ericsson.se>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 May 2001 12:58:36 -0700
From: theglauber@my-deja.com (glauber)
Subject: Re: Array slice: how about the remainder?
Message-Id: <892f97d1.0105221158.20cbba41@posting.google.com>
sweth+perl@gwu.edu (Sweth Chandramouli) wrote in message news:<C7bO6.14277$G5.2997054@news1.rdc1.md.home.com>...
> In article <fa45b871.0105210800.2046045a@posting.google.com>,
> Steven <steve.busiello@gs.com> wrote:
> >i tested it like this:
> >
> >@array ( 1..10 );
> >@chosen = (1,3,5,7,9);
> >@not_chosen = grep { /[^@chosen]/ } @array;
> >foreach (@not_chosen) { print "$_\n"; }
> >
> >my results were 2,4,6,8,10
> Heh. That's very entertaining; it just goes to show that
> a single anecdotal piece of evidence doesn't necessarily prove anything.
> Try setting array to (1..12) and see what the results are; your
> particular data set happened to hide a small problem in your logic.
Beautiful! A good example of how regexes sometimes don't DWIM! It took
me a few minutes to understand why it filters out 11, 13, 15... but
not 21, 23, 25, then it filters again 31, 33, 35... Very entertaining
indeed!
g
------------------------------
Date: Tue, 22 May 2001 19:05:18 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Building a source for Perl contracts
Message-Id: <OLyO6.56876$I5.12393361@news1.rdc1.tn.home.com>
Building on a post that came through a few minutes ago, what if I (or one of
you, or ALL of us), cooperatively started building a website (maybe at
sourceforge.com) where companies could come to us with small perl jobs and
get the work done for a price. Instead of each one of us trying to pump up
our resumes to get one job, we just sell the fact that the
PerlDevelopers.com group (or whatever) has unlimited perl knowledge and
we're able to do any job.
We set our own hourly rates, and let companies pick a person based on that
and your resume.
Someone with legal expertise in this group could help by writing out
contracts for the companies giving work and the developers getting jobs.
Whenever somebody posts a homework question to the group, instead of flaming
them, we can send them to the site. "Yeah, we'll do it for a price!"
This was my idea, but I'm sure people have had it before, and if I started
the project at sourceforge, we could all help develop the site, so this
wouldn't bring anybody any money unless you actually get a job to work on.
Should we do it?
------------------------------
Date: Tue, 22 May 2001 20:10:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Building a source for Perl contracts
Message-Id: <x7n1855emx.fsf@home.sysarch.com>
>>>>> "TS" == Todd Smith <todd@designsouth.net> writes:
TS> Building on a post that came through a few minutes ago, what if I
TS> (or one of you, or ALL of us), cooperatively started building a
TS> website (maybe at sourceforge.com) where companies could come to
TS> us with small perl jobs and get the work done for a price. Instead
TS> of each one of us trying to pump up our resumes to get one job, we
TS> just sell the fact that the PerlDevelopers.com group (or whatever)
TS> has unlimited perl knowledge and we're able to do any job.
jobs.perl.org already exists and supports the jobs@perl.org mailing
list. a web DB for contractors is in progress too.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Tue, 22 May 2001 20:22:27 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Building a source for Perl contracts
Message-Id: <tglik3jnk90hd0@corp.supernews.com>
Todd Smith <todd@designsouth.net> wrote:
> Building on a post that came through a few minutes ago, what if I (or one of
> you, or ALL of us), cooperatively started building a website (maybe at
> sourceforge.com) where companies could come to us with small perl jobs and
> get the work done for a price. Instead of each one of us trying to pump up
> our resumes to get one job, we just sell the fact that the
> PerlDevelopers.com group (or whatever) has unlimited perl knowledge and
> we're able to do any job.
Do we form a company, or do we make it a freelancer's billboard of
sorts?
> We set our own hourly rates, and let companies pick a person based on that
> and your resume.
If that person isn't bogged down with other work at the moment
and has skills in the specific application area, you mean. Not
all Perl programmers have knowledge in all application areas.
Some specialize in one or more application types.
> Someone with legal expertise in this group could help by writing out
> contracts for the companies giving work and the developers getting jobs.
...Or all of those interested could pitch in and hire a lawyer.
I know A.C. Yardley has been kind enough to offer to work on a
legal FAQ for the community, but we can't as a group ask too much
of a few members.
> Whenever somebody posts a homework question to the group, instead of flaming
> them, we can send them to the site. "Yeah, we'll do it for a price!"
> This was my idea, but I'm sure people have had it before, and if I started
> the project at sourceforge, we could all help develop the site, so this
> wouldn't bring anybody any money unless you actually get a job to work on.
> Should we do it?
I fail to see how it would be better than or different from
http://jobs.perl.org unless the people who use it profit together and
grow the organization together. If you're suggesting that many of
us band together to create a developers' company or a developers' union,
then that's another story. That involves large possible rewards but
large possible risks, and requires much thought and meditation before
firm decisions can be made by many of your target members.
Chris
--
For the pleasure of others, please adhere to the following
rules when visiting your park:
No swimming. No fishing. No flying kites. No frisbees.
No audio equipment. Stay off grass. No pets. No running.
------------------------------
Date: Tue, 22 May 2001 21:43:23 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Building a source for Perl contracts
Message-Id: <%3BO6.57111$I5.12487400@news1.rdc1.tn.home.com>
I guess (know that I know about jobs@perl.org), that I was thinking of an
organized version that distributes the jobs to the people best suited for
them, or lets the company decide who gets it based on how much experience
they can afford. Combo monster.com (job poster side) and jobs@perl.org
------------------------------
Date: Tue, 22 May 2001 21:57:00 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Building a source for Perl contracts
Message-Id: <tglo5cq96d9b1c@corp.supernews.com>
Todd Smith <todd@designsouth.net> wrote:
> I guess (know that I know about jobs@perl.org), that I was thinking of an
> organized version that distributes the jobs to the people best suited for
> them, or lets the company decide who gets it based on how much experience
> they can afford. Combo monster.com (job poster side) and jobs@perl.org
If I were ambitious enough to help develop the idea, I might suggest
a coop of sorts, in which the job spec is sent in and a team of
Perl programmers take on the task together in order to get it done
quickly and well. Each would then reap some of the rewards, and a
small percentage would go to help maintain the maintenance of the
site.
Since I'm not overly ambitious today, consider that idea with the
knowledge I may not opt to jump on the project. I think that within
a few months of such a system running successfully, the average
abilities of the participants may rise noticeably due to exposure
to the better programmers in the group on such a basis. Then, the
services / products offered by such an enterprise would start to
take on added value.
All this said, I have a machine handy and have access to colocate
it very affordably, being an employee of an ISP. If this project
were to become serious, I would have no problem hosting it at
one of my day job's facilities.
Chris
--
Product shown enlarged to make you think you're getting more.
------------------------------
Date: Tue, 22 May 2001 19:20:16 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Curious about this I found on the web!
Message-Id: <QZyO6.56879$I5.12400337@news1.rdc1.tn.home.com>
did you run it?
"David Soming" <davsoming@lineone.net> wrote in message
news:tglai97gs0uc00@corp.supernews.co.uk...
> Hi,
> I found this somewhere on the web and wondered what it is/does practical
> use?
> Its far too advanced for me... just curious really, anyone?
>
> #!/usr/bin/perl
>
if(@ARGV){$w=int(shift(@ARGV)/2)*2+1;$h=int(shift(@ARGV)/2)*2+1;}else{$w=81
> ;$h=25;}$m=' 'x$w.(' '.'#'x($w-2)." ")x($h-2).'
'x$w;main:for(substr($m,$p=
> 2*$w+2,1)=4;$v!=4;){$o=$v=int(rand(4));do{substr($m,$p+$d,1)='
',substr($m,
> $p+=2*$d,1)=$v,next main
if(substr($m,$p+2*($d=((($v&2)?1:-1)*(($v&1)?1:$w)
> )),1)eq'#')}while($o!=($v=($v+1)%4));$v=substr($m,$p,1);substr($m,$p,1)='
'
> ;$p-=2*((($v&2)?1:-1)*(($v&1)?1:$w)) if
($v<4);}for($i=0;$i<$w*($h-2);print
> substr($m,1+($i+=$w),$w-1),"\n"){}
>
>
>
>
------------------------------
Date: 22 May 2001 19:27:39 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Curious about this I found on the web!
Message-Id: <9eeejb$aju$1@news.panix.com>
David Soming <davsoming@lineone.net> wrote:
>I found this somewhere on the web and wondered what it is/does
>practical use? Its far too advanced for me... just curious really,
>anyone?
>
>#!/usr/bin/perl
>if(@ARGV){$w=int(shift(@ARGV)/2)*2+1;$h=int(shift(@ARGV)/2)*2+1;}else{$w=81
>;$h=25;}$m=' 'x$w.(' '.'#'x($w-2)." ")x($h-2).' 'x$w;main:for(substr($m,$p=
>2*$w+2,1)=4;$v!=4;){$o=$v=int(rand(4));do{substr($m,$p+$d,1)=' ',substr($m,
>$p+=2*$d,1)=$v,next main if(substr($m,$p+2*($d=((($v&2)?1:-1)*(($v&1)?1:$w)
>)),1)eq'#')}while($o!=($v=($v+1)%4));$v=substr($m,$p,1);substr($m,$p,1)=' '
>;$p-=2*((($v&2)?1:-1)*(($v&1)?1:$w)) if ($v<4);}for($i=0;$i<$w*($h-2);print
>substr($m,1+($i+=$w),$w-1),"\n"){}
I'd be afraid to run something from Usenet (especially with all that
printing going on), but it looks to me like it makes random mazes out of
#'s.
--
Steven O'Neill steveo@panix.com
www.cars-suck.org
------------------------------
Date: Tue, 22 May 2001 19:32:21 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Curious about this I found on the web!
Message-Id: <tglfm5rpos0539@corp.supernews.com>
David Soming <davsoming@lineone.net> wrote:
> Hi,
> I found this somewhere on the web and wondered what it is/does practical
> use?
If you're designing a maze-wandering game or publishing a book
of mazes on paper for kids it may have a practical use.
> Its far too advanced for me... just curious really, anyone?
It generates a 2-d maze with the walls consisting of hash marks.
If defaults to a reasonable height and width for many text displays,
but when given command-line arguments, the first becomes the width
and the second the height.
It doesn't deal well with receiving one argument and not a second,
due to the q{if(@ARGV)} decision it makes.
A nice little program for people who write Advent/Zork or Rogue/NetHack
style games as a hobby. (Text-based games reminiscent of Zork/Advent
won't use the maze for a display, but I've seen a couple which use
similar methods for data files.)
> #!/usr/bin/perl
> if(@ARGV){$w=int(shift(@ARGV)/2)*2+1;$h=int(shift(@ARGV)/2)*2+1;}else{$w=81
> ;$h=25;}$m=' 'x$w.(' '.'#'x($w-2)." ")x($h-2).' 'x$w;main:for(substr($m,$p=
> 2*$w+2,1)=4;$v!=4;){$o=$v=int(rand(4));do{substr($m,$p+$d,1)=' ',substr($m,
> $p+=2*$d,1)=$v,next main if(substr($m,$p+2*($d=((($v&2)?1:-1)*(($v&1)?1:$w)
> )),1)eq'#')}while($o!=($v=($v+1)%4));$v=substr($m,$p,1);substr($m,$p,1)=' '
> ;$p-=2*((($v&2)?1:-1)*(($v&1)?1:$w)) if ($v<4);}for($i=0;$i<$w*($h-2);print
> substr($m,1+($i+=$w),$w-1),"\n"){}
Now, I need to download NetHack and play a few levels...
Chris
--
Disclaimer: Actual product may not resemble picture in ad in any way.
------------------------------
Date: Tue, 22 May 2001 18:45:25 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Good source for Perl contracts ?
Message-Id: <9tyO6.56867$I5.12383489@news1.rdc1.tn.home.com>
if you find one, let me know!
------------------------------
Date: 22 May 2001 18:50:29 +0100
From: nobull@mail.com
Subject: Re: hash reference
Message-Id: <u9g0dx8e8q.fsf@wcl-l.bham.ac.uk>
"R" <smrtalec@nospam.earthlink.net> writes:
> The following peice of code generates, the output below. I am trying to
> make a visiually clean reference to the data represented in the hash. any
> ideas ?
What do you mean by the phrase "visiually clean reference"? Do you
mean you want undef to behave as null without throwing a warning and
without having to litter your code with ||''?
> <snip>
> @job_info=($radd_name,$radd_address);
> $user{$user_number}=\@job_info;
> #################################
> print "test cycle -3 \n";
> print $user{$user_number}->[1]->{first};
> </snip>
>
> <output>
> test cycle -3
> Use of uninitialized value at ./aewest2.pl line 42, <STDIN> chunk 8.
> rowan@linux-srv:~/pl >
> </output>
Well, nothing defined $radd_address so that's to be expected if you
have warnings enabled.
With lexically scoped warnings you can suppress the warning thus:
@job_info=($radd_name,$radd_address);
$user{$user_number}=\@job_info;
#################################
print "test cycle -3 \n";
{
no warnings qw(uninitialized);
print $user{$user_number}[1]{first};
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 22 May 2001 14:53:40 -0400
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Re: Help with using fcntl file locking
Message-Id: <cpclgtgthumivr4vd7onh0lbo3ic7gss8h@4ax.com>
On Mon, 21 May 2001 18:35:58 -0400, Bernie Cosell
<bernie@fantasyfarm.com> wrote:
} This is on RH 7.1, Perl 5.6. System is compiled to use flock() so to get
} fcntl file locking [until/if I can get Perl recompiled with use-flock
} turned off] I need to do the fcntl calls explicitly.
A modest bit of poking around and I've gotten the program working.
PHEW!! I doubt anyone cares, but here's what it took:
} ================================================
} #!/usr/bin/perl -w
} use Fcntl ;
} use strict ;
}
} use constant target => "/tmp/locktest" ;
} use constant structflock => "SSLLL" ; # I *think* this is right
}
} if (open (F, target))
# change the above to:
}} if (open (F, "+<".target))
# You can't get a write lock unless the file is open for writing!
[...]
} my $lockit = pack(structflock, F_WRLCK, 0,0,0,0) ;
} fcntl (F, F_SETLKW, $lockit) ;
And that's it and it works -- the entire problem was that I was trying
to get a write-lock on a file that I didn't have open for writing.
} ... The unix man page
} doesn't list any errors for F_SETLKW so I assume that it can never fail:
The man page lies (or omits). There are a LOT Of reasons-for-failure
for this one [e.g., invalid FD]. the key debugging stage for this was
the obvious thing I should've done first:
fcntl(F,F_SETLKW,$lockit) or die "Error in fcntl: $!\n" ;
/Bernie\
--
Bernie Cosell mailto:bernie@rev.net
Roanoke Electronic Village
------------------------------
Date: Tue, 22 May 2001 21:27:14 GMT
From: Bill Nelson <william.c.nelson@gte.net>
Subject: How can I convert a date (MM/DD/YYYY) to UTC time?
Message-Id: <3B0AD4D0.6727AC4E@gte.net>
This is a multi-part message in MIME format.
--------------504F117303018F44386933A9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I would like to do some date comparrisons via UTC time and am trying to
determine how to converte a date format of something like: 12/01/2000
to UTC without having to do all the math and figure out leap years and
such.
Any ideas?
thanks,
bill
--------------504F117303018F44386933A9
Content-Type: text/x-vcard; charset=us-ascii;
name="william.c.nelson.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Nelson
Content-Disposition: attachment;
filename="william.c.nelson.vcf"
begin:vcard
n:Nelson;Bill
tel;pager:727.468.6779
tel;cell:727.365.5677
tel;fax:727.579.1107
tel;work:727.576.0549 x213
x-mozilla-html:FALSE
url:http://www.bnelson.com
adr:;;;;;;
version:2.1
email;internet:isstb@flanet.com
title:Consultant/Trainer/Developer
fn:Nelson, Bill
end:vcard
--------------504F117303018F44386933A9--
------------------------------
Date: Tue, 22 May 2001 21:35:11 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: How can I convert a date (MM/DD/YYYY) to UTC time?
Message-Id: <jYAO6.57085$I5.12481305@news1.rdc1.tn.home.com>
Date::Manip
(probably)
------------------------------
Date: Tue, 22 May 2001 21:37:06 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: How can I convert a date (MM/DD/YYYY) to UTC time?
Message-Id: <slrn9glkik.8b4.trammell@bayazid.hypersloth.net>
On Tue, 22 May 2001 21:27:14 GMT, Bill Nelson <william.c.nelson@gte.net> wrote:
> I would like to do some date comparrisons via UTC time and am trying to
> determine how to converte a date format of something like: 12/01/2000
> to UTC without having to do all the math and figure out leap years and
> such.
Perl is chock-full of time manipulation utils:
localtime
gmtime
Time::Local
--
Salad: it's what's for dinner, for what's for dinner.
------------------------------
Date: Tue, 22 May 2001 21:41:22 GMT
From: Bill Nelson <william.c.nelson@gte.net>
Subject: Re: How can I convert a date (MM/DD/YYYY) to UTC time?
Message-Id: <3B0AD81B.A2E890DF@gte.net>
This is a multi-part message in MIME format.
--------------62909AB9B9CB5044FCFF316D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
No way to do it with standard perl functions? I would rather not try to
bring in another module at this time.
bill
Todd Smith wrote:
> Date::Manip
>
> (probably)
--------------62909AB9B9CB5044FCFF316D
Content-Type: text/x-vcard; charset=us-ascii;
name="william.c.nelson.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Nelson
Content-Disposition: attachment;
filename="william.c.nelson.vcf"
begin:vcard
n:Nelson;Bill
tel;pager:727.468.6779
tel;cell:727.365.5677
tel;fax:727.579.1107
tel;work:727.576.0549 x213
x-mozilla-html:FALSE
url:http://www.bnelson.com
adr:;;;;;;
version:2.1
email;internet:isstb@flanet.com
title:Consultant/Trainer/Developer
fn:Nelson, Bill
end:vcard
--------------62909AB9B9CB5044FCFF316D--
------------------------------
Date: Tue, 22 May 2001 21:51:01 GMT
From: Bill Nelson <william.c.nelson@gte.net>
Subject: Re: How can I convert a date (MM/DD/YYYY) to UTC time?
Message-Id: <3B0ADA55.746DAFE9@gte.net>
This is a multi-part message in MIME format.
--------------A24366338DB4D2EF78EEA926
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Yes, but none that I can tell to take a date and convert it to UTC, only to go from
UTC.
thanks,
bill
John Joseph Trammell wrote:
> On Tue, 22 May 2001 21:27:14 GMT, Bill Nelson <william.c.nelson@gte.net> wrote:
> > I would like to do some date comparrisons via UTC time and am trying to
> > determine how to converte a date format of something like: 12/01/2000
> > to UTC without having to do all the math and figure out leap years and
> > such.
>
> Perl is chock-full of time manipulation utils:
>
> localtime
> gmtime
> Time::Local
>
> --
> Salad: it's what's for dinner, for what's for dinner.
--------------A24366338DB4D2EF78EEA926
Content-Type: text/x-vcard; charset=us-ascii;
name="william.c.nelson.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Nelson
Content-Disposition: attachment;
filename="william.c.nelson.vcf"
begin:vcard
n:Nelson;Bill
tel;pager:727.468.6779
tel;cell:727.365.5677
tel;fax:727.579.1107
tel;work:727.576.0549 x213
x-mozilla-html:FALSE
url:http://www.bnelson.com
adr:;;;;;;
version:2.1
email;internet:isstb@flanet.com
title:Consultant/Trainer/Developer
fn:Nelson, Bill
end:vcard
--------------A24366338DB4D2EF78EEA926--
------------------------------
Date: Tue, 22 May 2001 21:53:03 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: How can I convert a date (MM/DD/YYYY) to UTC time?
Message-Id: <3dBO6.57135$I5.12494965@news1.rdc1.tn.home.com>
gmtime EXPR
Converts a time as returned by the time function to a
9-element array with the time localized for the standard
Greenwich time zone. Typically used as follows:
is that it?
------------------------------
Date: Tue, 22 May 2001 17:08:26 -0400
From: David Coppit <newspost@coppit.org>
Subject: How to localize error messages for testing?
Message-Id: <Pine.SUN.4.33.0105221705290.26010-100000@mamba.cs.Virginia.EDU>
My grepmail script has a test script that tests both valid and invalid
inputs. One of the invalid test cases tries to read from a file which
does not exist, resulting in the usual "No such file or directory"
message.
The problem is that in other languages, the message does not match,
foiling the test script. Is there some easy way to localize my test
script? For example, can I get access to the string table for error
messages? Or do I have to probe the system to figure out what the
message should be and update the test script on the fly?
--
David
------------------------------
Date: Tue, 22 May 2001 11:35:58 -0700
From: "Jordan Reed" <anomie@my-deja.com>
Subject: Re: How to store data in the session with perl?
Message-Id: <3b0ab177@monitor.lanset.com>
Session is a concept of a memory proxy that resides on an App server, and
since Perl doesn't usually run in the context of an App server, but just a
webserver with CGI or mod_perl, you're not going to get a free session
object like you may be used to in VB or Java.
Luckily, there are a lot of Perl programmers in the world who have already
had your problem, and there are a lot of Session modules out there that
should suite your needs. Just go find the right fit, download and use it.
Try looking on CPAN:
http://search.cpan.org/search?mode=module&query=session
-jdr
"Yannick" <yburtin@freesurf.fr> wrote in message
news:b245486b.0105220057.1bf27206@posting.google.com...
> Hi,
>
> In an html page with a perl script inside, I'd like to store a
> variable in the session in order to access it later in another page.
> How can I do that?
>
> Thank you.
>
> Yannick
------------------------------
Date: Tue, 22 May 2001 19:54:11 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: How to store data in the session with perl?
Message-Id: <slrn9glgv3.l17.abigail@tsathoggua.rlyeh.net>
Yannick (yburtin@freesurf.fr) wrote on MMDCCCXXI September MCMXCIII in
<URL:news:b245486b.0105220057.1bf27206@posting.google.com>:
|| Hi,
||
|| In an html page with a perl script inside, I'd like to store a
|| variable in the session in order to access it later in another page.
|| How can I do that?
Well, that's a browser issue. If the perl program is inside the
HTML page, (using the SCRIPT element, I suppose), it's up to the
browser how to deal with it.
Unless there's a standard (most likely published on www.w3c.org),
contact the browser vendor(s) on how to do this.
It isn't really a Perl question.
Of course, you might mean something else. But then, it's likely still
not a Perl question.
Abigail
--
@_=map{[$!++,$_^$/]}split$²,"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
$|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
$¼]<$_[$_-$*][$®];print+map{$_->[$|]}@_;select$·,$°,$½,0.1}}print$/
------------------------------
Date: Tue, 22 May 2001 19:09:05 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: module for combinatorics? (partitions etc)
Message-Id: <Xns90A99A8834EAFechangnetstormnet@207.106.92.86>
William Cardwell <EUSWMCL@am1.ericsson.se> wrote in
<3B0A9115.84B7A44D@am1.ericsson.se>:
>
>
>Mark Jason Dominus wrote:
>>
>> In article <3B0A63A7.8A90B8BE@am1.ericsson.se>,
>> William Cardwell <EUSWMCL@am1.ericsson.se> wrote:
>>> Techniques I have played with tend
>>> toward over-use of 0
>>
>> As I said, without some sort of clear statement about what sort of
>> distribution the original poster wants, we have no way to judge
>> 'over-use of 0'.
>>
>In your 4 lines or so, for his case of 5 [I am proposing] whole
>numbers totaling 18, how will you pick the bounds of the 1st random
>number... the 2nd...etc?
The total and number of terms determine the limits. Using your values
of 18 for the final sum and 5 for the number of positive integer terms,
the first term cannot be greater than 14 (18 - 4), since we need to get
4 more positive terms. To find the next term, we are repeating the
problem, but with four terms adding up to (18 - first term) and a limit
of (18 - first term) - 3. Etc.
I am sure there are more elegant solutions than the following simple (8
lines, not 4) approach to coding it.
my ($final_sum, $num_terms, $total) = (18, 5, 0);
my @terms;
foreach $i (1..$num_terms-1) {
$rand = int rand($final_sum - $total - $num_terms + $i) +1;
push @terms, $rand;
$total += $rand;
}
push @terms, $final_sum - $total;
--
EBC
------------------------------
Date: Tue, 22 May 2001 15:38:27 -0400
From: William Cardwell <EUSWMCL@am1.ericsson.se>
Subject: Re: module for combinatorics? (partitions etc)
Message-Id: <3B0AC033.3AD90A85@am1.ericsson.se>
"E.Chang" wrote:
> >>
> >In your 4 lines or so, for his case of 5 [I am proposing] whole
> >numbers totaling 18, how will you pick the bounds of the 1st random
> >number... the 2nd...etc?
>
> The total and number of terms determine the limits. Using your values
> of 18 for the final sum and 5 for the number of positive integer terms,
> the first term cannot be greater than 14 (18 - 4), since we need to get
> 4 more positive terms. To find the next term, we are repeating the
> problem, but with four terms adding up to (18 - first term) and a limit
> of (18 - first term) - 3. Etc.
>
> I am sure there are more elegant solutions than the following simple (8
> lines, not 4) approach to coding it.
>
> my ($final_sum, $num_terms, $total) = (18, 5, 0);
> my @terms;
> foreach $i (1..$num_terms-1) {
> $rand = int rand($final_sum - $total - $num_terms + $i) +1;
> push @terms, $rand;
> $total += $rand;
> }
> push @terms, $final_sum - $total;
>
> --
> EBC
Thanks, I like it and the approach is intuitive. However, when you run
it 100 times, aren't there too many ones? Suppose, I listed all
combinations in a standard order, counted and and numbered them, then
picked a random number bewteen 1 and the count, and picked that one, is
it so likely it will contain one(s)?
--------------------------------------------
for ($j=0;$j<100;$j++) {
my ($final_sum, $num_terms, $total) = (18, 5, 0);
my @terms;
foreach $i (1..$num_terms-1) {
$rand = int rand($final_sum - $total - $num_terms + $i) +1;
push @terms, $rand;
$total += $rand;
}
push @terms, $final_sum - $total;
print "@terms\n";
}
--------------------------------------------------
------------------------------
Date: Tue, 22 May 2001 19:55:45 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: module for combinatorics? (partitions etc)
Message-Id: <3b0ac440.3857$39@news.op.net>
In article <3B0AC033.3AD90A85@am1.ericsson.se>,
William Cardwell <EUSWMCL@am1.ericsson.se> wrote:
>However, when you run
>it 100 times, aren't there too many ones?
Since the original poster did not say what he was looking for, we have
no way to judge whether there are 'too many ones'.
>Suppose, I listed all combinations in a standard order, counted and
>and numbered them, then picked a random number bewteen 1 and the
>count, and picked that one, is it so likely it will contain one(s)?
Interesting question. Suppose it is true. Perhaps what that means is
that the method you just described will produce too few 1's. Since
the original poster did not say he wanted that behavior, worrying
about it is futile.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Tue, 22 May 2001 16:01:02 -0400
From: William Cardwell <EUSWMCL@am1.ericsson.se>
Subject: Re: module for combinatorics? (partitions etc)
Message-Id: <3B0AC57E.8FAE4432@am1.ericsson.se>
Mark Jason Dominus wrote:
>
> Interesting question. Suppose it is true. Perhaps what that means is
> that the method you just described will produce too few 1's. Since
> the original poster did not say he wanted that behavior, worrying
> about it is futile.
>
Right, but if you enjoy math etc. it can be fun to explore...
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
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.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.
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 V10 Issue 960
**************************************