[8684] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2301 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 11 22:07:29 1998

Date: Sat, 11 Apr 98 19:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 11 Apr 1998     Volume: 8 Number: 2301

Today's topics:
    Re: ANSI Colour in Perl (Abigail)
    Re: environnemt variables <ppp-support@canelle.telecom.uqam.ca>
    Re: environnemt variables (brian d foy)
    Re: environnemt variables <ppp-support@canelle.telecom.uqam.ca>
    Re: environnemt variables (Abigail)
    Re: Excessive (?) Memory Usage with Large Database (Kenneth Herron)
    Re: General Rudeness, e.g. Re: Need a web login script (Abigail)
    Re: How to get only 2 decimal notation? <smubit1@gl.umbc.edu>
    Re: How to get only 2 decimal notation? (I R A Aggie)
    Re: How to get only 2 decimal notation? <Russell_Schulz@locutus.ofB.ORG>
    Re: I need to delete temp files after 24 hours... <kupid@ecom.net>
    Re: I need to delete temp files after 24 hours... <eugene@vertical.net>
    Re: MacPerl Book Online in HTML <gwynne@utkux.utk.edu>
    Re: making second option available? <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
    Re: Numeric validation (brian d foy)
    Re: Numeric validation (Matthew Cravit)
    Re: Numeric validation (Craig Berry)
    Re: Numeric validation <ppp-support@canelle.telecom.uqam.ca>
    Re: Numeric validation <ppp-support@canelle.telecom.uqam.ca>
    Re: Packing? <skippy@anemaildomain.com>
        perl on SCO-Unix <t.maekitalo@eckpart.de>
        Q: Getting the browsers local time? (Drake Cleary)
    Re: Q: Getting the browsers local time? <flavell@mail.cern.ch>
    Re: Q: I need to delete temp files after 24 hours... <lr@hpl.hp.com>
        Question about Reference to Hash (Walt Stoneburner)
    Re: Reporting Module for Perl <gwynne@utkux.utk.edu>
        Script URL <watkins@mailexcite.com>
        To keep Text from Wrapping <kupid@ecom.net>
    Re: unpack vs. substr (was Re: Data Structure for Input (Mark-Jason Dominus)
    Re: Week of Month (I R A Aggie)
    Re: Week of Month (Robert F. Harrison)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Apr 1998 01:12:30 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: ANSI Colour in Perl
Message-Id: <6gp4du$rqt$2@client2.news.psi.net>

Karl Hanmore (avatar@ultra.net.au) wrote on MDCLXXXIV September MCMXCIII
in <URL: news:892294417.351756@terra.ultra.net.au>:
++ G'Day,
++ 	I was wondering if anyone knows of any code / modules for printing
++  ANSI colour in Perl.  I have had a snoop through CPAN to no avail, and I
++  really want to avoid re-inventing the wheel.   Anyone got any ideas? 

Uhm, what is wrong with 'print' ?

++  If so, can you email me, as I rarely have time to read newsgroups :)

If you don't have time to read the groups, don't bother to ask.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: Sat, 11 Apr 1998 21:43:53 GMT
From: ppp-support <ppp-support@canelle.telecom.uqam.ca>
Subject: Re: environnemt variables
Message-Id: <352FE305.BB6A70B5@canelle.telecom.uqam.ca>

If your server support SSI (Server Side Include) You can call your script
by
<!-- exec cgi="scriptname.cgi" -->

Rene

Francois-Xavier.bor@bde.espci.fr wrote:

> hi !
>
> i would like to call a perl script each time someone looks my webpage
> (in order the perl script get the IP adress of everyone; that way , i
> would be able to write a hitcounter script ). my problem is not so
> much the perl script (Randal Schwartz give its own on line if i need
> help) but what should i put in my html page to call the perl script. I
> am looking something like <Applet> but for perl instead for java.





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

Date: Sat, 11 Apr 1998 19:44:35 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: environnemt variables
Message-Id: <comdog-ya02408000R1104981944350001@news.panix.com>
Keywords: from just another new york perl hacker

In article <352FE305.BB6A70B5@canelle.telecom.uqam.ca>, ppp-support <ppp-support@canelle.telecom.uqam.ca> posted:

