[13968] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1378 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 15 00:07:24 1999

Date: Sun, 14 Nov 1999 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942642309-v9-i1378@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 14 Nov 1999     Volume: 9 Number: 1378

Today's topics:
    Re: /o in regexp lee.lindley@bigfoot.com
        CGI cookies and Internet Explorer for the Mac <keith.newton@grafica.co.nz>
        GD Perl question <legkaki@hotmail.com>
    Re: Hebrew HTML Clever Converter <reembar@netvision.net.il>
    Re: Help needed fast please <aqumsieh@matrox.com>
    Re: Help with file writing (Brett W. McCoy)
    Re: Help with file writing <expoinfo@globalexpos.co.nz>
    Re: Help with file writing (Brett W. McCoy)
    Re: Help with Stoopid Nutscrape (Netscape) (Abigail)
    Re: Help with Stoopid Nutscrape (Netscape) (Abigail)
        Help: Struggling with fork <zzrhear@pobox.winthrop.edu>
    Re: Help: Struggling with fork <moseley@best.com>
    Re: Help: Struggling with fork <zzrhear@pobox.winthrop.edu>
    Re: How can I determine different "use" statements? <aqumsieh@matrox.com>
        how to use ODBC (or other) to determine data set field  <harasty@my-deja.com>
        I think my install is toast <webqueen@my-deja.com>
    Re: I think my install is toast (Brett W. McCoy)
    Re: localtime object y2k compliant? (Mark W. Schumann)
        Perl interface to SSH? (Neil Cherry)
        Perl Newbie <bs810@torfree.net>
    Re: Protecting a file (Mark W. Schumann)
    Re: Rand Number without the decimals!! (Craig Berry)
    Re: Rand Number without the decimals!! <mhc@Eng.Sun.COM>
    Re: Rand Number without the decimals!! <uri@sysarch.com>
    Re: Re: Rand Number without the decimals!! <expoinfo@globalexpos.co.nz>
    Re: Re: Rand Number without the decimals!! (Martien Verbruggen)
    Re: regular expression riddle <aqumsieh@matrox.com>
    Re: Search & Replace Question... (David Efflandt)
        something like Text::Wrap::wrap() that's HTML aware? (Jed Parsons)
    Re: sort lists together (Abigail)
    Re: sort lists together <uri@sysarch.com>
    Re: System Command <aqumsieh@matrox.com>
        unwanted refresh with Apache server <reembar@netvision.net.il>
        We are looking urgently for 20 x Web Developers!!! <jonwon@catcha.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 15 Nov 1999 04:18:32 GMT
From: lee.lindley@bigfoot.com
Subject: Re: /o in regexp
Message-Id: <80o1io$ga9$1@rguxd.viasystems.com>

Bill Moseley <moseley@best.com> wrote:
:>I converted a CGI script to a mod_perl script and had to remove some /o 
:>from regexps.

:>The regexps only need to get built once per execution, so it was good to 
:>use them in CGI where the script runs and exits.  The expressions are 
:>based on data from that request and changes with each request to the CGI 
:>script.  Thus, in mod_perl the script doesn't exit, so I can't use /o.

:>Short of eval'ing the entire script, is there a way I could tell perl to 
:>recompile all the /o expressions?

Use qr{} to build the regexp outside the loop.  

Is there ever a time when /o would have a meaning for a regexp
built with the qr operator?  I can't see one.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Mon, 15 Nov 1999 14:45:15 +1300
From: Keith Newton <keith.newton@grafica.co.nz>
Subject: CGI cookies and Internet Explorer for the Mac
Message-Id: <382F65AB.7757EAFF@grafica.co.nz>

Hi all, I hope this question hasn't been asked many times before, but I
am writing some stuff that issues a cookie.

Windows and unix seem to be fine, but some macs won't take the cookies
and some will, their seems to be no rhyme or reason behind what does and
what doesn't.

This problem only seems to occur with Macintosh I.E..

Does anyone have any Idea?

This code is used


use CGI;
my $query = new CGI;
my $cookie = $query->cookie(-name=>'CERT',
                    -value=>$row3[0],
                    -expires=>'+1h',
                    -path=>'');
print $query->header(-cookie=>$cookie);

This is the guts of the cookie code that I am using.

Any ideas would be appreciated.

Thanks in advance, Keith Newton



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

