[12783] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 193 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 19 19:07:19 1999

Date: Mon, 19 Jul 1999 16:05:12 -0700 (PDT)
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, 19 Jul 1999     Volume: 9 Number: 193

Today's topics:
    Re: #!/usr/bin/perl -w switch esoterica (Jon Orwant)
    Re: #!/usr/bin/perl -w switch esoterica ks@anse.org
    Re: 3D modeling with Perl? (Ilya Zakharevich)
        A Query about Remote Commands/Xterms/Displays and Such <jackrr@aud.alcatel.com>
        Any idea why this won't work? <strauman@GTE.NET>
    Re: Can a .html file be executable? <grrr@grrr.net>
    Re: cgi entry form <flavell@mail.cern.ch>
        FastCGI problems - please help. <zigouras@mail.med.upenn.edu>
    Re: fetch url from cgi? (Jon Orwant)
        How to compare fields <tom.kralidis@ccrs.nrcanDOTgc.ca>
        Listing Files <anonymous@web.remarq.com>
        Must be in the FAQ...can't seem to find it, though (Eric Dew)
    Re: Must be in the FAQ...can't seem to find it, though <laughingotter@foxinternet.net>
    Re: Must be in the FAQ...can't seem to find it, though <aperrin@mcmahon.qal.berkeley.edu>
    Re: Must be in the FAQ...can't seem to find it, though (Eric Dew)
    Re: Must be in the FAQ...can't seem to find it, though (Tad McClellan)
        negate regex? <dankirk@lucent.com>
    Re: padding a number (John Stanley)
    Re: padding a number (I R A Darth Aggie)
    Re: padding a number (Matthew Bafford)
    Re: Padding numbers with 0's (John Stanley)
        runs okay in shell, not in browser lmoloch@my-deja.com
        symbolic ref or hard ref? <cfang@nwu.edu>
    Re: Time Conversion (Dave Cross)
    Re: Time Conversion (Larry Rosler)
    Re: TPJ/Earthweb junk mail? (I R A Darth Aggie)
        What does REUSED_ADDRESS in -d mean? <aperrin@mcmahon.qal.berkeley.edu>
    Re: What Subroutine Should I use?  OOPS! (Michel Dalle)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 19 Jul 1999 22:04:55 GMT
From: orwant@rising-sun.media.mit.edu (Jon Orwant)
To: ks@anse.org
Subject: Re: #!/usr/bin/perl -w switch esoterica
Message-Id: <ORWANT.99Jul19180455@rising-sun.media.mit.edu>


In article <37938920.B38A55CF@anse.org> ks@anse.org writes:

   From: ks@anse.org
   X-Mailer: Mozilla 4.61 [en] (Win98; I)
   X-Accept-Language: en
   MIME-Version: 1.0
   Newsgroups: comp.lang.perl.misc
   Content-Type: text/plain; charset=us-ascii
   Content-Transfer-Encoding: 7bit

   I'm running a perl script (command line style) and would like to be able
   to ignore the current list of "uninitialized value" errors I'm receiving
   (which I will fix later, naturally).  When I remove the -w switch, I get
   a "bash: ./file_name.pl: No such file or directory" error.  I'm at a
   loss.  Can anyone send some wisdom my way?

However you're removing the -w switch, you're doing something that
messes with the "#!/usr/bin/perl" (or equivalent) that causes bash to
look for something other than /usr/bin/perl when it tries to run your
program.  For instance, if you deleted not just the -w, but also the
trailing "l" of "perl", that'd exhibit the offending behavior.

Then again, it could be the gremlins.

-Jon

--


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

Date: Mon, 19 Jul 1999 15:16:40 -0700
From: ks@anse.org
Subject: Re: #!/usr/bin/perl -w switch esoterica
Message-Id: <3793A3C8.7DAB1EB1@anse.org>