>If your server support SSI (Server Side Include) You can call your script
>by
><!-- exec cgi="scriptname.cgi" -->

must be a wierd server that groks comments like that.  for correct
information on Server Side Includes go right to the docs, as referenced
in the CGI Meta FAQ.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Sun, 12 Apr 1998 01:03:56 GMT
From: ppp-support <ppp-support@canelle.telecom.uqam.ca>
Subject: Re: environnemt variables
Message-Id: <353011EA.8A0B72D5@canelle.telecom.uqam.ca>

Yes i forgot the # ! Sorry

<!--#exec cgi="path/to/cgi/script.cgi" -->

brian d foy wrote:

> ><!-- exec cgi="scriptname.cgi" -->
>
> must be a wierd server that groks comments like that.  for correct
> information on Server Side Includes go right to the docs, as referenced
> in the CGI Meta FAQ.

Rene



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

Date: 12 Apr 1998 01:19:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: environnemt variables
Message-Id: <6gp4ro$rqt$3@client2.news.psi.net>

Francois-Xavier.bor@bde.espci.fr (Francois-Xavier.bor@bde.espci.fr) wrote
on MDCLXXXV September MCMXCIII in <URL: news:6goe0s$9av$1@pinot.ext.jussieu.fr>:
++ hi !
++ 
++ i would like to call a perl script each time someone looks my webpage
++ (in order the perl script get the IP adress of everyone; that way , i
++ would be able to write a hitcounter script ). my problem is not so
++ much the perl script (Randal Schwartz give its own on line if i need

Then why ask here?

++ help) but what should i put in my html page to call the perl script. I
++ am looking something like <Applet> but for perl instead for java.

Ask in an HTML group.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: 12 Apr 1998 01:00:26 GMT
From: kherron@campus.mci.net (Kenneth Herron)
Subject: Re: Excessive (?) Memory Usage with Large Database
Message-Id: <6gp3na$9u3$1@news.campus.mci.net>

|for ($current_line = 1; $current_line <= $num_lines; $current_line++)
|{
|  chomp($current_line_check = (<DEM>));
|  print "Error reading DEM file\n" if ($current_line_check !=
|				       $current_line);
|  chomp($num_elevations = (<DEM>));
|  chomp($line_coord = (<DEM>));
|  ($line_lon, $line_lat) = split(' ', $line_coord); 
|  
|  for ($j = 0; $j < $num_elevations; $j++)
|  {
|    chomp($temp = (<DEM>));
|    push(@el, $temp); 
|  }
|}

Perl's memory allocation strategy used to behave badly when growing an
array one element at a time to a huge size.  @el can be pre-sized by
assigning into $#el; try sizing it to the expected size, or at least
increment $#el by $num_elevations before going into the inner loop each
time.

BTW, in C, writing loops to count down to zero is a cheap way to 
gain some efficiency, because the compiler can generate code for 
a test against 0 more efficiently than a test against some arbitrary
variable.  I've never checked to see if perl also benefits from this,
but you might recode that inner loop as

	for ($j = $num_elevations; $j--; )

and see if it helps.
-- 
Kenneth Herron -- kherron@campus.mci.net
"When Microsoft first took control of the Funk & Wagnalls Encyclopedia
product, there was a flattering biography of Bill Gates.  But it said he
was known as a tough competitor.  Now it says that he's known for his
charitable contributions." -- Gary Reback, <http://www.ljx.com/reback/>


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

Date: 12 Apr 1998 01:00:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: General Rudeness, e.g. Re: Need a web login script
Message-Id: <6gp3ni$rqt$1@client2.news.psi.net>

Tom Mornini (tmornini@netcom.com) wrote on MDCLXXXIV September MCMXCIII
in <URL: news:tmorniniEr8LE2.rx@netcom.com>:
++ 
++ I'm NOT suggesting that this group doesn't have problems
++ with postings that don't belong. The problem with the keepers of
++ the sandbox is that they seem to think that the people who make
++ the posts that they don't like will actually read their responses
++ and act appropriately.

I have no reason to assume people that ask a question don't read the
response. Why would they ask? They might not "act appropriately",
but I know more people read my posts than just the person I am 
responding to. Someone else might get the hint and *not* aks his
off topic question.