Date: Mon, 15 Nov 1999 09:59:06 +0800
From: "legkaki" <legkaki@hotmail.com>
Subject: GD Perl question
Message-Id: <382f6a09.0@news.tm.net.my>

Hi!

I am using the GD module to create GIF on the fly.

I am able to generate the image file , but when I save the images
with by browser it, default to Bitmap (BMP format).

Can anyone advise on this.

Thanks

Dave..




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

Date: Mon, 15 Nov 1999 05:37:42 +0200
From: Re'em Bar <reembar@netvision.net.il>
To: olkina@my-deja.com
Subject: Re: Hebrew HTML Clever Converter
Message-Id: <382F8006.DAD1193F@netvision.net.il>

I believe that if you choose the logical standard you can use a English
convertor as well, because you don't have to flip the Hebrew letters,
which is the only difference.
here goes another site I won't be able to watch with my Netscape :^)
-- 
Re'em
http://snark.co.il



olkina@my-deja.com wrote:
> 
> Looking for clever Perl or Java engine that can convert Hebrew texts
> into HTML-logical files.
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


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

Date: Sun, 14 Nov 1999 17:10:33 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Help needed fast please
Message-Id: <x3yln80rag6.fsf@tigre.matrox.com>


tadmc@metronet.com (Tad McClellan) writes:

>    Being of feeble mind, I throw as many reminders at myself
>    as possible, so I usually use
> 
>       q''
> 
>    for the empty string, instead of '' .

Sorry Tad, but to me this looks VERY confusing. There is still a
possibility that the double single quotes would look like a single
double quote :-). Since I use CPerl mode
in Emacs, I can easily see where my strings start and end. But, if I
am using another editor, like vi, I would usually do:

	q();

Now that, to me at least, is unambiguous.

--Ala



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

Date: Sun, 14 Nov 1999 23:05:26 GMT
From: bmccoy@news.lan2wan.com (Brett W. McCoy)
Subject: Re: Help with file writing
Message-Id: <slrn82uggf.m51.bmccoy@dragosani.lan2wan.com>

Also sprach Andrew Broadley <expoinfo@globalexpos.co.nz>:

>My script makes the file...
>
>but on my local machine it works.. and writes fine into the file
>
>but when its on a remote server (unix) it creates the file.. but does
>not write to it!!

And what script would this be?  Details, man, details!

BTW, a sig file that is bigger than the text of your message is considered
bad form (especially with embedded XML or whatever it is).  You should
limit your signature to 4 lines.

-- 
Brett W. McCoy           
                                        http://www.lan2wan.com/~bmccoy/
-----------------------------------------------------------------------
Leveraging always beats prototyping.


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

Date: Mon, 15 Nov 1999 12:15:01 +1300
From: Andrew Broadley <expoinfo@globalexpos.co.nz>
Subject: Re: Help with file writing
Message-Id: <382F4275.D5989122@globalexpos.co.nz>

Well its a Perl question.. otherwise i would have posted it in somewhere
else eh ?

Seshadri Sriperumbudur wrote:

> Andrew Broadley wrote:
>
> > Hi,
> >
> > My script makes the file...
> >
> > but on my local machine it works.. and writes fine into the file
>
> > but when its on a remote server (unix) it creates the file.. but does
> > not write to it!!
> >
>
> What's this? Is this a CGI question? Or a perl question... what IS it?
>
> >
> > any ideas ?
> >
> > E-mail me on my cellphone:
> >
> > 0212956648@messagetracker.co.nz
> >
> >
>
> Oh yeah, sure!

--
<x-rich>Thanks,


Andrew Broadley

Information Technology

GLOBAL EXPOS (NZ) LIMITED


http://www.globalexpos.co.nz

<italic>"Better business using the power of the Internet

and the face-to-face advantage of exhibitions"

</italic>

E-mail me on my cellphone:

0212956648@messagetracker.co.nz

           (max <bold>146</bold> characters)


</x-rich>




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

Date: Mon, 15 Nov 1999 03:22:47 GMT
From: bmccoy@news.lan2wan.com (Brett W. McCoy)
Subject: Re: Help with file writing
Message-Id: <slrn82uvj7.moe.bmccoy@dragosani.lan2wan.com>

Also sprach Andrew Broadley <expoinfo@globalexpos.co.nz>:

>Well its a Perl question.. otherwise i would have posted it in somewhere
>else eh ?