Hm, well it would make sense, however I'm only removing the -w (I
swear!).  Arg.  Perhaps there are wee gremlins in our system -- last
week perl wouldn't recognize the ord() function.  Durn'd thing kept
telling me it was unrecognizable.  Then, all of a sudden, it stopped
complaining.  This keeps happening and I'm going to go more insane.

Thx,
Kate

At 06:04 PM 7/19/99 -0400 you curiously penned:
:However you're removing the -w switch, you're doing something that
:messes with the "#!/usr/bin/perl" (or equivalent) that causes bash to
:look for something other than /usr/bin/perl when it tries to run your
:program.  For instance, if you deleted not just the -w, but also the
:trailing "l" of "perl", that'd exhibit the offending behavior.
:
:Then again, it could be the gremlins.
:
:-Jon
:



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

Date: 19 Jul 1999 21:42:27 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: 3D modeling with Perl?
Message-Id: <7n0643$t3s$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Kevin Reid
<kpreid@ibm.net>],
who wrote in article <1dv6veh.1ize4f012j8vswN@[192.168.0.1]>:
> > I'd like to write a small application to visualize and rotate 3D
> > objects (specifically, simple representations of molecules).  I'd like
> > to do this using as much Perl as possible (and conversely, avoiding
> > learning new languages/applications as much as possible).  Are there
> > any tools or source code on the web that would facilitate this
> > programming task?
> 
> I have written a program that does 3D graphics mostly in Perl; it
> displays a ball bouncing in a cubical box. You can probably adapt the
> code to your needs; however, it was written to run on Mac OS, so it uses
> some of the Mac OS's graphics primitives.

> use Mac::Windows;
> use Mac::QuickDraw;

Why not use OpenGL module?  It runs at least under X and OS/2 PM.
Kenneth might have updated it to Win* as well...

Ilya


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

Date: Mon, 19 Jul 1999 17:16:54 -0500
From: "Robert R. Jackson" <jackrr@aud.alcatel.com>
Subject: A Query about Remote Commands/Xterms/Displays and Such
Message-Id: <3793A3D4.C382CA15@aud.alcatel.com>

Folks,

I'm planning to design a tool will execute remote commands from a script.

The idea here is I write some commands and tell them which machines to run on.

So far, so good right.

Now what if one of those commands launched an xterm window

on another machine and I know what to send more commands through that XTERM (setting

the Display, etc..). Is this doable?

And??? Could that "sub process" working with the xterm window launch a remote command on a

another machine?

Can the Perl "NET" module handle this kind of stuff?

Thanks,

Robert Jackson

--
Robert R. Jackson         "The fruit must have a stem
jackrr@aud.alcatel.com    before it grows." Jabo Proverb
http://www.self-image.com/people/robert





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

Date: Mon, 19 Jul 1999 23:03:24 GMT
From: John Straumann <strauman@GTE.NET>
Subject: Any idea why this won't work?
Message-Id: <3793AE93.C034C5E9@GTE.NET>

Hey all:

I have a CGI that accepts input from a text field, and I want to be able
to hard code the input using a line like this:

<form method="GET" action="/cgi-bin/example.cgi?input=test">

But this will not work.

Does anyone know why?


John Straumann.


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

Date: Mon, 19 Jul 1999 15:45:03 -0700
From: grrr <grrr@grrr.net>
Subject: Re: Can a .html file be executable?
Message-Id: <3793AA6F.EFD7D184@grrr.net>

Marcel Grunauer wrote:

> And ask in alt.rec.sky-diving, they might care.

Hey hey - that's 'rec.skydiving' to you, bub. We won't care, though.


www.     < grrr >     .net



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

Date: Mon, 19 Jul 1999 22:55:02 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi entry form
Message-Id: <Pine.HPP.3.95a.990719225339.12784A-100000@hpplus03.cern.ch>

On Mon, 19 Jul 1999 bayla@gatewayinternet.com wrote:

> You can put the printout of your form into a function and then make a
> function which will test each cgi->parameter that it exists (in other
> words, it has a value) and if the error function detects an error it
> should print out the error message and then the form. If it comes back
> with no error then the form should be processed.

An amusing student exercise; but in the real world I suggest that one
would simply use CGI.pm, where the mechanism is sitting waiting to be
used.



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

Date: Mon, 19 Jul 1999 18:01:34 -0400
From: Nico Zigouras <zigouras@mail.med.upenn.edu>
Subject: FastCGI problems - please help.
Message-Id: <3793A03D.51B26325@mail.med.upenn.edu>

Desperate for help here.  Two questions.  Downloaded fastcgi from their
site, trying to install on Apache/1.3.3 (Red Hat/Linux).

OK first of all I am not sure what directory to install the stuff in.
Here are the directions:

2) Installing mod_fastcgi manually
==================================

  1. Copy or move the mod_fastcgi distribution directory to
  <apache_dir>/src/modules/fastcgi.

  2. Add the FastCGI module to <apache_dir>/src/Configuration.  Note
that
  modules are listed in reverse priority order --- the ones that come
  later can override the behavior of those that come earlier.  I put
mine
  just after mod_cgi entry.

    AddModule modules/fastcgi/libfastcgi.a
3. Copy the Makefile.sample to Makefile and edit if/as appropriate.

    <apache_dir>/src$ cd modules/fastcgi
    <apache_dir>/src$ cp Makefile.sample Makefile

  4. From the <apache_dir>/src directory, reconfigure and rebuild
Apache.

    <apache_dir>/src$ ./Configure
    <apache_dir>/src$ make

  Install the new httpd.

  5. Edit the httpd configuration files to enable your FastCGI
  application(s).  See docs/mod_fastcgi.html for details.

  6. Stop and start the server.
===================================

What is the apache dir?  Is it /etc/sbin ? Where httpd exec is?


Second question - I am running the makefile for these files and getting
this error: make: *** No rule to make target `/httpd.h', needed by
`mod_fastcgi.o'.  Stop.

Here is the Makefile
#
# Makefile.tmpl for the mod_fastcgi module
#
#   Apache v1.3's Configure uses this to create a Makefile
#
# $Id: Makefile.tmpl,v 1.3 1999/02/09 03:07:57 roberts Exp $

LIB=libfastcgi.$(LIBEXT)

OBJS=mod_fastcgi.o fcgi_buf.o fcgi_pm.o fcgi_protocol.o fcgi_config.o
fcgi_util$

# Build commands

all:  lib
lib: $(LIB)

$(LIB): $(OBJS)
        rm -f $@
        ar cr $@ $(OBJS)
        $(RANLIB) $@

 .c.o:
        $(CC) -c $(INCLUDES) $(CFLAGS) $<

clean:
        rm -f $(LIB) $(OBJS)

distclean: clean
        rm -f Makefile


# NOT FOR END USERS!
depend:
        cp Makefile.tmpl Makefile.tmpl.bak \
            && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl >
Makefile.new \
            && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
            && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
            && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
                   -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
                > Makefile.tmpl \
            && rm Makefile.new
                 $(INCDIR)/util_script.h          \
                 $(INCDIR)/http_conf_globals.h    \
                 $(INCDIR)/util_md5.h


Thanks so much.

Please reply to nico@birdmail.com

# Dependencies

$(OBJS): fcgi.h
fcgi.h: mod_fastcgi.h fcgi_protocol.h
fcgi_protocol.o: fcgi_protocol.h
mod_fastcgi.o:   $(INCDIR)/httpd.h                \
                 $(INCDIR)/http_config.h          \
                 $(INCDIR)/http_request.h         \
                 $(INCDIR)/http_core.h            \
                 $(INCDIR)/http_protocol.h        \
                 $(INCDIR)/http_main.h            \
                 $(INCDIR)/http_log.h             \

Thanks for your help.



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