++ I'll just finish with one simple question: What would happen if someone
++ asked an inappropriate question and EVERYONE failed to respond.

   - The person asking the question wouldn't know why it's not answered.
   - The question would get repeated.
   - People see many posts about off topic subjects, no complaints, and
     think it's ok to talk about that subject here.
   - Clueless people start answering.



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


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

Date: Sat, 11 Apr 1998 17:04:14 -0400
From: Stephen Mubita <smubit1@gl.umbc.edu>
Subject: Re: How to get only 2 decimal notation?
Message-Id: <Pine.SGI.3.96.980411170235.10531E-100000@jig.gl.umbc.edu>

On Sat, 11 Apr 1998, Stephen Mubita wrote:

=> On 10 Apr 1998, Apisilp Trunganont wrote:
=> 
=> => This is a very dummy question, but I don't know. I write this script.
=> => 
=> => $value = (27/126)*100;
=> => print $value;
=> => 
=> => The output is 2.142857142857142705. But I want only 2.14. How to do this?
=> => 
=> => 
=> 
=> With no idea about it's efficiency (me's new meself),
=> $value =~ s/(\d+.\d{2}).+/\1/;
=> 
=> If there is a better way, I'm all ears.
=> 

Correcting my own post. Sorry for not thinking the thing through first.
(this just chops the end off, instead of *rounding*). I guess I'd better
watch a while longer before posting :)


--
Stephen Mubita       "All Scripture is God-breathed and is useful for
smubit1@umbc.edu      for teaching, training, rebuking, correcting and
                      training in righteousness, so that the man of God 
                      may be thoroughly equipped for every good work." 
                                                  2 Timothy 3 : 16 - 17
-----------------------------------------------------------------------
        UCS is not responsible for any opinions contained here      



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

Date: Sat, 11 Apr 1998 18:12:29 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How to get only 2 decimal notation?
Message-Id: <fl_aggie-1104981812290001@aggie.coaps.fsu.edu>

In article <Pine.SGI.3.96.980411165011.10531C-100000@jig.gl.umbc.edu>,
Stephen Mubita <smubit1@gl.umbc.edu> wrote:

+ If there is a better way, I'm all ears.

perldoc -f printf
perldoc -f sprintf

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Sun, 12 Apr 1998 00:21:36 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: How to get only 2 decimal notation?
Message-Id: <19980412.002136.4h6.rnr.w164w@locutus.ofB.ORG>

"Grinch" <grinch@whoville.com> writes:

> Well, I'll be d**ned. I distinctly remember printf behaving the way I
> described [truncating, not rounding], quite some time ago. I can't
> recall which C compiler I was using (Turbo C, I think...)

just FYI:  Turbo C 1.0 at least rounds and does not truncate (just
tested it here).

I think my message might be better as a post to `alt.folklore.computers'
with a `when did rounding become important?' Subject: header.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sat, 11 Apr 1998 16:41:56 -0700
From: "David" <kupid@ecom.net>
Subject: Re: I need to delete temp files after 24 hours...
Message-Id: <6govdk$rll$1@usenet54.supernews.com>

Firstly, you would post the time that the filename is created.

time ()

Secondly you would would compare the filename ($time), with the current
($CurrentTime).  If it's greater than 24 hours, then delete then open up the
file and delete it.  Simply doing a "open(File, ">$thefile");" would do the
job, as this simply overwrites the old info.

I know of 2 easy methods of doing this automatically:

1. via crontab

2. via any of your other scripts... simply attach the code to a script., and
when the script executes, it automatically goes thru the code.

The Servant of the Lord,

David

Drake Cleary wrote in message <352fc9bc.15261175@news.peterboro.net>...
>How do i ask the question:
>
>is $filename older than 24 hours?
>
>
>Thanks.




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

Date: Sat, 11 Apr 1998 20:09:51 -0500
From: Eugene Sotirescu <eugene@vertical.net>
Subject: Re: I need to delete temp files after 24 hours...
Message-Id: <3530145D.AA05EA6D@vertical.net>