You need to give more information (far more information) then just "My
script doesn't work on a remote machine, but it does on mine".  Pasting in
the offending piece of code, for instance, is probably the best thing you
can do.  And does the beginning of your script look something like this:

#!/usr/bin/perl -w

use strict;
use diagnostics;

You'd be suprised just how much Perl itself can tell you what you've done
wrong, if you let it.

-- 
Brett W. McCoy           
                                        http://www.lan2wan.com/~bmccoy/
-----------------------------------------------------------------------
Too many people are thinking of security instead of opportunity.  They seem
more afraid of life than death.
		-- James F. Byrnes


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

Date: 14 Nov 1999 22:00:53 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Help with Stoopid Nutscrape (Netscape)
Message-Id: <slrn82v1i5.cvu.abigail@alexandra.delanet.com>

Andrew Broadley (expoinfo@globalexpos.co.nz) wrote on MMCCLXVI September
MCMXCIII in <URL:news:382F1E7F.8DAB1C30@globalexpos.co.nz>:
?? Too true bout netscape, it does tighten up my lazy coding :o) best HTML
?? debugger I ever met :o)

Please don't post Jeopardy style, and kill the 28 line sig!

?? E-mail me on my cellphone:
?? 0212956648@messagetracker.co.nz


Consider yourself Cc'ed on that address.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 14 Nov 1999 22:04:12 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Help with Stoopid Nutscrape (Netscape)
Message-Id: <slrn82v1od.cvu.abigail@alexandra.delanet.com>

Abigail (abigail@delanet.com) wrote on MMCCLXVII September MCMXCIII in
<URL:news:slrn82v1i5.cvu.abigail@alexandra.delanet.com>:
"" Andrew Broadley (expoinfo@globalexpos.co.nz) wrote on MMCCLXVI September
"" MCMXCIII in <URL:news:382F1E7F.8DAB1C30@globalexpos.co.nz>:
"" 
"" ?? E-mail me on my cellphone:
"" ?? 0212956648@messagetracker.co.nz
"" 
"" Consider yourself Cc'ed on that address.


$ nslookup -type=mx messagetracker.co.nz
Server:  dns01.delanet.com
Address:  208.9.136.82

*** dns01.delanet.com can't find messagetracker.co.nz: Non-existent host/domain
$


Great. A 28 line sig, and it contains bogus information.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 15 Nov 1999 00:09:17 +0000
From: "Ryan T. Rhea" <zzrhear@pobox.winthrop.edu>
Subject: Help: Struggling with fork
Message-Id: <382F4F2C.3019E682@pobox.winthrop.edu>

I'm having a bit of a hard time figuring out the details in using
system(),exec(),fork(), and wait.  Perl guru is needed!

I'm trying to start a new process out of perl, and then after that new
process starts, kill the parent process (perl).  Specifically, the new
process is a shell of the user's choice.  Here is a snip...