Date: 19 Jul 1999 21:23:03 GMT
From: orwant@rising-sun.media.mit.edu (Jon Orwant)
To: matt7200@aol.com
Subject: Re: fetch url from cgi?
Message-Id: <ORWANT.99Jul19172303@rising-sun.media.mit.edu>


In article <37933C64.FA74C153@kansas.net> Riley County Grade School <falcon@kansas.net> writes:

   Date: Mon, 19 Jul 1999 14:55:44 +0000
   From: Riley County Grade School <falcon@kansas.net>
   Reply-To: matt7200@aol.com

   How can I have a cgi fetch a http url and post the results to the page
   my cgi generates?

   Matt

Use the LWP::Simple module, available as part of the libwww-perl bundle at
http://www.perl.com/CPAN/modules/by-module/LWP.

-Jon
--


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

Date: Mon, 19 Jul 1999 17:19:21 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: How to compare fields
Message-Id: <37939659.67816C0A@ccrs.nrcanDOTgc.ca>

What's the best way to compare two given fields in a text file,
outputting the differences, after reading in the file from the command
line?

thanks
-- 

-----------------------------------------------------------------------------------------
Tom Kralidis                                  Geo-Spatial Technologist 
Canada Centre for Remote Sensing              Tel: (613) 947-1828
588 Booth Street , Room 241                   Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7                     http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------


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

Date: Mon, 19 Jul 1999 14:48:31 -0800
From: Ashish Kadakia <anonymous@web.remarq.com>
Subject: Listing Files
Message-Id: <932424514.5244@www.remarq.com>

Hi, I would like to list all the files starting with the
root directory..
Can anyone point me how to do that?



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!


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

Date: 19 Jul 1999 21:12:31 GMT
From: edew@netcom.com (Eric Dew)
Subject: Must be in the FAQ...can't seem to find it, though
Message-Id: <7n04bv$1fn@dfw-ixnews17.ix.netcom.com>

I want to do the following:

I want to create a "library" file, data.pl, the contents of which are:

$FOO = "Hello";
$BAR = "World";

Now, I want to write perl scripts which use those variables.  That is,
I want to create the perl script, helloworld* the contents of which are:

#!/usr/local/bin/perl

<something about using data.pl>

print "$FOO $BAR\n";