> Secondly you would would compare the filename ($time), with the current
> ($CurrentTime).  If it's greater than 24 hours, then delete then open up the
> file and delete it.  Simply doing a "open(File, ">$thefile");" would do the
> job, as this simply overwrites the old info.

I thought the requirement was to delete, not merely blank the files. If so,
unlink() is what is needed here.

>
>
> David
>
> Drake Cleary wrote in message <352fc9bc.15261175@news.peterboro.net>...
> >How do i ask the question:
> >
> >is $filename older than 24 hours?
> >
> >
> >Thanks.





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

Date: Sat, 11 Apr 1998 21:20:37 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: MacPerl Book Online in HTML
Message-Id: <6gp4vg$1vv$1@gaia.ns.utk.edu>

There is also another, _Perl 5 Complete_ available at:

   http://www.pbg.mcgraw-hill.com/betabooks/peschko/peschko-home.html

But, of course, Chris's is probably better.

Bob Gwynne
University of Tennessee

Chris Nandor wrote in message ...
>The MacPerl: Power and Ease book, due out in May, is available online in
>HTML from PTF, publishers of the book.
>
>    http://www.ptf.com/macperl/ptf_book/HTML/
>
>Enjoy!
>
>--
>Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
>%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
>#==               New Book:  MacPerl: Power and Ease               ==#
>#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#




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

Date: Sat, 11 Apr 1998 16:44:41 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: making second option available?
Message-Id: <6gov8l$lh0@bgtnsc02.worldnet.att.net>

Welcome to Perl! Hopy you enjoy it.

Have you looked at modules at all? There's one called getopt::std that
should do what you need. It lets you specify options on the command line and
either puts them into a hash or named scalars, either one associated to the
variable name.

This of course assuming that progname is a Perl script that you're trying to
call with "perl progname -n foo -l 1". If you're doing something else it
could be you're having problems talking to an external program called
progname, in which case a piece of code to illlustrate what you're doing
would be helpful.

Hope this helps,

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl



mike wrote in message <352FCC54.3C425FE@net-link.net>...
>when I try to exec "progname -option1($name) -option2($length)\n"; in a
>script, the program only recognizes the first option. The second is
>taken to be another command. Actually the first option is an
>argument(filename) and the option sets file length.
>
>I am very new to perl, about 3 days but believe me I have done some
>reading.
>If anyone can point me  to the answer or suggest how I might get past
>this?




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

Date: Sat, 11 Apr 1998 18:04:56 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Numeric validation
Message-Id: <comdog-ya02408000R1104981804560001@news.panix.com>
Keywords: from just another new york perl hacker

In article <alecler-1104981428250001@dialup-636.hip.cam.org>, alecler@cam.org (Andre L.) posted:

>I was wondering if using compiler warnings to check for the "numericity"
>of a value might be an alternative solution. Let's say you do this (with
>the -w switch of course):
>
>$num = '345q67';
>do { } if ($num == 999);
>
>A compiler warning would be issued, saying "argument 345q67 isn't numeric
>in eq."