open(SHELLS,"/etc/shells") || die "\nbad computer: something is very
wrong!\n";  #get list of shells
$number = 0;
while (<SHELLS>) {
    chop;
    ($bs,$bs,$shellname) = split(/\//);      #just take the shell name,
drop /bin/
    $shells[$number]=$shellname;
    write;                                                    #write to
table...
    $number++;
}

format STDOUT =
@<<<<<< @
$shellname,$number
 .

format STDOUT_TOP =

=====   =
 .

print "\n$name, enter the number of the shell i should run > ";
$shell = <STDIN>;
chop($shell);
if ($shell eq "") {
    $shell = 0;
    print "\nno value entered, assuming bash...\n";
}

unless(fork) {
    print "$shells[$shell] started!\n";
    exec("/bin/$shells[$shell]");
}
wait;

So this starts bash (or whatever other shell is chosen) as a new
process, but when I look at the running processes, I see my perl script
is still running.  The new process (bash) and the other processes
started by my perl script (including a net connection) all die if I kill
the perl script manually.   I should note that my script (called secure)
is meant to run as a shell (sort of) from '/etc/passwd.'  Basically it
replaces the shell when certain users login, runs some basic
authentication tasks, connects to the network, mounts a loopback device,
then continues with bash.  Here is the relevant part of 'ps -e':

14249 tty1     00:00:50 secure
14277 tty1     00:00:00 ifup-ppp
14290 tty1     00:00:00 pppd
14333 tty1     00:00:00 bash

So, I don't want to see secure in this list when bash is up.  How do I
prevent the child processes from going down when secure is killed?

Thanks for dispelling confusion!
Ryan T. Rhea
Winthrop University
rhear@cs.winthrop.edu




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

Date: Sun, 14 Nov 1999 16:47:56 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: Help: Struggling with fork
Message-Id: <MPG.1298f817de2e2702989877@nntp1.ba.best.com>

Ryan T. Rhea (zzrhear@pobox.winthrop.edu) seems to say...
> I'm trying to start a new process out of perl, and then after that new
> process starts, kill the parent process (perl).

perldoc perlipc has a section on this:

"Complete Dissociation of Child from Parent"

There's also the double-fork method where the process becomes a child of 
init (Process ID 1), but I've never tried that.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Mon, 15 Nov 1999 03:13:01 +0000
From: "Ryan T. Rhea" <zzrhear@pobox.winthrop.edu>
Subject: Re: Help: Struggling with fork
Message-Id: <382F7A3C.86D16A04@pobox.winthrop.edu>

Ah, yes.  Looking at the perlipc man pages helped... thanks.

Ryan




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

Date: Sun, 14 Nov 1999 17:48:57 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How can I determine different "use" statements?
Message-Id: <x3yk8nkr8o6.fsf@tigre.matrox.com>


hookman <hookman@cwnet.com> writes:

> BEGIN gets called when the script first starts...

Not exactly. BEGIN subroutines get called during compilation of your
program. That is before your program actually started executing.

--Ala



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

Date: Mon, 15 Nov 1999 03:09:45 GMT
From: Dan Harasty <harasty@my-deja.com>
Subject: how to use ODBC (or other) to determine data set field types?
Message-Id: <80nthn$70g$1@nnrp1.deja.com>

I have a written a program that can select a SQL recordset then,
ignoring the data, determine all the fieldnames, fieldtypes, and
fieldsizes (e.g. INT or VARCHAR(12)).  From that I can do a variety of
fun things, like make an ad-hoc CREATE TABLE query to recreate the table
in a different database...

UNFORTUNTATELY, I did this in Visual Basic... and I would like to
recreate it in a Perl script, using Win32::ODBC (or any other means).  I
see that Win32::ODBC::fieldnames() can get me the fieldnames, but I
can't figure out how to get the fieldtypes/fieldsizes.  If I'm supposed
to use ColAttributes(), I can't figure out how to coax this info out of
it.

Can anyone point me in the right direction?  Thanks.

- Dan Harasty


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 15 Nov 1999 03:12:23 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: I think my install is toast
Message-Id: <80ntml$79k$1@nnrp1.deja.com>

 I installed RH6.1 and have been running it OK for like 2 weeks, but the
system locked up twice on my last week and each time it told me to run
fsck on the filesystem. It found a mess of errors and (corrected?) them.

Now I can't even get into runlevel 5- it goes into a monitor loop where
it continues cycles the monitor to illegal values, and I can't see anyh
display. I managed to get into runlevel 3.

I went to /etc to look for an XF86Config, and ls shows it there. However
when I more it, the filesystem says its not there.

Would re-runing the upgrade from CD fix these problems?

HUG,
WQ

--
Time is nature's way of preventing everything from happening at once.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 15 Nov 1999 03:27:01 GMT
From: bmccoy@news.lan2wan.com (Brett W. McCoy)
Subject: Re: I think my install is toast
Message-Id: <slrn82uvr4.moe.bmccoy@dragosani.lan2wan.com>

Also sprach webqueen, queen of the web <webqueen@my-deja.com>:

> I installed RH6.1 and have been running it OK for like 2 weeks, but the
>system locked up twice on my last week and each time it told me to run
>fsck on the filesystem. It found a mess of errors and (corrected?) them.
>
>Now I can't even get into runlevel 5- it goes into a monitor loop where
>it continues cycles the monitor to illegal values, and I can't see anyh
>display. I managed to get into runlevel 3.
>
>I went to /etc to look for an XF86Config, and ls shows it there. However
>when I more it, the filesystem says its not there.
>
>Would re-runing the upgrade from CD fix these problems?

I think you want comp.os.linux.setup, not comp.lang.perl.misc.

-- 
Brett W. McCoy           
                                        http://www.lan2wan.com/~bmccoy/
-----------------------------------------------------------------------
DON'T go!!  I'm not HOWARD COSELL!!  I know POLISH JOKES ... WAIT!!
Don't go!!  I AM Howard Cosell! ... And I DON'T know Polish jokes!!


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

Date: 14 Nov 1999 18:06:12 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: localtime object y2k compliant?
Message-Id: <80nf94$hpm@junior.apk.net>

In article <89oV3.54785$23.2047035@typ11.nn.bcandid.com>,
Kragen Sitaker <kragen@dnaco.net> wrote:
>I don't find CGI.pm particularly ugly, myself, but it is undeniably
>big.  In many cases, compiling CGI.pm takes longer than the rest of the
>transaction, including starting Perl, opening the HTTP connection,
>etc.

Right, but then you have FastCGI.

It's not an all-Perl solution, naturally, but it does the right thing
and lets you use your Perl code efficiently with little pain.



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

Date: Mon, 15 Nov 1999 04:31:15 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: Perl interface to SSH?
Message-Id: <slrn82v33v.655.njc@dmc.uucp>

Is there a Perl interface/module which permits access to the SSH
protocols?

-- 
Linux Home Automation           Neil Cherry             ncherry@home.net
http://members.home.net/ncherry                         (Text only)
http://meltingpot.fortunecity.com/lightsey/52           (Graphics GB)



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

Date: Mon, 15 Nov 1999 03:54:08 GMT
From: TD <bs810@torfree.net>
Subject: Perl Newbie
Message-Id: <382F8414.3C038111@torfree.net>

Hi every body!  I would like to write a perl script that check for the
process (ex. pine, pico etc.) that a user currently running and see if
the user has go over the time limit then send him/her a reminder
e-mail.  (The program will check for every 30 sec.)  I don't know how to
extract the time of a certain process and how would I write the script
that will send e-mail automatically?  Can someone help me?  Thanks!


Here is what I have so far

#!/usr/bin/perl -w

print "Please choose the campus which you want to monitor\n";
print " Davis = 1, Trafalgar =2 \n";
$choice = <>;
chomp $choice;

if ($choice == 1){
   @davis = `w | grep br-`;
   print "Enter the task you want to monitor.\n";
   print "1. Pine, 2. Talk\n";
   $task = <>;
   chomp $task;

   if ($task == 1){
      @pine = grep (/pine/, @davis);
      foreach (@pine){
         print $_;
      }

         print $_;
      }
   }
   else{
      @talk = grep (/talk/, @davis);
      foreach (@talk){
         print $_;
      }
   }
}

