[10872] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4473 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 21 15:07:28 1998

Date: Mon, 21 Dec 98 12:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 21 Dec 1998     Volume: 8 Number: 4473

Today's topics:
    Re: Anyone have a workaround for crippled ActiveState p hutchiss@my-dejanews.com
    Re: arccos, arcsin,... <earlw@kodak.com>
    Re: Authentification program? <gdryden@sb.net>
    Re: explain an hash assignment: $hash{'key'}++ (Tad McClellan)
    Re: glob() returns empty list chazlong@my-dejanews.com
        help!!! nguyen.van@imvi.bls.com
        How do I manually change the value of a hidden text fie (Troy Bull)
        howto "fool" browser? <martin.steffensen@hb.lu.se>
        installation error. need help <wchu@evodata.net>
    Re: More: Re: Error when trying to use flock() example  chazlong@my-dejanews.com
    Re: Nested sorting (Randal L. Schwartz)
    Re: PERL security problem (brian d foy)
        Q: is srand(time()); good enough? wyndo@cxo.com
        rename a large file problem (Dong Wang)
    Re: Retrospective on comp.lang.perl.moderated? <metcher@spider.herston.uq.edu.au>
    Re: Running Perl for Win32 -- Beginner Question chazlong@my-dejanews.com
    Re: specify password in a ftp URL? dermod@no.spam.leeds.ac.uk
        SSL <hjbraendle@gmx.net>
    Re: Turning Variables into CAPS? <r28629@email.sps.mot.com>
    Re: Turning Variables into CAPS? <r28629@email.sps.mot.com>
    Re: Turning Variables into CAPS? (Larry Rosler)
    Re: Turning Variables into CAPS? <Allan@due.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 21 Dec 1998 19:04:33 GMT
From: hutchiss@my-dejanews.com
Subject: Re: Anyone have a workaround for crippled ActiveState perl -- fork()
Message-Id: <75m640$iii$1@nnrp1.dejanews.com>

Thanks, Steven!

I tried the Win32::CreateProcess trick, and ran into the next wall:
if you try to open COM1 to read in one process and to write in another
process, one or the other process will be denied permission.  I'm still
trying to find the Win98/NT equivalent magic to let me past this.
Amazing things show up in searches for 'share devices serial port Windows'
but very few of them contain more than one keyword and so far none have
been useful.

Hutch

In article <zSNe2.1703$qF5.5090054@lwnws01.ne.mediaone.net>,
  "Steven Morlock" <newspost@morlock.net> wrote:
>
> I understand that versions of Perl build with the Cygwin Win32 ports
> of the GNU development tools support fork().  There appears to be support
> for using this compiler in the standard Perl source archive - see the
> README.cygwin32 in the archive.  The Cygwin tools can be found
> at http://sourceware.cygnus.com/cygwin/
>
> If any of you have had experience building and running Perl using
> this development environment, I'd like to hear about it.
>
> Steve
>
> --
> Foliage Software Systems
> aka The Nerd Farm
> http://www.foliage.com
>
> hutchiss@my-dejanews.com wrote in message <75brrb$bnc$1@nnrp1.dejanews.com>...
> >In the time-honored tradition of not re-inventing the wheel,
> >I'm looking for hints or examples of ways to get around the
> >gaping hole in Active State Perl...
> >
> >$main::whinge=1;
> >Is there a reason why these guys didn't bother to implement
> >a feature that NT supports and that even the 16-bit Windows
> >API had ways to approximate?
> >$main::whinge=0;
> >
> >I'm looking at different ways to do a fork equivalent. If I'm
> >forced to use Tcl to do this part of things it will be high irony.
> >
> >I'm going to be using perlTk to do the GUI part of the project
> >and it needs to be able to spawn off a number of different
> >pieces that have to be able to run concurrently (this app can be
> >run on Unix or NT) ... without the use of 'fork' I'm not sure
> >just how I'll be able to do this.
> >
> >Hints?  Pointers?  Derisive laughter?  Anything?
> >
> >-----------== Posted via Deja News, The Discussion Network ==----------
> >http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 21 Dec 1998 14:39:42 -0500
From: Earl Westerlund <earlw@kodak.com>
Subject: Re: arccos, arcsin,...
Message-Id: <367EA3FE.6747@kodak.com>