in the case in which you think that this would work you might as well
optimize if to do withoout the test since you already know what the
value of $num is.  (hint:  think run-time :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 11 Apr 1998 15:20:05 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Numeric validation
Message-Id: <6goqal$bke$1@shell3.ba.best.com>

In article <352F7F50.358CE5F9@canelle.telecom.uqam.ca>,
ppp-support  <ppp-support@canelle.telecom.uqam.ca> wrote:
>Someone gave me the right answer by Email, he's answer is:
>
>if ($num =~ /^[0-9]+$/)

This is functionally equivalent (excluding strange locale issues) from


>> ++    warn "not a whole number"   unless /^\d+$/;

And will fail for some values which are numeric. For example, the pattern
you're using (and the one I cited from the FAQ) will fail for both of the
following numbers:

     -100
     3.5

So, if you're trying to get help from the group with this kind of problem,
you need to be much more specific about what you're trying to do. What kinds
of numbers are you willing to accept? What kinds will you be given?

The answer in the FAQ provides the number of examples it does for a reason-
this is not as trivial of a problem as it might first seem.

/MC

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@net.com (work)      | time you make it.


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

Date: 12 Apr 1998 00:29:42 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Numeric validation
Message-Id: <6gp1tm$dt6$1@marina.cinenet.net>

ppp-support (ppp-support@canelle.telecom.uqam.ca) wrote:
: Someone gave me the right answer by Email, he's answer is:

The 'right' answer depends on your specific needs, which you never told 
us.  Glad you found it, though.

: if ($num =~ /^[0-9]+$/)

That regex is easier to type as /^\d+$/ ...which of course is the 'not a 
whole number' variant from the faq:

: > ++    warn "not a whole number"   unless /^\d+$/;

Why did the emailed suggestion make sense to you, but not this faq entry? 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sun, 12 Apr 1998 00:48:16 GMT
From: ppp-support <ppp-support@canelle.telecom.uqam.ca>
Subject: Re: Numeric validation
Message-Id: <35300E3D.8C63B864@canelle.telecom.uqam.ca>

Matthew Cravit wrote:

> And will fail for some values which are numeric. For example, the pattern
> you're using (and the one I cited from the FAQ) will fail for both of the
> following numbers:
>
>      -100
>      3.5

Another procedure take care for thoses types of numbers in my script.

> So, if you're trying to get help from the group with this kind of problem,
> you need to be much more specific about what you're trying to do. What kinds
> of numbers are you willing to accept? What kinds will you be given

My mistake, i agree.
Rene



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

Date: Sun, 12 Apr 1998 00:58:29 GMT
From: ppp-support <ppp-support@canelle.telecom.uqam.ca>
Subject: Re: Numeric validation
Message-Id: <353010A3.3E0CD778@canelle.telecom.uqam.ca>

Craig Berry wrote:

> Why did the emailed suggestion make sense to you, but not this faq entry?

Simply because it does what i was looking for. Maybe you're right when you
told that i was not "ultra, very" :-) specific in my need for my script, but
obviously someone taught about it! Well, in my futur posting to this
newsgroup i'll be glad to add more information concerning my need and
carfully reading (and try to understand!) the faq before asking for anything.
I'm not a pro of perl scripting, but I need some time to learn it, like any
other language.

Rene



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

Date: Sat, 11 Apr 1998 15:47:25 -0700
From: "skippy dumbrowski" <skippy@anemaildomain.com>
Subject: Re: Packing?
Message-Id: <6goski$gv@news.mind.net>

>I was wondering, how can I remove all the dots from an IP address ... For
eg
>"104.204.54.57" to "1042045457" ???
>
>Here was what I tried ...
>
>$ip = $ENV{'REMOTE_ADDR'};
>@digits = split (/\./, $ip);
>$address = pack ("a8", @digits);
>



This is what I do to get a real user session.

sub GetNewSid {
my ($rh,$ra);
$rh = $ENV{'REMOTE_HOST'};
$ra = $ENV{'REMOTE_ADDR'};
$rh =~ s/\.//g;        # strip out all dots from $rh
$ra =~ s/\.//g;        # strip out all dots from $ra
return ("$rh$ra");
}


useage:

$sid = GetNewSid();


Hope that this helps











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

Date: Sat, 11 Apr 1998 21:34:38 +0200
From: "Tommi Mdkitalo" <t.maekitalo@eckpart.de>
Subject: perl on SCO-Unix
Message-Id: <352FC5CE.6B558ED4@eckpart.de>

Hi

I installed perl on our SCO-Unix 3.2V5.0.4. Works great, but I found
out, that there are difficulties with dynamic loading and 'cc', which
DBI needs (see hints/sco.sh in Perl5.00404-Source). I wonder if someone
has solved this problem.
Also I found out, than there is some other compiler 'icc', which can
create a perl-binary on SCO with dynamic loading. Maybe someone can tell

me, where to get a binary distribution?

Thanks

Tommi Mdkitalo
Dr. Eckhardt + Partner GmbH





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

Date: Sat, 11 Apr 1998 21:33:16 GMT
From: killbell@peterboro.net (Drake Cleary)
Subject: Q: Getting the browsers local time?
Message-Id: <352fe130.2413491@news.peterboro.net>

Is there any way (ie: Env variable) to get the local time of the user
of a perl script on the web?

Thanks


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