else{
   @oakville = `w | grep oa-`;
   print "Enter 1 to monitor Pine and 2 for Talk\n";
   $task = <>;
   chomp $task;
   if ($task == 1){
      @pine = grep (/pine/, @oakville);
      foreach (@pine){
         print $_;
      }
   }
   else{
      @talk = grep (/talk/, @oakville);
      foreach (@talk){
         print $_;
      }
   }

}


--
TD


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

Date: 14 Nov 1999 18:09:10 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Protecting a file
Message-Id: <80nfem$icl@junior.apk.net>

In article <3826313C.7189@mendonet.com>,
Jon Hollcraft  <webmaster@mendonet.com> wrote:
>D.  Plunk in what I've coined a trapdoor.  Save the meta below as
>index.html and stash it in directorys where you want to divert snoops. 
>Other URI's can be pretty creative.  This one just shows the browser
>machine's c: drive.
> 
><meta http-equiv="Refresh" content="0; URL=file:///C:/">

Oh.

[pause]

Yeah, that will definitely work across all browsers and operating
environments.



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

Date: Sun, 14 Nov 1999 23:25:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Rand Number without the decimals!!
Message-Id: <s2uh6lgshsq32@corp.supernews.com>

Andrew Broadley (expoinfo@globalexpos.co.nz) wrote:
: I cant seem to get $ENV{'REMOTE_HOST'}; on my script anymore.. in Unix
: or Win32 ?!?! any ideas why ? i need it for a temp file... but if i cant
: figure out.. ill use the random number in the temp files instead..

This isn't a Perl issue.  Presumably it has something to do with your
server config or your users.  But note that you should never ever write a
CGI app that does anything critical with values like REMOTE_HOST.  They're
not always there, and when they are, they're not always accurate.