Christian wrote:
> 
> hi
hi 
> can anyone tell me how i can calc. the arccos ... with a perl script?

page 153 of the Blue Camel can.
 
> FAST HELP WANTED!!!

-- 
+-----------------+----------------------------------------+
| Earl Westerlund | Kodak's Homepage: http://www.kodak.com |
+-----------------+----------------------------------------+
|  The opinions expressed herein are mine and mine alone   |
|     (most people don't seem to want them anyway)         |
+----------------------------------------------------------+


------------------------------

Date: Mon, 21 Dec 1998 11:04:12 -0800
From: "Graham Dryden" <gdryden@sb.net>
Subject: Re: Authentification program?
Message-Id: <75m61s$5i5$1@news-1.news.gte.net>

What you need is a combination of users and groups and a rewrite rule in a
directory container in a virtual host.
Create your users and groups using dbmmanager. (There are other auth modules
like LDAP too if you want to handle thousands of users). You have to include
mod_rewrite and mod_auth_dbm in your sourc.conf file. The idea is that you
want every http request to be _rewritten_ so that the request is made to the
correct host for each client. You can't use a redirect because then the
client will be able to go directly to the served page next time around, thus
bypassing your password page, and he could give away the URL to another
client. Your httpd.conf file would contain something like this:

<VirtualHost 999.999.999.999>
    ServerName   www.client1.com
    DocumentRoot /var/www/virtual/client1/docs
                <Directory /*>
        AuthType Basic
        AuthName Client1
 AuthDBMUserFile  /usr/local/apache/users/users
AuthDBMGroupFile /usr/local/apache/users/users
require group Client1
        RewriteEngine On
// Magic to rearrange URLs to strip off unwanted junk...
        RewriteRule ^/var/www/virtual/Client1/docs/(.*)
http://999.999.999.999/client1/$1  [P]
    </Directory>
</VirtualHost>

Kerry J. Cox <kjcox@vii.com> wrote in message
news:367054B9.7A096466@vii.com...
>Okay, here's what I am attempting to do.  I am using Apache's htpasswd
>to set up a secure site,  However, what I really need is a frontend that
>will allow several groups of people to log in, making sure that each
>username was in my password file and was valid, and then based upon whom
>the person was, direct them to a specific site.
>For example, Persons A, B and C wanted to come to my page where I was
>placing information about their respective companies.  Since I don't
>want anyone else except for A, B and C to see the info, I have created a
>a login box using apache.  But I also don't want A to go to B's site or
>C to see A's site.  So when A logs in, he sees
>http://this.domain.com/testsite.html and when B logs in he sees
>http://this.domain.com/anothersite.html
>Each of these sites will also be drawing information from a database and
>posting it dynamically also, but that's another story.
>What I am asking therefore, is there a Perl program out there that will
>run on Linux or Solaris that will create dynamic links to separate pages
>based upon who is logging in?  Has anyone else tried and done something
>like this?  I would assume there is a simple Perl script for this.
>Thanks.
>KJ
>
>
>--
>
>.-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
>| Kerry J. Cox          Vyzynz International Inc.   |
>| kjcox@vii.com         Systems Administrator       |
>| (801) 596-7795        http://vii.com              |
>| All Things Linux      http://quasi.vii.com/linux/ |
>`---------------------------------------------------'
>
>
>




------------------------------

Date: Mon, 21 Dec 1998 13:37:49 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: explain an hash assignment: $hash{'key'}++
Message-Id: <d28m57.vi4.ln@magna.metronet.com>

Xah Lee (xah@web-central.net) wrote:

: Can anyone explain how constructs like $hh{'ss'}++ works? Here's an example:


   That works just like (assuming $hh{'ss'} contains a number):

      $hh{'ss'} = $hh{'ss'} + 1;


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 21 Dec 1998 19:20:38 GMT
From: chazlong@my-dejanews.com
Subject: Re: glob() returns empty list
Message-Id: <75m725$j9q$1@nnrp1.dejanews.com>

i agree about the limited client and function points. there are also
switches in some web servers .conf to disallow indexing, follow links,
and more that might be causing strange CGI behavior in otherwise
ordinary PERL code.

2 additions:
i had a bizarre problem with glob once that was a direct result of
not handling the STDERR. you should look into piping the STDERR (i.e. >&2)
and also look into the features of CARP module. ( the overloaded die() rocks )

second, i believe that it is the very first exercise in the O'Reilley
CGI book ( the mouse i think ) to grab the hash of environmental CGI
variables and display them. if you don't have it then an equally good
investment is Lincoln Stein's book on his CGI.pm module. $20 well spent!
you don't need email from an admin to get the server to cough up the details.

regards,
CHARLES

In article <ebohlmanF4966A.8E3@netcom.com>,
  Eric Bohlman <ebohlman@netcom.com> wrote:
> roger-spamfree@sinasohn.com wrote:
> : I have a CGI script that works fine locally and on a couple of Unix boxen,
> : but when installed in the cgi-bin directory on my server, returns an empty
> : list from the glob() function.
>
> : Icut out everything but the glob() and it runs with no errors, but the
> : glob() doesn't find any files.  Other scripts in the same directory also
> : run fine (but this is my first pgm using glob()).
>
> : The directory is rwxr-xr-x, as is the program.  My ISP has been
> : spectacularly unhelpful (web page coming soon) in even telling me what
> : operating system I'm dealing with.  After nearly a month, they finally
> : admitted that it might be a unix system running BSDi 3.0.
>
> In all the implementations of Perl that I'm aware of, glob() (and the <*>
> operator) works by spawning a separate program (e.g. the shell under Unix)
> to build the list of files.  Is it possible that that program isn't on
> your path, or that the user the HTTP server runs as doesn't have
> permission to execute it (servers often run as extremely "underprivileged"
> users for security reasons)?
>
> Those last two questions are really moot, because you can always use
> opendir(), readdir(), etc. in conjunction with pattern matching and the
> file test operators (and possibly the File::Find module) to build a list
> of filenames without spawning subprocesses.  For a CGI application, this
> will be faster and will reduce server load, as well as be more robust
> (some shells have a limit on the number of filenames they'll glob, whereas
> the do-it-yourself method is limited only by available virtual memory).
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 21 Dec 1998 17:54:31 GMT
From: nguyen.van@imvi.bls.com
Subject: help!!!
Message-Id: <75m20m$f4j$1@nnrp1.dejanews.com>

I got stuck with this CGI script. Following is my script.

___________________________________________________________

#! /opt/net/solaris/bin/perl -w

use CGI;
use CGI::Carp;
use Date::Manip qw(ParseDate UnixDate);
$query = new CGI;
$| = 1; #this is important b/c it autoflush the output. Script hang without it
print "Content-type:text/html\n\n";

#print $query->header;

$event_dir = "/prod_share/eventlog";

read ( STDIN, $request_string, $ENV{'CONTENT_LENGTH'});

( $key, $value ) = split ( /=/, $request_string );
$value =~ s/\+/ /g;
$key =~ s/\+/ /g;
$value =~ s/%([0-9a-fA-F]{2})/pack("C", hex($1))/eg;
$key =~ s/%([0-9a-fA-F]{2})/pack("C", hex($1))/eg;

$view_all = $query->param('see'); $date = ParseDate('$view_all'); #if
(!$date) #{ #  print "Bad date string: $date\n"; #} #else #{  my ($year,
$month, $day) = UnixDate($date, "%Y", "%m", "%d"); #  print
"$year\t$month\t$day\n";  if ( -e "$event_dir/event_log.$month$day$year" )  {
 open ( FROM_EVENT_LOG, "<$event_dir/event_log.$month$day$year") or die "co
uldn't open event_log.$month$day$year: $!\n";  @info = <FROM_EVENT_LOG>; 
$info = join ("", @info);  close (FROM_EVENT_LOG);  @entries =
split(/\*\*NEWENTRY\*\*/, $info);  print "<head><title>DataBase Of Event
Log</title></head>\n";	print "<body bgcolor=lightyellow><br>\n";  foreach
$entry ( @entries )  {	print "$entry";  }  print "</body>\n";	print "<a
href=/vandir/event_log.html onMouseOver=\"window.status='Click H ere To Go
Back To Main Page'; return true;\">Go Back To Main Page</a><br><br>";  print
"<a href=/vandir/event_log_view.html onMouseOver=\"window.status='Cl ick Here
to Go Back to Search Page'; return true;\">Go Back To Search Page</a>";  } 
else  {  print "$event_dir/event_log.$month$day$year doesn't exist\n";	} #}