I want to know what I write in the < something about using data.pl> and
whether the contents of data.pl is properly written (e.g., do I have
to include a #!/usr/local/bin/perl on the topmost line in data.pl?)

And if someone can direct me to the proper FAQ page, that would be just
as helpful.

Thanks,

EDEW


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

Date: Mon, 19 Jul 1999 14:32:41 -0700
From: Steve Laybourn <laughingotter@foxinternet.net>
Subject: Re: Must be in the FAQ...can't seem to find it, though
Message-Id: <37939979.803E3367@foxinternet.net>

Hello!
   Have you tried using the following gobbledigook:

#!/usr/local/bin/perl
require "data.pl";

---yadda yadda yadda---

   This would load the contents of data.pl into whatever script you are
invoking it from.
   I use this way to define global variables on my e-commmerce web sites in
Perl. Change the global, the rest of the scripts follow. Same thing here.
   Good luck!
   Steve Laybourn
   Frustrated Perl Programmer, Laughing Otter Computing Systems
   e-mail: otter101@hotmail.com


Eric Dew wrote:

> I want to do the following:
>
> I want to create a "library" file, data.pl, the contents of which are:
>
> $FOO = "Hello";
> $BAR = "World";
>
> Now, I want to write perl scripts which use those variables.  That is,
> I want to create the perl script, helloworld* the contents of which are:
>
> #!/usr/local/bin/perl
>
> <something about using data.pl>
>
> print "$FOO $BAR\n";
>
> I want to know what I write in the < something about using data.pl> and
> whether the contents of data.pl is properly written (e.g., do I have
> to include a #!/usr/local/bin/perl on the topmost line in data.pl?)
>
> And if someone can direct me to the proper FAQ page, that would be just
> as helpful.
>
> Thanks,
>
> EDEW



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

Date: Mon, 19 Jul 1999 14:37:07 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Must be in the FAQ...can't seem to find it, though
Message-Id: <37939A83.D1E259F0@mcmahon.qal.berkeley.edu>



Eric Dew wrote:

> I want to create a "library" file, data.pl, the contents of which are:

perldoc -f require
perldoc -f do

--
-------------------------------------------------------------
Andrew Perrin - NT/Unix/Access Consulting - aperrin@mcmahon.qal.berkeley.edu

       http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------




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

Date: 19 Jul 1999 21:43:17 GMT
From: edew@netcom.com (Eric Dew)
Subject: Re: Must be in the FAQ...can't seem to find it, though
Message-Id: <7n065l$49f@dfw-ixnews15.ix.netcom.com>

In article <37939979.803E3367@foxinternet.net>,
Steve Laybourn  <laughingotter@foxinternet.net> wrote:
>Hello!
>   Have you tried using the following gobbledigook:
>
>#!/usr/local/bin/perl
>require "data.pl";
>
>---yadda yadda yadda---
>
That seems to have done he job.

Thanks,

EDEW

>   This would load the contents of data.pl into whatever script you are
>invoking it from.
>   I use this way to define global variables on my e-commmerce web sites in
>Perl. Change the global, the rest of the scripts follow. Same thing here.
>   Good luck!
>   Steve Laybourn
>   Frustrated Perl Programmer, Laughing Otter Computing Systems
>   e-mail: otter101@hotmail.com
>
>
>Eric Dew wrote:
>
>> I want to do the following:
>>
>> I want to create a "library" file, data.pl, the contents of which are:
>>
>> $FOO = "Hello";
>> $BAR = "World";
>>
>> Now, I want to write perl scripts which use those variables.  That is,
>> I want to create the perl script, helloworld* the contents of which are:
>>
>> #!/usr/local/bin/perl
>>
>> <something about using data.pl>
>>
>> print "$FOO $BAR\n";
>>
>> I want to know what I write in the < something about using data.pl> and
>> whether the contents of data.pl is properly written (e.g., do I have
>> to include a #!/usr/local/bin/perl on the topmost line in data.pl?)
>>
>> And if someone can direct me to the proper FAQ page, that would be just
>> as helpful.
>>
>> Thanks,
>>
>> EDEW
>




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

Date: Mon, 19 Jul 1999 13:55:37 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Must be in the FAQ...can't seem to find it, though
Message-Id: <pqovm7.cb4.ln@magna.metronet.com>

Eric Dew (edew@netcom.com) wrote:

: I want to create a "library" file, data.pl, the contents of which are:

: I want to know what I write in the < something about using data.pl> and
: whether the contents of data.pl is properly written (e.g., do I have
: to include a #!/usr/local/bin/perl on the topmost line in data.pl?)


   No, you do not need a shebang line at the top.

   It _is_ customary to have:

1;

   as the last line in your "library" file though (to ensure that
   it returns TRUE).


: And if someone can direct me to the proper FAQ page, that would be just
: as helpful.


   perldoc -f require

   perldoc -f do

   perldoc -f use
   perldoc perlmod


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


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

Date: Mon, 19 Jul 1999 16:58:40 -0600
From: Daniel_P_Kirkwood <dankirk@lucent.com>
Subject: negate regex?
Message-Id: <3793ADA0.5FEBC7C6@lucent.com>

Is there a way in a regex to negate the result ala !~ or "grep -v"? I've
looked at looking at negative assertions, but they're not general
enough..

I want to be able to store multiple regex's in a list, for example, and
have them applied to a list of files, but I want each of the regex's to
be able to say whether it's to be applied using =~ or !~ without extra
work by the driving program..

Here's a contrived example: @filters = ( qr/^foo/, !qr/bar/, qr/baz/)
Meaning, I want everything in my list that starts with foo, then
everything that doesn't have bar, etc..  Obviously, this isn't correct
syntax, but you get my meaning...

Any help would be greatly appreciated...


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

Date: 19 Jul 1999 21:38:55 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: padding a number
Message-Id: <7n05tf$mja$1@news.NERO.NET>

In article <7mvvl9$ve7$1@brokaw.wa.com>,
Lauren Smith <laurens@bsqaure.com> wrote:
>AND (digging myself deeper and deeper into this hole)...
>to pad on the left:
>$num = reverse $num;
>$num .= '0';
>$num = reverse $num;
>
>00.5 (numbers below zero are already padded with a zero)

Huh?

IN
-1.5
-0.01

OUT
0-1.5
0-0.01

Looks like it is a harder problem than most people think.



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

Date: 19 Jul 1999 22:22:17 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: padding a number
Message-Id: <slrn7p79cv.hmg.fl_aggie@thepentagon.com>

On 19 Jul 1999 19:29:54 GMT, John Stanley <stanley@skyking.OCE.ORST.EDU>, in
<7mvubi$j4i$1@news.NERO.NET> wrote:

Question: How do you pad a number with a single '0' (zero)?

[Note: padding indicates to the left-hand-side of the value. Wouldn't want
 to get into any nasty debates over accuracy and signifcant digits with
 a physics professor...]

Lauren's Method: $num *= 10; # is a scaling factor
James' Method: printf "%.2d\n",$num; # padding, but for a narrow set of $num

+ $num = 100;
+ Lauren's Method: 1000
+ James' Method: 1000

Is that a fact? Did you test my snippet? Let's test it:

% perl

$num=100;
printf "James' Method: %.2d\n",$num;

Result:

James' Method: 100

Methinks ye have posted to quickly.

+ $num = 1.2345;
+ Lauren's Method: 12.345
+ James' Method: 12

Once more, with feeling:

% perl

$num=1.2345;
printf "James' Method: %.2d\n",$num;

Result:

James' Method: 01

An odd result, perhaps, but a rational result.

+ John's method: printf "$num" . "0";

Close, but not quite --- IFF the poster meant padding, and not scaling:

print '0'.$num,"\n";

James


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

Date: Mon, 19 Jul 1999 22:38:57 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: padding a number
Message-Id: <slrn7p7931.1rq.*@dragons.duesouth.net>

And so it happened, on 19 Jul 1999 15:45:54 -0500, Abigail) typed random
characters into perl, and ended up with the following posted to
comp.lang.perl.misc: 
: As long as you know how to print it.
: 
: 
:     $num  = 0.5;
:     $num .= '0';
:     print "$num";
: 
: 
: One of the cases where putting quotes around a scalar *IS* the right way. ;)
:
: Oh, and it covers the case of $num being equal to 0 as well.

I can't see how it makes any difference.

> perl -le '$. = 0.5; $. .= '0'; print "$."'
0.50
> perl -le '$. = 0.5; $. .= '0'; print  $. '
0.50
> perl -le '$. = 0.5; $. .=  0 ; print "$."'
0.50
> perl -le '$. = 0.5; $. .=  0 ; print  $. '
0.50
> perl -le '$. =   0; $. .= '0'; print "$."'
00
> perl -le '$. =   0; $. .= '0'; print  $. '
00
> perl -le '$. =   0; $. .=  0 ; print "$."'
00
> perl -le '$. =   0; $. .=  0 ; print  $. '
00
 
: Abigail

--Matthew



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

Date: 19 Jul 1999 21:46:56 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Padding numbers with 0's
Message-Id: <7n06cg$mnc$1@news.NERO.NET>

In article <MPG.11fd2b138735e616989cfd@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <7mvuqh$j6j$1@news.NERO.NET> on 19 Jul 1999 19:37:53 GMT, 
>John Stanley <stanley@skyking.OCE.ORST.EDU> says...
>> open( O, ">/tmp/my_date" ) || die "cannot open output mydate: $!\n";
>> printf O "\$var = %04d%02d%02d;",$year,$month,$day;
>> close O || die "cannot close output mydate: $!\n";
>> unlink "/tmp/my_date" || die "cannot unlink output mydate: $!\n";
>> $tmp = `cat /tmp/my_date | sort | uniq | tail -1 | more`;
>> eval($tmp);
>
>1.  Did you overlook printing a newline after the semicolon yo get a 
>proper text file?

Nope. On my system, sort adds the newline for me, but I get a warning
"Missing NEWLINE added at end of file". So -- sort IS there for a
reason!

>2.  How do you manage to read the file after you unlink it?

I'm omniscient. 



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

Date: Mon, 19 Jul 1999 22:27:19 GMT
From: lmoloch@my-deja.com
Subject: runs okay in shell, not in browser
Message-Id: <7n08np$a3r$1@nnrp1.deja.com>



Hello!

I've been puzzling over this piece of code for some time now. It runs
perfectly when I execute it by typing in its name (or when I type "perl
userlog.cgi", but the script refuses to run if I call it via a web
browser-- it displays only a small part of the middle of the expected
output:

Here is the script:
----------------------
#!/bin/perl
# userlog.cgi

print "Content-type: text/html", "\n\n";
        print "<HTML>", "\n\n";
        print "<HEAD>", "\n\n";
        print "<TITLE>", "Users logged in ","</TITLE>","\n\n";
        print "</HEAD>","\n\n";
        print "<BODY>\n";

%ucnt = ();
for (`who`) {
        s/\s.*\n//;
        $ucnt{$_}++;
}

@users = sort keys %ucnt;
print "Users logged in: @users\n";


foreach $user (@users) {
  print "<A HREF=\"mailto:$user\@microsoftschoolver1.edu\">$user</A>
<BR> ";

}
        print "\n", "</BODY>","\n\n";
        print "</HTML>","\n\n";
---------------
end of script

And this is what it displays:

Users logged in: someuser someuser
                           |- this has the correct email address link


Any idea why it doesnt run thru a browser?
(file permissions are 755)


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 19 Jul 1999 17:09:45 -0500
From: "Chao Fang" <cfang@nwu.edu>
Subject: symbolic ref or hard ref?
Message-Id: <7n07m5$n4e@news.acns.nwu.edu>

I ran into some syntax that is not in any textbooks about Perl.
I have a package like:

package WordNet;
%noun;
sub new {
    .....
}
 ............
1;

in package main, I have to use
        $noun = WordNet::noun;
It seems like $noun is a symbolic reference and I can use %$noun to deref
it. ref($noun) returns null.


But if I change the WordNet package a little like:
$noun = \%{ an anonymous hash};

I will have to write
        $noun = ${WordNet::noun};
in main to get a ref. This time the $noun in main is a hard ref, with
ref($noun) returning HASH.

Can anybody explain it a little to me.

Thank you.

If you mail me, to cfang@ece.nwu.edu please.





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

Date: Mon, 19 Jul 1999 21:05:53 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: Re: Time Conversion
Message-Id: <379791f9.8899316@news.demon.co.uk>

On 19 Jul 1999 20:48:17 GMT, mesarchm@aol.com (Mesarchm) wrote:

>I have this time [06/07/99:0:03:03] and need to convert it to this format
>[07/Jun/1999:00:03:03]

my $date = '06/07/99:0:03:03';

my @month = qw/Xxx Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;

my ($mth, $dy, $yr, $time) = split(/\/:/, $date, 4);
my $mth = $month[$mth];

# Difficult to know what to do with the year as I don't know what you
# data will do next year. Let's assume that 2000 will be 100,
# like the return from localtime.
$yr += 1900;

$date = "$dy/$mth/$year:$time";


hth,

Dave...
--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: Mon, 19 Jul 1999 14:52:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Time Conversion
Message-Id: <MPG.11fd3df899a618e9989cfe@nntp.hpl.hp.com>

In article <379791f9.8899316@news.demon.co.uk> on Mon, 19 Jul 1999 
21:05:53 GMT, Dave Cross <dave@dave.org.uk> says...
> On 19 Jul 1999 20:48:17 GMT, mesarchm@aol.com (Mesarchm) wrote:
> >I have this time [06/07/99:0:03:03] and need to convert it to this format
> >[07/Jun/1999:00:03:03]
> 
> my $date = '06/07/99:0:03:03';
> 
> my @month = qw/Xxx Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
> 
> my ($mth, $dy, $yr, $time) = split(/\/:/, $date, 4);

There are no sequences '/:' in the data, so this split won't do much, 
will it?

> my $mth = $month[$mth];
> 
> # Difficult to know what to do with the year as I don't know what you
> # data will do next year. Let's assume that 2000 will be 100,
> # like the return from localtime.
> $yr += 1900;

I would rather assume it conforms to standard date practice and has only 
two digits, even next year and thereafter.

> $date = "$dy/$mth/$year:$time";

But that doesn't fix the problem of an unpadded time component.  One has 
to split all the way, then build it back with sprintf.  Here is one way 
(TESTED, unlike yours, Dave):


#!/usr/local/etc/perl -w
use strict;

my $date = '06/07/99:0:03:03';

my @month = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;

my ($mth, $dy, $yr, $hr, $min, $sec) = split m|[/:]|, $date;

$yr += $yr > 69 ? 1900 : 2000;

$date = sprintf '%.2d/%s/%d:%.2d:%.2d:%.2d',
    $dy, $month[$mth - 1], $yr, $hr, $min, $sec;

print "$date\n";
  
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 19 Jul 1999 22:27:05 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: TPJ/Earthweb junk mail?
Message-Id: <slrn7p79m0.hmg.fl_aggie@thepentagon.com>

On 19 Jul 1999 15:21:06 -0400, Uri Guttman <uri@sysarch.com>, in
<x7iu7gfntp.fsf@home.sysarch.com> wrote:

+ teenage romance!! we can do it gang! we just have to work together! who
+ do we cast in judy garland's role? abigail? elaine? tom?

Natalie Portman. Or maybe Martina Hingis.

James - just as long as *I* get to romance the teenager... ;)


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

Date: Mon, 19 Jul 1999 15:26:00 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: What does REUSED_ADDRESS in -d mean?
Message-Id: <3793A5F8.F87F2111@mcmahon.qal.berkeley.edu>

Greetings-

In a package I'm working on, I have a rather ugly data structure; when
I'm working in the debugger and view the structure using:

<4> x $foo

some of the elements eventually work their way down to:
        -> REUSED_ADDRESS

I have two questions:
    1.) I assume that this refers to the fact that the element is a
reference to something that's already been printed in the list (that
would make sense). Am I somewhere close to right here?

    2.) Should I be worried?

--
-------------------------------------------------------------
Andrew Perrin - NT/Unix/Access Consulting -
aperrin@mcmahon.qal.berkeley.edu
        http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------




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

Date: Mon, 19 Jul 1999 21:55:40 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: What Subroutine Should I use?  OOPS!
Message-Id: <7n06r4$7c8$1@xenon.inbe.net>

In article <7mt6ne$115$1@nntp1.atl.mindspring.net>, "cshelby" <cshelby@mindspring.com> wrote:
>> To parse scripts with CGI.pm what subroutine should I call for??

Here's a small example on how to use CGI.pm :

#!/usr/local/bin/perl -w
use strict;
use CGI qw/:standard/;
sub read_doc {
        system("perldoc CGI");
}
read_doc();
exit;

Cheers,

Michel.


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

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

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


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