: I was just wondering how to make a random number in perl without the
: Decimals ?!?!?

  $x = int rand 6;   # Random integer 0-5

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 14 Nov 1999 17:08:33 -0800
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Rand Number without the decimals!!
Message-Id: <8p61z9s7e9a.fsf@Eng.Sun.COM>

Andrew Broadley <expoinfo@globalexpos.co.nz> writes:

> Hi y'all,
> 
> Two problems,
> 
> I cant seem to get $ENV{'REMOTE_HOST'}; on my script anymore.. in Unix
> or Win32 ?!?! any ideas why ? i need it for a temp file... but if i cant
> figure out.. ill use the random number in the temp files instead..

That just means it isn't being set.  Hard to say why that is...

> and...
> 
> I was just wondering how to make a random number in perl without the
> Decimals ?!?!?

Use the int() function to truncate it.  E.g. to get a random int
between 1 and 6 inclusive, use

        1 + int(rand(6))

Too bad "perldoc -f rand" doesn't say anything about this; it seems 
to be a very common question.

-mike


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

Date: 14 Nov 1999 23:44:54 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Rand Number without the decimals!!
Message-Id: <x7r9hswegp.fsf@home.sysarch.com>

>>>>> "MV" == Martien Verbruggen <mgjv@comdyn.com.au> writes:

  MV> On Mon, 15 Nov 1999 12:19:16 +1300,
  MV> 	Andrew Broadley <expoinfo@globalexpos.co.nz> wrote:

  >> Yes its for a tmp file, but I just ended up using a random number
  >> so the file was like this:
  >> 
  >> kwh-02312379079123213
  >> 
  >> made the digit so large that the tmp file should never (in theory) repeat
  >> itself, and its deleted once it has been used... so the possibility is low
  >> (but miracles do happen .. especially the bad ones liek this to me :oP)

  MV> Well... In _theory_ the number will repeat itself, and there's a
  MV> slught chance that it will happen during the life time of one of those
  MV> sessions. In _practice_ that chance may be negligible.

in practice it probably isn't negligible. perl's default rand (from
unix) generates only 16 bits and is notoriously poor in its distribution
and has other problems. when you build perl (i think 5.6 will have this)
you can select which rans subsystem to use (rand48 or random). in any
case relying on random numbers for uniqueness is foolish and murphy will
strike down with great veangence upon those that seek to taunt him with
such gambling.

from random(3):

     The random() and srandom() functions have (almost) the  same
     calling sequence and initialization properties as rand() and
     srand() (see rand(3C)). The difference is that rand(3C) pro-
     duces  a  much  less  random sequence-in fact, the low dozen
     bits generated by rand go through a cyclic pattern. All  the
     bits generated by random() are usable. For example,

  MV> If you combine it with the process id, the chance gets even smaller.

there are better ways to generate temp files. if they are all within a
single process, a sequence number (mktemp) is fine. among multiple
processes, a locked file with a sequence number is good. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Mon, 15 Nov 1999 12:19:16 +1300
From: Andrew Broadley <expoinfo@globalexpos.co.nz>
Subject: Re: Re: Rand Number without the decimals!!
Message-Id: <382F4374.21337DE9@globalexpos.co.nz>


Thanks :o)

Yes its for a tmp file, but I just ended up using a random number so the file
was like this:

kwh-02312379079123213

made the digit so large that the tmp file should never (in theory) repeat
itself, and its deleted once it has been used... so the possibility is low
(but miracles do happen .. especially the bad ones liek this to me :oP)

Thanks again

David Efflandt wrote:

> On Mon, 15 Nov 1999 09:48:06 +1300, Andrew Broadley
> <expoinfo@globalexpos.co.nz> wrote:
> >
> >Two problems,
> >
> >I cant seem to get $ENV{'REMOTE_HOST'}; on my script anymore.. in Unix
> >or Win32 ?!?! any ideas why ? i need it for a temp file... but if i cant
> >figure out.. ill use the random number in the temp files instead..
>
> Most servers skip DNS lookup (faster) unless they have to.  I don't know
> if this works in Windows, but for Unix you can typically use the process
> ID for a unique temporary file extension (at least until the computer
> reboots), like filename.$$
>
> >I was just wondering how to make a random number in perl without the
> >Decimals ?!?!?
>
> Add 1 to the range you want and turn the result into an integer.  But note
> that (random ne unique).  It may be rare for the same number to come up
> twice in a row, but it can happen.  It's a crap shoot.
>
> --
> David Efflandt  efflandt@xnet.com  http://www.xnet.com/~efflandt/
> http://www.de-srv.com/  http://cgi-help.virtualave.net/
> http://thunder.prohosting.com/~cv-elgin/



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