exit;
______________________________________________________________

what's wrong with my script.

Following is my HTML

______________________________________________________________

<html><head><title>IMVI PRODUCTION EVENT LOG DATABASE</title></head> <body
bgcolor="lightyellow"> <form NAME=eventlogview
ACTION=/cgi-bin/vandir/event_log_view.pl method=POST> <center><strong>Please
Choose Following Two Options</strong></center><hr> <pre>  A)Default To View
Last 10 Entries<br>  B)<strong>"all"</strong> To View all Events<br></pre>
Please enter the request in the box (i.e 2 days ago):<input TYPE=text size=15
NA ME="see"><input type=submit VALUE=Submit><br> </form> <a
href=/vandir/event_log.html onMouseOver="window.status='Click Here To Go Back
 To Main Page'; return true;">Go Back To Main Page</a> </body></html>
______________________________________________________________

Thanks for your help. my input from browser would be something like
2 days ago, 3 days ago, and etc.


Van

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 21 Dec 1998 15:51:11 GMT
From: troy.bull@uni.edu (Troy Bull)
Subject: How do I manually change the value of a hidden text field CGI.pm
Message-Id: <367e6e1d.353171874@news.uni.edu>

I am trying to set a state variable, on the first form it is set to 1
on the second form, I tried to hidden(-name->'state' -default=>'2')
it stays set to one.  It says in the doc, you must manually change it,
my question is how do I manually change it?