Date: Sat, 11 Apr 1998 23:46:03 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Q: Getting the browsers local time?
Message-Id: <Pine.A41.3.95a.980411233900.121354A-100000@rsplus03.cern.ch>

On Sat, 11 Apr 1998, Drake Cleary wrote:

> Is there any way (ie: Env variable) to get the local time of the user
> of a perl script on the web?

I'm guessing that you plan to execute your "perl script" at the server
side.  Your question might be more at home on c.i.w.authoring.cgi group.

I don't understand how you imagine the perl language could do something
that other languages couldn't do.

Either the protocol mandates the client agent to provide the server with
the client's local time (which you can discover by looking at the
protocol specs) or it doesn't.  Hint: it doesn't. 

If it does, then any language can use it.  If it doesn't, then perl is
just as much at a disadvantage as any other programming language.

You might persuade a javacript to return the information that you want,
but be notified that not all client agents grok javascript, and many of
those that could, have had it turned off (or filtered out) for various
reasons that are beyond the control of anyone at the server end.




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

Date: Sat, 11 Apr 1998 15:23:10 -0700
From: Larry Rosler <lr@hpl.hp.com>
To: killbell@peterboro.net
Subject: Re: Q: I need to delete temp files after 24 hours...
Message-Id: <352FED4E.D9FE53EC@hpl.hp.com>

Drake Cleary wrote:
> 
> How do i ask the question:
> 
> is $filename older than 24 hours?
> 
> Thanks.

http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_get_a_file_s_timestamp_

Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Sat, 11 Apr 1998 19:55:42 -0400
From: wls@wls.wwco.com (Walt Stoneburner)
Subject: Question about Reference to Hash
Message-Id: <MPG.f99cd062bc35ca9989684@news.erols.com>
Keywords: Perl, Hash, Question, Newbie, Reference

I'm using the Net::POP3 module, or more specifically, the list() method.

It returns a reference to a hash.  I'm doing: $headers = $pop->list();

If I do:  print ref $headers;   It reports HASH.  

Virtually anything I do with this value reports back the PERL error:
"Type of arg 1 to MumbleFroz must be hash (not scalar deref)..."
It seems to me that the functions and operators want a real-live 
associative array and not a reference.

A) How do I get a list of keys to the hash that's being referenced?
   This clearly won't cut it:   print keys $$headers;   

B) How do I tell how many elements are in the hash being referenced?

C) What part of the puzzle regarding either references or hashes am I
   just not getting that spending 2 hours in Perl books and FAQs did
   not reveal?

Any assistance or comments welcome,
-Walt Stonebuner, <wls@wls.wwco.com>


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

Date: Sat, 11 Apr 1998 21:09:55 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Reporting Module for Perl
Message-Id: <6gp4bq$1gi$1@gaia.ns.utk.edu>

Fred:
    You shouldn't need a module.  See the S^ , $= , $- , and S^L special
variables in perlvar and format in perlfunc. See also pp. 121--128, 168  in
Programming Perl, 2nd edition. See also Chapter 11 in Learning Perl.  After
all, Perl is an acronym for Practical Extraction and REPORT language. Given
its name, it should be able to generate reports.

Bob Gwynne
University of Tennessee

Fred Gonsalves wrote in message <35302929.82851459@idigital.net>...
>Is there any PERL Module that will do reports??????
>ie. do a page break when the branch id changes and display the header
>     also put a total footer on the previous page.
>
>We are an AIX shop and use JAM to the reports. It is very slow is
>actually
>producing the reports.
>
>    Thanks !!!
>




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

Date: Sat, 11 Apr 1998 17:52:54 -0700
From: "Ken" <watkins@mailexcite.com>
Subject: Script URL
Message-Id: <6gp38e$70u$1@ha2.rdc1.bc.wave.home.com>

I am new to perl programming (3 days) so please excuse me if my question is
a little simplistic. Is there a way to find out the URL that was used to
access a CGI script? Let's say someone enters
http://mysite.com/refer.cgi?4325 (fictional url)
I then need just the 4325