Date: Mon, 15 Nov 1999 01:50:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Re: Rand Number without the decimals!!
Message-Id: <xFJX3.197$zg7.5940@nsw.nnrp.telstra.net>

On Mon, 15 Nov 1999 12:19:16 +1300,
	Andrew Broadley <expoinfo@globalexpos.co.nz> wrote:

> Yes its for a tmp file, but I just ended up using a random number so the file
> was like this:
> 
> kwh-02312379079123213
> 
> made the digit so large that the tmp file should never (in theory) repeat
> itself, and its deleted once it has been used... so the possibility is low
> (but miracles do happen .. especially the bad ones liek this to me :oP)

Well... In _theory_ the number will repeat itself, and there's a
slught chance that it will happen during the life time of one of those
sessions. In _practice_ that chance may be negligible.

If you combine it with the process id, the chance gets even smaller.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Sun, 14 Nov 1999 17:53:45 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: regular expression riddle
Message-Id: <x3yiu34r8g6.fsf@tigre.matrox.com>


Re'em Bar <reembar@netvision.net.il> writes:

> I want to change any word so it begins with CAPS
> the little rabbit => The Little Rabbit
> hope it's not in the FAQ too...

You hope it's not in the FAQ? And why is that? Why didn't you check?
It is in the FAQ, but your attitude prevents me from pointing the
correct place for you.

> also, excuse my ignorance, but is there a way to pass more then one
> array to a subroutine, not into the @_?

Yes. The answer is in the docs. And in the FAQs.

I hope you don't find the FAQs.

--Ala



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

Date: 14 Nov 1999 23:19:24 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Search & Replace Question...
Message-Id: <slrn82ugrr.ll.efflandt@efflandt.xnet.com>

On Sun, 14 Nov 1999 10:41:25 GMT, Kazz <kazz@ashernet.net> wrote:
>Say I have a tag to replace that I know begins with "<body" and I want
>to replace everything to the ">" end of that tag. Actually, I want to
>prepend a scalar to it but want to make sure what I'm adding isn't
>added until the end of the tag... what's the best way?
>$line =~ s/<body .. >/<body .. >$morestuff/gi;   ??

What if the <body> tag is broken across more than one line?  If you had
the whole file appended into $lines you could do:

$lines =~ s/(<body[^>]*>)/$1$morestuff/si;


-- 
David Efflandt  efflandt@xnet.com  http://www.xnet.com/~efflandt/
http://www.de-srv.com/  http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/


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

Date: 15 Nov 1999 04:16:24 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: something like Text::Wrap::wrap() that's HTML aware?
Message-Id: <80o1eo$2mg$1@agate.berkeley.edu>

Is there anything like Text::Wrap::wrap() out there that knows how to
overlook HTML markup (not count it as text, not break lines in the middle
of attribute lists, etc.)?

Thanks muchly,

Jed