Thanks
Troy


------------------------------

Date: Mon, 21 Dec 1998 11:11:20 +0100
From: Martin Steffensen <martin.steffensen@hb.lu.se>
Subject: howto "fool" browser?
Message-Id: <367E1EC8.9FC31217@hb.lu.se>

I am making a shopping system and the problem is this.
I have three frames (lets call them 1,2 and 3) frame 2 shows the content
of the shopping cart and frame 3 cantains links to my buy.cgi script.
The llinks in frame three look like this 
<A HREF="myserver/cgi-bin/buy.cgi?9" TARGET="2">buy produkt nr 9</A>
Now i want the base of frame 2 to be the script show_cart.cgi and not
buy.cgi?9 because then this casues produkt nr 9 to get added to the cart
if i use the reload or forward-back buttons of the browser. I have seen
this on the net but don4t know how to do it. I know I am reinventing the
weel by making a shoppingsystem but i am doing it as A learning
expirience.

Thanks in advance

Martin Steffensen
scrouge@hb.lu.se


har ett problem med mina cgi scripts. min site har tre frames (vi kan
kalla dem 1,2 och 3) frame 2 ska visa innehellet i min varuvagn. frame 3
inneheller en ldnk till handla scriptet med target frame2. ldnken ser ut
se hdr "bla bla/cgi-bin/buy.cgi?9" target=2
Nu vill jag att det som kommer upp i frame 2 ska vara show_cart.cgi och
inte buy.cgi?9 eftersom om jag gvr en reload eller anvdnder back-forward
knapparna se anropas buy.cgi?9


------------------------------

Date: Mon, 21 Dec 1998 11:25:23 -0800
From: "joe chu" <wchu@evodata.net>
Subject: installation error. need help
Message-Id: <367ea1f6.0@jolt.pagesat.net>

hello there,

We had perl 5.00302 on our server. I've upgraded it to version 5.00502.
after the Configure process. then i ran the "make" process but get this
error and stop

 ......
 .........
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1 || /bin/sh -c true
 ../../miniperl "-I../../lib" "-I../../lib" Makefile.PL "INSTALLDIRS=perl"
"LIBPERL_A=libperl.a"
Writing Makefile for B
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command.  <==
false
*** Error code 1

Stop.
make config failed, continuing anyway...
 .....
 .....
Skip ../../lib/B/C.pm (unchanged)
 ../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp  -typemap
 ../../lib/ExtUtils/typemap -typemap typemap B.xs >B.tc && mv B.tc B.c
cc -c  -fpcc-struct-return -O     -DVERSION=\"a5\"  -DXS_VERSION=\"a5\"  -I.
 ./..  B.c
Running Mkbootstrap for B ()
chmod 644 B.bs
LD_RUN_PATH="" ld -o ../../lib/auto/B/B.so  none -L/usr/local/lib B.o
ld: No such file or directory for none
*** Error code 1

Stop.
*** Error code 1