I found a script that almost does what I want,
(http://www.panix.com/~wizjd/cgi-bin/juggle.cgi) But it uses STDIN, and I
don't think that will work if someone just enters the URL and not part of a
form action, please correct me if I am wrong.

Thanks
Ken




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

Date: Sat, 11 Apr 1998 16:44:26 -0700
From: "David" <kupid@ecom.net>
Subject: To keep Text from Wrapping
Message-Id: <6govdm$rll$2@usenet54.supernews.com>

I have a database program that prints information to a text file. On each
line of the text file is supposed to be a new set of information (i.e., from
different users). The problem is that when the user submits too many words,
it prints the information to more than one line. What I want to do is keep
each user's info on one line. For example, user1's info would be on line
one, user2's info would be on the second, etc.
Does anyone know if there's a function in PERL that would prevent words from
wrapping in a text file?

Thanks!

David






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

Date: 11 Apr 1998 19:15:06 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <6gothq$avo$1@monet.op.net>

In article <35259b81.172851226@news.mmc.org>,
Jeffrey Drumm <drummj@mail.mmc.org> wrote:

>Since s/// with its associated regex baggage is even more costly than
>tr///d, the small advantage substr() had in this case probably just
>evaporated.

Actually, if the regex in s/// is a constant string, the expensive
regex stuff isn't used.  Perl uses the speedy Boyer-Moore string
search algorithm instead.

>Learn somethin' new every day . . . thanks, Jason.

I'll say.  This performance tuning stuff sure can be tricky!  For
years, people went around saying you should use `index' for substring
search instead of m//, and then it turned out that m// used the
Boyer-Moore stuff and index didn't, and they'd been wrong all those
years.

Moral:  Benchmarking is really necessary.


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

Date: Sat, 11 Apr 1998 18:11:13 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Week of Month
Message-Id: <fl_aggie-1104981811140001@aggie.coaps.fsu.edu>

In article <slrn6ivm65.kr.harrison@localhost.localdomain>,
harrison@pixi.com wrote:

+ Just so to be clear, my program DOES NOT work check for the Julian to
+ Gregorian calendar switch, so it isn't accurate for dates prior to 1
+ October, 1752.

And then it depends on _where_ you're at. The switch you refer to occured
in England and its colonies at the time. The switch didn't occur in
Russia until they became Communist. Southern Europen countries switched
when Gregory published his new calendar, ~1582 (or so).

Bottom line: it probably doesn't matter...

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 12 Apr 98 00:54:26 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: Week of Month
Message-Id: <slrn6j044f.kr.harrison@localhost.localdomain>

On Sat, 11 Apr 1998 18:11:13 -0500, 
I R A Aggie <fl_aggie@thepentagon.com> wrote:
> In article <slrn6ivm65.kr.harrison@localhost.localdomain>,
> harrison@pixi.com wrote:
> 
> + Just so to be clear, my program DOES NOT work check for the Julian to
> + Gregorian calendar switch, so it isn't accurate for dates prior to 1
> + October, 1752.
> 
> And then it depends on _where_ you're at. The switch you refer to occured
> in England and its colonies at the time. The switch didn't occur in
> Russia until they became Communist. Southern Europen countries switched
> when Gregory published his new calendar, ~1582 (or so).
>
> Bottom line: it probably doesn't matter...

And to me, on this Sweetmorn, the 28th day of Discord in the YOLD 3164, 
it really doesn't matter either.

Of course, since we've now had this exchange, there'll probably be a
flood of, "URGENT! I'm new to Perl and need some CGI to put the week of
the month for Tsarist Russian dates into a browser, oh yeah, Southern
Europe too." :-)

Eventually we'll be forced to fix it for all calendars that were in
use including the ones you've mentioned, Chinese calendars, Mayan
calendars, and any real calendars I've not mentioned. Then there are
those 'other calendars' like the Discordian, Star Trek, Middle Earth,
Pern, and whatnot.

But what namespace should I use for the module: Date::Useless?
Actually I like that one because I like the sound of 'create a new
useless date object'.

        $udo = Date::Useless::Discordian->new();
        $udo->discord_day(11,4,1998);

Hmmmm....

Well, let me know if you have a better idea! :-)

-- 
rfh harrison@pixi.com
DNRC "Potentate of Needless Reinstallations"


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

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

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