-- 
Jed Parsons                http://socrates.berkeley.edu/~jed/
(Jed's another Plautus hack?)       jed@socrates.berkeley.edu
-------------------------------------------------------------
grep(do{for(ord){$S+=$_&7;grep(vec($s,+$S++,1)=1,5..$_>>3)}},


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

Date: 14 Nov 1999 21:51:52 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: sort lists together
Message-Id: <slrn82v116.cvu.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCCLXVI September MCMXCIII in
<URL:news:x7d7tdx8p0.fsf@home.sysarch.com>:
 .. >>>>> "A" == Abigail  <abigail@delanet.com> writes:
 .. 
 ..   A>     my @indx        = sort  {$age [$a] <=> $age [$b]} 0 .. $#age;
 ..   A>     my @sorted_age  = @age  [@indx];
 ..   A>     my @sorted_name = @name [@indx];
 .. 
 .. also you should label that (and larry should too) as an index sort. it
 .. is where you actually sort indexes of your data so you can use the
 .. sorted resulted to order multiple sets or order a set that can't be
 .. sorted directly (such as array or hash refs in the GRP sort).

I'm not really happy with the name "index sort". Usually, "foo sort"
means that "foo" relates to the sorting algorithm, as in "mergesort",
"heapsort", "insertion sort", "Shell sort", etc.

But this "index sort" is still a form of "quick sort".

It's the same with "GRP sort". GRP doesn't change the sorting algorithm;
it's still "quick sort". Perhaps "GRP transform", in the line of
"Schwartzian transform" would be a better name.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 14 Nov 1999 23:37:28 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: sort lists together
Message-Id: <x7u2mowet3.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> Uri Guttman (uri@sysarch.com) wrote on MMCCLXVI September MCMXCIII in
  A> <URL:news:x7d7tdx8p0.fsf@home.sysarch.com>:

  A> .. also you should label that (and larry should too) as an index sort. it
  A> .. is where you actually sort indexes of your data so you can use the
  A> .. sorted resulted to order multiple sets or order a set that can't be
  A> .. sorted directly (such as array or hash refs in the GRP sort).

  A> I'm not really happy with the name "index sort". Usually, "foo sort"
  A> means that "foo" relates to the sorting algorithm, as in "mergesort",
  A> "heapsort", "insertion sort", "Shell sort", etc.

  A> But this "index sort" is still a form of "quick sort".

index sort is the well known name for that variation/transform. the
underlying sort algorithm gets its own name. you can do an index sort
with quick, bubble, shell, etc., sorts. so take your complaint up with
the sort algorithm textbooks and academia.

  A> It's the same with "GRP sort". GRP doesn't change the sorting algorithm;
  A> it's still "quick sort". Perhaps "GRP transform", in the line of
  A> "Schwartzian transform" would be a better name.

i agree that we didn't invent a new sort algorithm, just a way to make
perl's sort run faster in some cases. but forcing foo sort to only mean
a sort algorithm is not needed. on the other hand, to associate the GRP
with the schwartzian transform is a good idea as it will show that
our idea is just another way to process the sort data to improve the run
time.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sun, 14 Nov 1999 18:43:28 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: System Command
Message-Id: <x3yhfior65c.fsf@tigre.matrox.com>


"Kastro Vinic" <kastrovinic@hotmail.com> writes:

> What is the ` doing.
> eg. $out = `dir`;
> is this like a system() command?

Backticks are documented in perlop. Look for qx//.

HTH,
--Ala



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

Date: Mon, 15 Nov 1999 05:50:22 +0200
From: Re'em Bar <reembar@netvision.net.il>
Subject: unwanted refresh with Apache server
Message-Id: <382F82FE.FADB5DCA@netvision.net.il>

I would have raised the subject in a more appropriate newsgroup, but it
seems all the experts are here :)

my site host use Apache server on Linux.
when I view a not-cached page with Netscape4.6, it tends to refresh just
after loading. this sometimes disable a javascript program I starts
onload()
this refresh didn't occur on a test account I did at virtualave.net, but
I did experience such a thing in geocities.

could someone guess the cause to it?
-- 
Re'em
http://snark.co.il


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

Date: Mon, 15 Nov 1999 09:09:09 +0800
From: "John Wong" <jonwon@catcha.com>
Subject: We are looking urgently for 20 x Web Developers!!!
Message-Id: <80nmpt$19r$1@clematis.singnet.com.sg>



If you are in Singapore or Malaysia, check this out!!

We are looking urgently for 20 x Web Developers!!!

High salary with benefits package!!!

Here is what you need:

If you enjoy developing web applications,
database applications and interactive
applications on the web, here is the job
for you!!

With 1-2 years related web programming experience,
well-versed in the following, C++, Java Programming,
CGI, Perl, MySQL, PHP, Oracle, Unix and Apache.
You must be internet-savvy, able to work long hours.

Diploma holders are encouraged to apply.
Students on holiday are encouraged to apply too.

If you are working now, we can negotiate to pay
your annual bonus.

Drop John a call at (65)733 6166 anytime NOW to
arrange for an interview.  Hope to hear from you.

If you need to find out about us,
check out our web site @
http://www.catcha.com/pr.htm



--
+++++++++++++++++++++++
John Wong
CTO
Catcha.com
Phone: 65 733 6166
Fax: 65 733 0915
HP: 65 9655 2247

www.catcha.com.sg
Singapore's No.1 Local Search Engine Portal
+++++++++++++++++++++++




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 1378
**************************************


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