Stop.




i try to use "sh Configure -des".. and then run "make" .. same prob exist

how can i fix it ?

thanks help





------------------------------

Date: Mon, 21 Dec 1998 19:33:55 GMT
From: chazlong@my-dejanews.com
Subject: Re: More: Re: Error when trying to use flock() example from perlfaq5
Message-Id: <75m7r4$k2g$1@nnrp1.dejanews.com>

something to chew on.....
if your Linux is using a NFS schema then flock will never work
much deeper answer in Richard Stevens UNIX network programming

In article <367BF77D.56BF4FA8@entheosengineering.com>,
  Rich Grise <richgrise@entheosengineering.com> wrote:
> Rich Grise wrote:
> >
> >  truncate(FH, 0)
> >          or die "can't truncate numfile: $!";
> >
> > But howcome the code snippet right out of the faq fails?
> >
> > perl, version 5.004_03
> > Slackware Linux 3.3.0, kernel 2.0.30,
> > Server version Apache/1.2.0.
> >
> > TIA :)
>
> There's more: I've done some experiments with this truncate() call,
> and always get an error there. I get "permission denied" on my home
> Linux system, and after reading perlfunc truncate, thought, "Hmmm.."
> uploaded it to my website host, who has
>
>  BSDI BSD/OS 2.1 Kernel #19:
>
> and get:
>
> Invalid argument at ./trunctest.pl line 30.
>
> Does this mean that `truncate()' isn't implemented? If that's
> the case, how can I safely lock and update the file? Fall back
> on the file.lock method? Is there another way to truncate it?
> Would it be safe to
>
> open (FH, "+<numfile") || die $!;
> lock (FH, LOCK_EX) || die $!;
> $num = chomp (<FH>) || die $!;
> seek (FH, 0, 0) || die $!;
> $num++;
> print FH, $num || die $!;
> close (FH) || die $!;
>
> because the updated number will be the same size as or one digit
> longer than the previous one?
>
> (... goes and writes another snippet ...)
>
> Yeah. In-place overwrite. Should work for the main index.html
> update too, since it always grows, right?
>
> Never mind. Thank you for your patience.
> --
> Rich Grise
> richgrise@entheosengineering.com
> (No need to futz with my e-mail: I have a "delete" button!)
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 21 Dec 1998 18:14:21 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Nested sorting
Message-Id: <m1hfup9x9a.fsf@halfdome.holdit.com>

>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:

Uri> 	@sort_list = () ;

Uri> 	foreach $key ( @sort_input ) {


Uri> 		if ( $key =~ /^!(.*)$/ ) {

Uri> 			push( @sort_list, [$key, undef, $1] ) ;
Uri> 		}
Uri> 		else {
Uri> 			push( @sort_list, [$key, $key, undef] ) ;

Uri> 		}
Uri> 	}

Nearly any time I see something of the form:

	for (@one_list) {
		push @another_list, some-func-of-$_;
	}

I instantly think "map belongs here".

So, rewriting your code as a map:

	@sort_list = map {
		/^!(.*)$/ ?
			[$_, undef, $1] :
			[$_, $_, undef]
	} @sort_input;

Of course TIMTOWTDI, but this seems, clearer to me.  And you can stack
it with the other part of what you published just fine to make a truly
normalized Schwartzian Transform.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: Mon, 21 Dec 1998 14:58:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL security problem
Message-Id: <comdog-ya02408000R2112981458290001@news.panix.com>

[follow-ups set to comp.infosystems.www.authoring.cgi]

In article <367E536A.93F6D635@lmco.com>, Jimmy NeSmith <james.r.nesmith@lmco.com> posted:

> I know that due to security problems, using
> PERL as a CGI script will not allow the
> program to write to files that are not world
> writable.  
> 
> Therefore, my script is trying to create a file
> for writing and then use chmod to make the file
> world writable.

[see also Mark-Jason's comments]

your problem is most likely due to the fact that you
can't create the file since the web server user doesn't
have write permissions in that directory.

however, this is not specific to Perl.

-- 
brian d foy                     <brianNOSPAM@NOSPAM.smithrenaud.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
remove NOSPAM or don't.  it doesn't matter either way.


------------------------------

Date: Mon, 21 Dec 1998 18:32:33 GMT
From: wyndo@cxo.com
Subject: Q: is srand(time()); good enough?
Message-Id: <75m482$gt8$1@nnrp1.dejanews.com>

I have a web-based Multiplayer Role-Playing Game (www.lunatix-online.com)
where every day I get a few emails from disgruntled players claiming that the
game is "unfair" giving them only monsters at a certain level (where it
should pick 1 through 12) or other such injustices concerning different
"random" things. I've been through my code and it seems just fine. I'm
picking a number this way, for example:

   $randval = int(rand(12))+1; #this should return an integer 1-12, yes?

The randomize is seeded with seconds-since-epoch once, at the top of the Perl
script, like this:

    srand(time()); #initialize the random generator with seconds-since-epoch

Which I changed (which makes absolutely no difference I would think, except
for being done in an extra step unnecessarily) to:

    $seeder=time;
    srand($seeder);

When I get these complaints, I play the game myself and low and behold it's
pretty much random like I would expect (give or take some, I know this isn't
"truly" random, but with a seed that changes I figured it would be fine).
Then, I email the player back, ask them to actually *write down* the monsters
they're getting, and low and behold it's also pretty much right for them too,
making me think maybe they just had a little bad luck and exaggerated the
severity of it.

I've looked at perldoc perlfaq4 and the random function and searched DejaNews
for previous posts that indicate seeding rand on seconds-since-epoch is fine.
Plus, I can't reproduce their problem, and neither can they it seems, yet
every day I get these complains -- I think they're just having bad luck (out
of dozens of players, only 2 or 3 a day seem to complain).

I guess my only question is, is seeding with time() sufficient? All I really
care is that the first random # generated could potentially be any number in
the range, and that repeated calls to rand() would return a fairly
distributed (give or take) range of randoms. In all my testing, this seems to
be the case. Is there a better seed to use other than time() without using a
module (TrulyRandom, or any other)?

Mike Snyder
Prowler Productions
www.lunatix-online.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 21 Dec 1998 17:54:48 GMT
From: dwang@nature.Berkeley.EDU (Dong Wang)
Subject: rename a large file problem
Message-Id: <75m218$lcu$1@agate.berkeley.edu>

I need to automate a weekly ftp process in the perl script. After 
the file (in .gz format) is ftp'ed, I need to delete the old backup
file and rename the old unzipped file as the backup file and then
unzip the newly received file. The perl script follows:

# before unzip, delete the .bak file first
unlink("oldfile.bak")
|| die("Can't delete the oldfile.bak file.\n");
# rename the oldfile file to oldfile.bak
rename("oldfile", "oldfile.bak") || die("Can't rename oldfile.\n");

# now unzip the files
die("Can't unzip newfile.\n") if `gunzip newfile.gz 2>&1`;

The problem I got is that the script dies after at the rename step. 
oldfile.bak is deleted. And "oldfile" is missing too. Now I have only 
the newfile.gz left. 

What's the cause of this problem? Any suggestions are appreciated.

-Dong Wang



------------------------------

Date: Mon, 21 Dec 1998 11:12:51 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <367DA093.1C7D289F@spider.herston.uq.edu.au>

I read clp.moderated first, modules next, and misc only if I'm in the
mood for the usual Usenet bickering (sometimes I am!) and have time. 
Sometimes moderated is above my head, and sometimes I learn things from
misc.  One thing I have noticed though, the folks on misc seem to have
let their hair down somewhat.  I think everyone is breathing easier with
the dual lists.

-- 
Jaime Metcher.

Larry Rosler wrote:
> 
> With year-end-assessment time rapidly approaching, would anyone care to
> comment on how comp.lang.perl.moderated has performed over its life of
> six months or so, relative to the hopes and expectations of its
> proponents?
> 
> A cost-benefit analysis at this time might be enlightening.
> 
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com


------------------------------

Date: Mon, 21 Dec 1998 19:01:29 GMT
From: chazlong@my-dejanews.com
Subject: Re: Running Perl for Win32 -- Beginner Question
Message-Id: <75m5u8$iaj$1@nnrp1.dejanews.com>

i believe that you are describing two different problems here.
1) you want to run perl from the dos prompt:
disclaimer: i am a UNIX guy
on my windows box i had some problems running dos games under a "dos shell"
and had to instead run them under actual "DOS". i am not really sure what
the difference is, you can search for a more informed source.

2) PERL, i can help here. under a GUI , instead of a command line, your
code will of course display to STDOUT and terminate. you can insert several
things to just make your results visible. simplest might just be a sleep 3;
after your print statement to pause for 3 seconds before execution finishes.
there is always an infinite or prompted loop option.

hope that helps a little,
CHARLES

In article <367d6ca4.3683721@news>,
  homeplate@halostorm.com (Stephen C. Smith) wrote:
> 	I bought a few books yesterday on Perl so I could learn this
> language.  One of them was "Perl for Dummies" (yes, I got the O'Reilly
> books too, so don't give me that look).  In the "Dummies" book was the
> ActivePerl version 5 from ActiveState.  I've gone to AS's Web site and
> updated to the current version for Win32.  (I'm running on Win 95 and
> I've installed DCOM from the Microsoft Web site.)
> 	When I try to run anything, even just a one-line "print"
> statement, the results appear on screen and then the DOS window
> disappears.  I gather that I have to run Perl in a DOS window; but
> when I try to execute Perl from a prompt in a DOS window I get the
> message "Cannot run in MS-DOS mode."  So I run Perl from the Win 85
> explorer, which opens us a DOS window.  But any lines of code I
> execute with Ctrl-Z, the results just flash on the screen and the DOS
> window closes, so I don't really see the results.
> 	How do I get the results to stay on the screen, i.e. the DOS
> window doesn't close?  I've tried all sorts of way to tell Win 95 not
> to close the window on exit, but so far none have worked.
> 	Thanks in advance,
> 	Stephen
>
> Visit the "Anaheim Angels and Lake Elsinore Storm" Web Site
> http://www.halostorm.com
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 21 Dec 1998 19:05:19 +0000 (GMT)
From: dermod@no.spam.leeds.ac.uk
Subject: Re: specify password in a ftp URL?
Message-Id: <367F0C7D.4052@no.spam>

> You can require usernames and passwords via your
> webserver. That way you don't have to manage things
> with your code.  Also, it will be harder for hackers
> to mimic your code by experimenting with the parameters
> to your url.

I agree with your sentiments, but I suggest that you check
the details of what you propose. There is an RFC on the 
subject as well.

Ben.


------------------------------

Date: Mon, 21 Dec 1998 20:21:28 +0100
From: "HJB" <hjbraendle@gmx.net>
Subject: SSL
Message-Id: <nfxf2.488$YD4.22872185@news.randori.com>

Hi,

just before I spending hours on trying this out:
Does ae1 know if and how I can access secure server pages (SSL) via cgi
scripts?
Can I use LWP and the normal functions to access HTML pages?

thy
--
Hans-Juergen




------------------------------

Date: Mon, 21 Dec 1998 12:27:44 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Artoo <r2-d2@REMOVEbigfoot.com>
Subject: Re: Turning Variables into CAPS?
Message-Id: <367E9320.1F1A97DB@email.sps.mot.com>

[copy of this post cc original author]

Artoo wrote:
> 
> Hi all
> 
> I seem to remember a while back on this newsgroup someone was asking about
> tuning variables into Caps.  Can someone remind me about how you turn the
> first letter of a variable into caps and the entire variable into Caps?

try look it up:

   http://www.dejanews.com/home_ps.shtml

-TK


------------------------------

Date: Mon, 21 Dec 1998 12:44:15 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Turning Variables into CAPS?
Message-Id: <367E96FF.72613E73@email.sps.mot.com>

Allan M. Due wrote:
> 
> Artoo wrote in message <75lvhe$89g$1@plug.news.pipex.net>...
> >Hi all
> >
> >I seem to remember a while back on this newsgroup someone was asking about
> >tuning variables into Caps.  Can someone remind me about how you turn the
> >first letter of a variable into caps and the entire variable into Caps?
> 
> One way:
> 
> #!/usr/local/bin/perl -w
> use strict;
> my $variable = 'abcdefghijklmnopqrstuvwxyz';
> my $caps;
> 
> ($caps = $variable) =~ s/(^[a-z])/uc($1)/e;
> print $caps,"\n";
> 
> my $Caps = uc($variable);
> print $Caps;

I checked CPAN but couldn't find a module on case conversion. Is anybody
working on one yet? Just want to make sure before I go ahead.

-TK


------------------------------

Date: Mon, 21 Dec 1998 11:20:44 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Turning Variables into CAPS?
Message-Id: <MPG.10e83f6855ead4489898de@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <75m1v2$qps$1@camel18.mindspring.com> on Mon, 21 Dec 1998 
12:58:58 -0500, Allan M. Due <Allan@due.net> says...
> Artoo wrote in message <75lvhe$89g$1@plug.news.pipex.net>...
> >I seem to remember a while back on this newsgroup someone was asking about
> >tuning variables into Caps.  Can someone remind me about how you turn the
> >first letter of a variable into caps and the entire variable into Caps?
> 
> One way:
> 
> #!/usr/local/bin/perl -w
> use strict;
> my $variable = 'abcdefghijklmnopqrstuvwxyz';
> my $caps;
> 
> ($caps = $variable) =~ s/(^[a-z])/uc($1)/e;
> print $caps,"\n";

Well, yeah, Allan, but you forgot about the function to do that:

  my $caps = ucfirst $variable;
  print $caps;

which has the advantages of handling locale-sensitive letters correctly, 
and is much faster:

#!/usr/local/bin/perl -w
use Benchmark;

$variable = 'abcdefghijklmnopqrstuvwxyz';

timethese(1 << (shift || 0), {
    Cntrl => sub { my $caps = $variable },
    Funct => sub { my $caps = ucfirst $variable },
    Regex => sub { (my $caps = $variable) =~ s/(^[a-z])/uc($1)/e },
});
__END__

Benchmark: timing 262144 iterations of Cntrl, Funct, Regex...
     Cntrl:  1 wallclock secs ( 1.64 usr +  0.00 sys =  1.64 CPU)
     Funct:  1 wallclock secs ( 1.98 usr +  0.00 sys =  1.98 CPU)
     Regex: 12 wallclock secs (12.02 usr +  0.00 sys = 12.02 CPU)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Mon, 21 Dec 1998 14:36:35 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Turning Variables into CAPS?
Message-Id: <75m7m8$71s$1@camel18.mindspring.com>

Larry Rosler wrote in message ...
>[Posted to comp.lang.perl.misc and a copy mailed.]
>
>In article <75m1v2$qps$1@camel18.mindspring.com> on Mon, 21 Dec 1998
>12:58:58 -0500, Allan M. Due <Allan@due.net> says...
>> Artoo wrote in message <75lvhe$89g$1@plug.news.pipex.net>...
>> >I seem to remember a while back on this newsgroup someone was asking
about
>> >tuning variables into Caps.  Can someone remind me about how you turn
the
>> >first letter of a variable into caps and the entire variable into Caps?
>>
>> One way:
>>
>> #!/usr/local/bin/perl -w
>> use strict;
>> my $variable = 'abcdefghijklmnopqrstuvwxyz';
>> my $caps;
>>
>> ($caps = $variable) =~ s/(^[a-z])/uc($1)/e;
>> print $caps,"\n";
>
>Well, yeah, Allan, but you forgot about the function to do that:


Well, I just said one way, I didn't say the best way.  I count on folks like
you for that <g>.

>  my $caps = ucfirst $variable;
>  print $caps;
>
>which has the advantages of handling locale-sensitive letters correctly,
>and is much faster:
>
>#!/usr/local/bin/perl -w
>use Benchmark;
>
>$variable = 'abcdefghijklmnopqrstuvwxyz';
>
>timethese(1 << (shift || 0), {
>    Cntrl => sub { my $caps = $variable },
>    Funct => sub { my $caps = ucfirst $variable },
>    Regex => sub { (my $caps = $variable) =~ s/(^[a-z])/uc($1)/e },
>});
>__END__
>
>Benchmark: timing 262144 iterations of Cntrl, Funct, Regex...
>     Cntrl:  1 wallclock secs ( 1.64 usr +  0.00 sys =  1.64 CPU)
>     Funct:  1 wallclock secs ( 1.98 usr +  0.00 sys =  1.98 CPU)
>     Regex: 12 wallclock secs (12.02 usr +  0.00 sys = 12.02 CPU)
>


Yuck.  Ok, I am convinced.  My way is not one way, it is a bad way.
Fascinating.
Thanks Larry.

AmD

[Posted to comp.lang.perl.misc and a copy mailed per authors example.]





------------------------------

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 4473
**************************************

home help back first fref pref prev next nref lref last post