[7281] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 906 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 22 16:17:18 1997

Date: Fri, 22 Aug 97 13:00:32 -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           Fri, 22 Aug 1997     Volume: 8 Number: 906

Today's topics:
     Re: Assinging values of HASH in to Array <rmw@netscape.com>
     beginner's help frankel@cs.concordia.ca
     Re: delayed execution of  a program?? <ldusadev@kestrok.com>
     Re: efficient editing (Brandon S. Allbery KF8NH)
     Forcing print<< to be VERY LITERAL (Kirk L. Israel)
     Re: foreach and arrays (Jim Trocki)
     Re: FORM SUBMIT on PerlIS doesn't work ? <gwhassan@prodigy.net>
     Re: Help with perl scripts uploads <thomas@fahle.de>
     Help with security of log file <murillo@infocostarica.com>
     Re: Help!! my dbm file crash everytime I try to build i (Mike D. Kail)
     Help: Perl (Henry Avatar Chan)
     Re: Help: Perl (Mike Stok)
     How do I drop trailing spaces? <bernard510@hotmail.com>
     Re: How do I drop trailing spaces? (Mike Stok)
     Re: HTML-TEXT <rstarling@btg.com>
     is there a perl compiler ported to NT? <yinso@u.washington.edu>
     Need WIN32's alternative for rename() (plz) <mbosley@games-online.com>
     Newbie: where can I find exercises? <pjs@iol.ie>
     Re: Newbie: where can I find exercises? <ajohnson@gpu.srv.ualberta.ca>
     NNTPClient Module <serginho@mail.serve.com>
     Re: pack & format (Jim Trocki)
     Re: PERL & WinNT <gwhassan@prodigy.net>
     podman in Win32 <serginho@mail.serve.com>
     Re: Reading in a file for use... <tom@mitra.phys.uit.no>
     Re: Redirecting output...... <nnyxcu@ny.ubs.com>
     Re: server name (Roddy Knight)
     Re: server name <dannyl@computize.com>
     Re: Statistics for comp.lang.perl.misc <tom@mitra.phys.uit.no>
     uninit'd value annoyance <Joe.Kline@sdrc.com>
     Re: What is this EOF error? <jmski@grapevinenet.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Aug 1997 10:03:41 -0700
From: Robert Mark Waugh <rmw@netscape.com>
Subject: Re: Assinging values of HASH in to Array
Message-Id: <33FDC66D.CC398D2A@netscape.com>

Ajitesh Das wrote:
> 
> All,
>   I have a query...
> Is there any way to assign values ( NOT KEYS ) in to an array.
> whatta I want to mean
>    something like that :
>       @my_array = some_buildin_function_gets_values( %my_Hash );
> let me know if there is any
> Thanks in advance

Well, as far as you should care, a hash is really only a two associated
pair array.
So,
%blah ( oink=>"asdf1", oink2=>"asdf2" );
my $i = 1;
for ( %blah ) { push @array unless ( $i++ % 2 ); }

should do what you want.

Because for is actually foreach in disguise if used in any for other
than for ( ;; ) {}, it's looking for a list.  what's returned is the two
associated list stored in %blah -- ( oink, asdf, oink2, asdf2 ) ... in
reality, the "=>" is equiv to a comma, but you should use it in this
case for readability.  Anyways, if you only push in what's stored in $_
during the foreach loop when $i is mod 2, then you will always get the
second element in the hash list pair.
an alternative way to do this would be to do:
%blah ( oink=>"asdf1", oink2=>"asdf2" );
for ( keys %blah ) { push @array $blah{$_}; }

which is more readable, and probably not too much less efficient.  I
just gave the first example as a lesson.

hope this helps.


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

Date: Fri, 22 Aug 1997 14:12:18 -0600
From: frankel@cs.concordia.ca
Subject: beginner's help
Message-Id: <872276541.32290@dejanews.com>

I tried to use the hex function to convert hexadecimal to decimal.
Since hex() doesn't recognize negatif number, I check for it and I just
delete it.
Here's the code :

#!/site/bin/perl
print "Enter hexadecimal number: ";
$answer=<STDIN>;
 if ($answer= ~/^-/) {
	print "-";
        $answer= ~s/^-/""/;
}
print hex($answer),"\n";

It doesn't work, it tells me (for both positif or negatif number) :

Integer overflow in hex number at input.pl line 8, <STDIN> chunk 1.
-2492887701

Could you tell me what's wrong with the code ?	Please, post it here and
at frankel@cs.concordia.ca

			Thank You.

					Andras Frankel

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 22 Aug 97 17:59:34 GMT
From: "Rich Bailey" <ldusadev@kestrok.com>
Subject: Re: delayed execution of  a program??
Message-Id: <01bcb0b7$694b7d70$74027ece@rich>

Hi Dan:
I did look at the at facility. But since I want the user to provide the
time and day, then I use that date and time to start the isql process from
inside a perl script, but it was external to perl. It's a one-time shot, so
I don't think i want to use cron.
I figured perl had a system routine or someway of delaying execution of a
program. My perl script works fine ( I do a system(isql ...) ), but I just
want to add the capability to delay execution of the system(isql ...)
statement.
Maybe I'll just sleep for the time period just before doing the system fn.
call.
Thanks anyway,
Rich

Daniel E. Macks <dmacks@sas.upenn.edu> wrote in article
<5tjocd$l8j$1@netnews.upenn.edu>...
> If all you want is a way to say "execute this command at this time",
> then you don't need perl at all. Unix has a builtin facility for doing
> just this kind of job scheduling...look at the manpages for 'at' or
> 'cron' or 'crontab'. There's a similar thing for other (Mac, NT,
> VM/ESA, whatever) platforms. If you need to perform some sort of
> preliminary work in perl first, then just cron the perl script.
> 
> dan
> 
> Rich Bailey (ldusadev@kestrok.com) said:
> : Hi:
> : Does anyone know how to get perl to delay execution of another program.
The
> : user will specify the date and time, and I want my perl script to then
run
> : the program (called isql) at that date and time.
> : I guess I could sleep for the time difference then do a system(isql
 ..),
> : but there should be a more eloquent solution.
> : Thanks for any ideas,
> 
> -- 
> Daniel Macks
> dmacks@a.chem.upenn.edu
> dmacks@netspace.org
> http://www.netspace.org/~dmacks
> 
> 


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

Date: 22 Aug 1997 18:55:38 GMT
From: bsa@void.apk.net (Brandon S. Allbery KF8NH)
Subject: Re: efficient editing
Message-Id: <slrn5vro18.dr.bsa@rushlight.kf8nh.apk.net>

On 20 Aug 1997 08:54:57 GMT, M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
+-----
| Dean Hoover  <dhoover@textwise.com> wrote:
| >I'm trying to figure out the best way to change:
| >  \ to \\ and | to \V and & to \A
| >in one fell swoop, efficiently.
| s/([\\|&])/+{qw:\ \\ | \V & \A:}->{$1}/ge;
| Dunno if that's the most efficient, or even the most cryptic.
+--->8

    s/[\\|&]/\\\&/g;



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

Date: 22 Aug 1997 19:44:28 GMT
From: kisrael@allegro.cs.tufts.edu (Kirk L. Israel)
Subject: Forcing print<< to be VERY LITERAL
Message-Id: <5tkq6s$dna$1@d2.tufts.edu>


Is there any way to force print<<ENDofQUOTE to behave and do
no interpretation til the 'ENDofQUOTE'?  I'm having a perl script
that outputs a big block of complicated javascript (javascript that
writes javascript, in fact) and I need \n and \' to be saved for use
by the metajavascript--  I'll even sacrifice interpretation of 
$variables if need be.

(Why on earth does print<< need to interprete \n as carriage return 
anyway?  if I wanted a carriage return i would have hit carriage
return in the dang quote block!-- but even with that fixed I still
need to preserve \' )
Hopefully someone can suggest a solution that won't involve a 
whole new layer of slashes.  i'd like to write my perl as perl
and my javascript as javascript with out getting dizzy in a \\\ forest...

Many thanks
kirk



--
Kirk Is       | My brain racked 
kisrael@      |  with life, 
alienbill.com | yet all these thoughts 
              |  should comes to this:
              | despite all trials 
              |  and tribulations 
              | I still hunger 
              |  for your kiss 


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

Date: 22 Aug 1997 19:27:03 GMT
From: trockij@transmeta.com (Jim Trocki)
Subject: Re: foreach and arrays
Message-Id: <5tkp67$ci4$1@palladium.transmeta.com>

>denis@mathi.uni-heidelberg.de wrote:
>> 
>> hi,
>> 
>> i want to append cells in the middle of an array. i think the only way
>> is using splice. by how can i find out the offset i need, without
>> changing my foreach in a for to do...?
>> 
>> foreach $i (@array)
>> {
>> 
>>         if ($i=~ /xxx/) {
>>         #insert cell????
>>         }
>> }

for ($n=0;$n<@array;$n++) {
    if ($array[$n] =~ /xxx/) {
	#insert cell????
    }
}


-- 
Jim Trocki
Computer System and Network Engineer
Transmeta Corporation
Santa Clara, CA trockij@transmeta.com


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

Date: Fri, 22 Aug 1997 13:13:08 -0400
From: Greg Hassan <gwhassan@prodigy.net>
To: pegit.swedmap@mbox300.swipnet.se
Subject: Re: FORM SUBMIT on PerlIS doesn't work ?
Message-Id: <33FDC8A4.7829B765@prodigy.net>

Pinne wrote:

> Hi,
>
> Thanks everyone for the tips so far.
> I am t still trying to get my PerlIS
> to work on NT S 4.0 w IIS 3.0.
> I have a script that creates a form with
> some submit buttons on it.
> It works ok with Perl.exe, but when i click
> the buttons using PerlIS it seems like all the
> information isn't passed on to the Perl interpreter.
> Any suggestions ?

  I believe I had a similiar problem. I fixed it by changing the
form method to GET instead of POST.  I never asked why
because NT is not worth it. :)

-Greg

--
===============================================================
  Greg Hassan, The Independent Solution (CGI,Java,SQL,Perl...)
           http://www.hassan.com/, 1-701-235-3239
===============================================================
        Need a cool gift? http://www.hassan.com/cooie/
     Or Add your url to all of the Search Engines for FREE:
           http://www.hassan.com/superlinkadder/
===============================================================




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

Date: Fri, 22 Aug 1997 20:42:26 -0700
From: Thomas Fahle <thomas@fahle.de>
To: Juan Carlos Murillo <murillo@infocostarica.com>
Subject: Re: Help with perl scripts uploads
Message-Id: <33FE5C22.4722@fahle.de>

Juan Carlos Murillo wrote:
> 
> Can someone please tell me how I should upload my perl scripts in order
> to get them to work.
> 
> I use the 16 bit WSFTP for win 3.1.
                             ^^^^^^^^
Windose uses CR/LF at the end of each line.
Unix  LF.

to get rid of the cr, you have two possibilities:
1. Transfer the scripts in ascii mode.
2. use the dos2unix.exe and transfer it in binary mode.

Did you use  chmod ?


Thomas


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

Date: Fri, 22 Aug 1997 13:00:09 -0700
From: "Lic. Juan Carlos Murillo" <murillo@infocostarica.com>
Subject: Help with security of log file
Message-Id: <33FDEFC9.6671@infocostarica.com>

Hi everybody,

just a small question.

How do I write with a from a form to a script to a log file and make the
file only accesible to myself whem I'm teleneting using my userid. 
Someone said use umask but I'm at a loss as to how to do it.

Maybe it can be done by changing the permissions of the log file.  Any
ideas?


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

Date: 22 Aug 1997 18:52:45 GMT
From: mdkail@fv.com (Mike D. Kail)
Subject: Re: Help!! my dbm file crash everytime I try to build it.
Message-Id: <slrn5vro5n.k09.mdkail@dime.fv.com>

>Hi,
>
>I wrote a script to build a database management file for a search
>routine.
[...]
>It works fine for a smally site, but it crashes when the dbm file get
>big. The error message is as follow :
>
>- ndbm store returned -1, errno 28, key "school" at index.pl line 111,
><file> chunk 52.
>
>Any body know what is going on, please help (aung@seattleu.edu).

did you look at what errno 28 is?

   #define ENOSPC  28      /* No space left on device              */

my guess is you're running out of disk space


-- 
/*-------------------------------------------------------------*/
/*  Mike D. Kail                    |  voice:  (619) 350-3524  */
/*  Unix System Architect           |  fax:    (619) 793-2950  */
/*  FIRST VIRTUAL Holdings Inc.     |  e-mail: mdkail@fv.com   */
/*-------------------------------------------------------------*/



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

Date: 22 Aug 1997 19:25:49 GMT
From: q8e192@ugrad.cs.ubc.ca (Henry Avatar Chan)
Subject: Help: Perl
Message-Id: <5tkp3t$26b$1@nnrp.cs.ubc.ca>

Question 1)
How do you make CONSTANTS in Perl.
I remember seeing a cool example of how
someone make a reference to 3.14 to PI
or something.

Question 2)
How do I direct  STDERR and STDOUT in Perl
programmatically.  
I'm looking for the C equivalent to something
like freopen

Please email the soln to hc@ca.ibm.com

thx,
Henry


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

Date: 22 Aug 1997 19:51:11 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help: Perl
Message-Id: <5tkqjf$5f5@news-central.tiac.net>

In article <5tkp3t$26b$1@nnrp.cs.ubc.ca>,
Henry Avatar Chan <q8e192@ugrad.cs.ubc.ca> wrote:
>Question 1)
>How do you make CONSTANTS in Perl.
>I remember seeing a cool example of how
>someone make a reference to 3.14 to PI
>or something.

In recent perl distributions (5.004_03 being the latest off the presses)
there is a constant pragma:

NAME
       constant - Perl pragma to declare constants

SYNOPSIS
           use constant BUFFER_SIZE    => 4096;
           use constant ONE_YEAR       => 365.2425 * 24 * 60 * 60;
           use constant PI             => 4 * atan2 1, 1;
           use constant DEBUGGING      => 0;
           use constant ORACLE         => 'oracle@cs.indiana.edu';
           use constant USERNAME       => scalar getpwuid($<);
           use constant USERINFO       => getpwuid($<);

           sub deg2rad { PI * $_[0] / 180 }

           print "This line does nothing"              unless DEBUGGING;
 ...


>Question 2)
>How do I direct  STDERR and STDOUT in Perl
>programmatically.  
>I'm looking for the C equivalent to something
>like freopen

The perlfunc manual page contains this example:

               buffers.)  Here is a script that saves, redirects,
               and restores STDOUT and STDERR:

                   #!/usr/bin/perl
                   open(SAVEOUT, ">&STDOUT");
                   open(SAVEERR, ">&STDERR");

                   open(STDOUT, ">foo.out") || die "Can't redirect stdout";
                   open(STDERR, ">&STDOUT") || die "Can't dup stdout";

                   select(STDERR); $| = 1;     # make unbuffered
                   select(STDOUT); $| = 1;     # make unbuffered

                   print STDOUT "stdout 1\n";  # this works for
                   print STDERR "stderr 1\n";  # subprocesses too

                   close(STDOUT);
                   close(STDERR);

                   open(STDOUT, ">&SAVEOUT");
                   open(STDERR, ">&SAVEERR");

                   print STDOUT "stdout 2\n";
                   print STDERR "stderr 2\n";

               If you specify "<&=N", where N is a number, then
               Perl will do an equivalent of C's fdopen() of that
               file descriptor; this is more parsimonious of file
               descriptors.  For example:

                   open(FILEHANDLE, "<&=$fd")

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Fri, 22 Aug 1997 11:22:21 -0700
From: Bernard Gibbons <bernard510@hotmail.com>
Subject: How do I drop trailing spaces?
Message-Id: <33FDD8DC.51F2@hotmail.com>

I have a text string in $name and while I know it is no longer than 40
characters I don't know how many of these are trailing spaces.

How can I replace the contents of $name with the text string without the
trailing spaces?

I know the answer should be easy but I can't find it anywhere in my perl
books. Is there a function that trims a text string of trailing spaces?

Thanks for any help

Bernard Gibbons

bernard510@hotmail.com


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

Date: 22 Aug 1997 18:44:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How do I drop trailing spaces?
Message-Id: <5tkmmj$rss@news-central.tiac.net>

  $name =~ s/\s+$//;

is one wat to strip trailing whitespace from $name, check out the perl FAQ
(frequently asked questions)  at http://www.perl.com/FAQ/ for some other
ways as well as a good place to bookmark...  Recent perl distributions
come with a perlfaq manual page.

Hope this helps,

Mike

In article <33FDD8DC.51F2@hotmail.com>,
Bernard Gibbons  <bernard510@hotmail.com> wrote:
>I have a text string in $name and while I know it is no longer than 40
>characters I don't know how many of these are trailing spaces.
>
>How can I replace the contents of $name with the text string without the
>trailing spaces?

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Fri, 22 Aug 1997 13:31:15 -0400
From: Rob Starling <rstarling@btg.com>
Subject: Re: HTML-TEXT
Message-Id: <33FDCCE2.5238@btg.com>

use lynx's -dump option
(i.e. "lynx -dump http://blah/blah/blah")

--rob
#include <disclaimer.h>

Xu Chu wrote:
> 
> yeah, i am looking for this too. anyone who has the stuff pls send me one copy too. thx.
> 
> <b>Michael (Sandman) Sandler</b> <sandler@ren.eecis.udel.edu> wrote:
> : Before I re-invent the wheel:
> 
> : Does anyone have a utility to strip the HTML stuff out of
> : text (I want to use to read E-Mail that comes from stupid
> : people).  I can write one but will not if I someone else has.
> 
> : Mike Sandler
> : sandler@eecis.udel.edu
> 
> : PS: I can read it through the HTML but...save time/effort
> : --
> : -------------
> : Michael Sandler <sandler@eecis.udel.edu>
> : If you "C:>Win" you lose.
> 
> --
> wings
> ------
> You cannot learn anything unless you almost know it already.


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

Date: Fri, 22 Aug 1997 12:07:04 -0700
From: Y Chen <yinso@u.washington.edu>
Subject: is there a perl compiler ported to NT?
Message-Id: <Pine.OSF.3.96.970822115644.31017A-100000@saul9.u.washington.edu>

Hello,

got a question for all you perl gurus out there... do you know whether or
not Mr. Malcolm Beattie's compiler has been ported to NT?  I have run the
compiler under unix, however, I can't find one for NT yet.  If someone can
let me know where to find information about it, I will be grateful :)

thanks a bunch :)

yin-so	



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

Date: Fri, 22 Aug 1997 15:43:34 +0000
From: mbosley <mbosley@games-online.com>
Subject: Need WIN32's alternative for rename() (plz)
Message-Id: <33FDB3AC.13637220@games-online.com>

Hi all,

I usually do unix/linux programming, but I am working on a project on an NT
box right now and a minor problem has me kind of stumped.  When I use:

rename "$filename","$filename.old";

The interpreter either skips the line or fails on executing it.  I would guess
that it is not included in the WIN32's interpreter, but I have not been able
to find any information that it is not.

Do I have the syntax wrong?  If I do:

rename "$filename","$filename.old" || die "error, rename died";

it produces no error and just keeps right on flying.

As an alternative, I was going to write a simple function to read a file and
write it out to another file, but that would not eliminate the original file
(which happens to be a lock file).

I would prefer not to use:

open(KILL,"move $filename $filename.old |") || die "... blarg";

but I will if I have to.  Portability... right out the window :)

Any thoughts, suggestions, astral projections are greatly welcome.  If
possible, please cc to mbosley@games-online.com

Thanks!!!

michael


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

Date: Fri, 22 Aug 1997 18:45:07 -0700
From: Peter Staunton <pjs@iol.ie>
Subject: Newbie: where can I find exercises?
Message-Id: <33FE40A3.2356@iol.ie>

I'm a newcomer to perl and am looking for a collection of 
exercises for practice in writing code. Does anyone know of
such a collection on the 'net anywhere.

Any info is much appreciated!

Thanks,
Peter

pjs@iol.ie


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

Date: Fri, 22 Aug 1997 13:47:28 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Newbie: where can I find exercises?
Message-Id: <33FDDEC0.7A013578@gpu.srv.ualberta.ca>

Peter Staunton wrote:
> 
> I'm a newcomer to perl and am looking for a collection of
> exercises for practice in writing code. Does anyone know of
> such a collection on the 'net anywhere.
> 
> Any info is much appreciated!

I don't know any place with structured exercises on the net,
but you could always browse through the perltoc manpage 
(man perltoc or perldoc perltoc) and attempt to answer
any FAQ questions you find interesting and then you can
check the FAQ for answers... or you could use dejanews to
browse through this newsgroup's archive and pick out interesting
questions, then you can go back and compare your solutions to
the posted solution(s) to those questions.

the book "Learning Perl" 2nd ed, by Randal Schwartz and Tom
Christiansen (O'Reilly and Assoc) also has numerous excersises
with solutions (though its not on the 'net, it is recommended).

regards
andrew


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

Date: 22 Aug 1997 18:00:42 GMT
From: "Sergio Stateri Jr" <serginho@mail.serve.com>
Subject: NNTPClient Module
Message-Id: <01bcaf25$b7277b40$ca75e7c8@AFXTD_202.Autofax>

Hi ! I'm learning to use NNTPClient module, and in Win32 always's ok
(running a script in Win'95 DOS). I connect a news server and view the help
results command). But, in NT under Peer Web Service, I don't see anything.
The $server->help() method doesn't return anything. What's hapenning ? Is
it possible to use this module under Web environment ?

Thanks in advance !
-- 
--------------------------------------------------------------
Sergio Stateri Jr (Serginho)
Sao Paulo (SP) Brazil
e-mail : serginho@mail.serve.com
--------------------------------------------------------------


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

Date: 22 Aug 1997 19:24:21 GMT
From: trockij@transmeta.com (Jim Trocki)
Subject: Re: pack & format
Message-Id: <5tkp15$ci0$1@palladium.transmeta.com>

In article <33FD8415.3F6F@icp.grenet.fr>,
Joelle D'Antin & Nicolas Gregoire  <dantin@icp.grenet.fr> wrote:
>hi,
>i want to use pack to put a record in my database.
>so, i do $value=pack($foramt, $name, $age, $comment);
>but i don't know the length of $comment.
>How to do without A.. (perhaps with p i can't make it works)

Use a "*" for the repeat count of the final element of your $format
template. This will suck up the whole string. For example:

$n = pack ("A*", "Hello");

-- 
Jim Trocki
Computer System and Network Engineer
Transmeta Corporation
Santa Clara, CA trockij@transmeta.com


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

Date: Fri, 22 Aug 1997 12:46:16 -0400
From: Greg Hassan <gwhassan@prodigy.net>
To: Eduardo da Fonseca Melo <efm@di.ufpe.br>
Subject: Re: PERL & WinNT
Message-Id: <33FDC258.AD4C5C76@prodigy.net>

Eduardo da Fonseca Melo wrote:

> Hi all,
>
> we disabled the directory listing in WinNT Internet Information Server
>
> (IIS) , but we need the listing of one directory. Then we made the
> following script ( we adapted if from a search script ), but it
> doesn't
> work. The NT returns the following error message:
>
> HTTP/1.0 403 Access Forbidden (Read Access Denied -
> This Virtual Directory does not allow objects to be read.)
>
> What's even more strange is that the same code works in another WinNT
> server as you can see in www.mundi.com.br/scripts/direfm.pl
>
> What should we do in order to make to script work?
>

if it works on another server and you get that error, I would say that
you
don't have perl setup correctly on your server.   Do you have other
perl scripts running in that directory with the ext. .pl?

if not then you should problem just go to activeware's web site
and redownload their version of perl.  When you install it, it will
setup
the appropiate file associations for you.  Or you can read in the
win32perl FAQ about how to setup file associations in the nt registry .

-Greg

--
===============================================================
  Greg Hassan, The Independent Solution (CGI,Java,SQL,Perl...)
           http://www.hassan.com/, 1-701-235-3239
===============================================================
        Need a cool gift? http://www.hassan.com/cooie/
     Or Add your url to all of the Search Engines for FREE:
           http://www.hassan.com/superlinkadder/
===============================================================




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

Date: 22 Aug 1997 16:32:56 GMT
From: "Sergio Stateri Jr" <serginho@mail.serve.com>
Subject: podman in Win32
Message-Id: <01bcaf19$73f65d20$ca75e7c8@AFXTD_202.Autofax>

Hi! Is there any way to create the man pages in Win32 ?

thanks in advance!

-- 
--------------------------------------------------------------
Sergio Stateri Jr (Serginho)
Sao Paulo (SP) Brazil
e-mail : serginho@mail.serve.com
--------------------------------------------------------------


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

Date: 22 Aug 1997 19:41:43 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Reading in a file for use...
Message-Id: <nqowwlexgh4.fsf@mitra.phys.uit.no>


Doug Seay <seay@absyss.fr> writes:
> This could be done in one line [...] using Randal's map() toy

To you it might be a toy.  To me it's one of the most useful tools
even for a Perl toolchest.

> 	print map { $_ = "Line is $_"; } @Contents;

Yes.  Now didn't that feel good?

> - doug

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Fri, 22 Aug 1997 14:36:20 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: Redirecting output......
Message-Id: <33FDDC24.A15@ny.ubs.com>

Donk! (sound of palm on head).

I looked at '>>' in John's script and somehow saw '2>'--which is what I 
put into my test script that replicated his problem. Switching that to
'>' got the expected/desired results, thence to the reply--again missing
the
obvious.

But when I put the 'correct' operator ('>>') into my test script, I get
the results 
I would have expected--the target file gets appended to on each run
quite nicely,
thank you.

So then, what is going on here? John's original approach works for me,
backticks
and all. As far as I can tell, switching backticks for a call to
'system' makes 
no difference. So if it's not backticks vs. system, and its not the sink
for the
redirection, then what is it?

And a second, more general question: what, exactly, is wrong with using
backticks even 
if you don't care about the return. I've seen the assertion that you
should use 'system' 
instead, but never any real justification for the assertion. To continue
your anology, 
if I have a nice, general purpose tool that both turns and pounds, and
pounds as well 
as a hammer, why carry around the extra tool? Why bother with the hammer
if it doesn't 
give me something extra? What would cause me to hit the wrong nail?


Tad McClellan wrote:
> 
> Glen Culbertson (nnyxcu@ny.ubs.com) wrote:
> : John Devlin wrote:
> : >
> : > I am running a server level cobol program which is executed by a script.
> : > The output of this program is displayed to the screen.  How do redirect
> : > this output to a file in PERL?  I tried the following, but it did not
> : > work:
> : >
> 
> : I think the problem is in your redirection--you probably want STDOUT
>   ^^^^^^^^^^^^^^^^^^^^^^
> 
> I think the problem is that you use backticks when you want to
> *capture the output* into your Perl script.
> 
> You are using a wrench for a hammer if you are using backticks to put
> the output somewhere else (it may mostly work, but you are eventually
> going to hit the wrong nail).
> 
> Just use system() (or a pipe open()) instead.
> 
> : rather
> : than STDERR.
> 
> I'm looking at the below, but I'm not seeing any redirections of STDERR
> at all.
> 
> Where is he specifying STDERR?
> 
> : > $_ = `cd /directory_where_the_executable_script_resides; ./script >>
> :                                                                     ^^
> 
> That is STDOUT there...
> 
> :                                                                     >
> 
> That is also STDOUT...
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@flash.net                        Perl programming
>     Fort Worth, Texas


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

Date: Fri, 22 Aug 1997 10:12:52 -0800
From: rknig@NOSPAM.jsnet.com (Roddy Knight)
Subject: Re: server name
Message-Id: <rknig-ya02408000R2208971012520001@nntp.ix.netcom.com>

I believe you can just do a "system(hostname);" call.  You can also say
$host = `hostname`;

In article <33FDBC90.4FCE@computize.com>, Danny LaPrade
<dannyl@computize.com> wrote:

> How can you retrieve the server name in perl?
> 
> -- 
> --------------------------------------------------------------
> --  Danny LaPrade                                      
> --  Advertising - Web Development           
> --  1030 Wirt Road #400                                      
> --  Houston, Texas 77055-6849                          
> --  713.957.0057                                     
> --  713.613.4812 Fax                                          
> --                                                                     
> --  http://www.computize.com/                 
> --------------------------------------------------------------
> 
> "Hold on to your dreams while pulling
>          through the present.         "

-- 
Remove "NOSPAM" from e-mail address to send e-mail


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

Date: Fri, 22 Aug 1997 12:26:42 -0500
From: Danny LaPrade <dannyl@computize.com>
Subject: Re: server name
Message-Id: <33FDCBD2.5E66@computize.com>

Let me be more specific...

 I am doing a script for the web (CGI)
 I want to know the servername of each person 
 who visits my page.

-- 
--------------------------------------------------------------
--  Danny LaPrade                                      
--  Advertising - Web Development           
--  1030 Wirt Road #400                                      
--  Houston, Texas 77055-6849                          
--  713.957.0057                                     
--  713.613.4812 Fax                                          
--                                                                     
--  http://www.computize.com/                 
--------------------------------------------------------------

"Hold on to your dreams while pulling
         through the present.         "


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

Date: 22 Aug 1997 19:45:56 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <nqovi0yxga3.fsf@mitra.phys.uit.no>


Bart Lateur wrote:
> > Note that you get a "good" OCR if you only ask questions, and a "bad"
> > OCR ratio if you only answer them. As in my case.

To which Doug Seay <seay@absyss.fr> answers:
> True, but if you prune down most of the question, then the ratio is
> better.  I think most of the "answering crowd" has less than 50% OCR. 
> And it is better to have a low OCR than to not answer the questions

True, there's some unnecessary inclusion, but it's not annoying.
Sometimes the answer can be shorter and more succinct (and thus low
OCR) if you have the question in front of you.

> - doug

Whoops, better put some original content in here.

original, original, original.
original, original, original.
original, original, original.

Now, wasn't *that* original?

(To those who saw that in c.l.p.modules previously, my apologies again)

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Fri, 22 Aug 1997 13:49:32 -0400
From: Joe Kline <Joe.Kline@sdrc.com>
Subject: uninit'd value annoyance
Message-Id: <33FDD12C.1CFB@sdrc.com>

Group,

I have a script that works ok, but I get the following
warning/error following some testing output:

output=>button   : button1

warning I get:
     Use of uninitialized value at: 
     /gekline/test7/qppg_repgen.pm line 117, <STATS> chunk 1.

My output and everything come out ok, the program does
what I want it to, but it's just that I
can't figure out why I am getting this warning which 
I find annoying.

if ( ($button ne "button3") && ($button ne "button7" ) )
^^^^^^^^^^^^^^line117

I find it mostly annoying since the only variable used
at line 117 (see code in a larger context below) has a value
just before it enters the conditional. I've surrounding the thing
with print statements and I still get no insight. (maybe I better
bone up on using perl's debugger..)

Thanks for eyeballing the code,

joe


=======================================================================

#! /usr/local/bin/perl5 -w

use strict;

package qppg_repgen;

sub make_reps
{
    my ($work_ref, $groups_ref, $button_ref);
    ($work_ref, $groups_ref, $button_ref) = @_;
    
    my ($but);
    my (%count,%stat,%grand);
    %count = %stat = %grand = ();

    my ($button,$file,$key,$value,$rec,$field);   
  BUT:foreach $but ( @{ $work_ref->{"buttons"} } )
  {
      $button = "button$but";

      print STDOUT "button: $button\n";

    GROUP:foreach $group ( sort @{ $button_ref->{$button}{"groups"} } )
    {
        open (STATS,"<$stat_file")
            or die "Can't open $stat_file: $!";
        while ( <STATS> )
        {
            chomp;
            next unless s/^(.*?):\s*//;
            $rec = $1;
            foreach $field ( split )
            {
                ($key,$value) = split (/=/, $field);
                $count{$rec}{$key} += $value;
                $stat{$rec}{$key} = $value;
                ####
                # Line that doth offends
                ####
                if ( ($button ne "button3") && ($button ne "button7" ) )
                 ^^^^^^^^^^^line 117
                #####
                #
                #####
                {
                    $grand{$group}{$rec}{$key} += $value;
                }
            }
        } # while
    } # GROUP
  }   # BUT


___STATS____
gtot:loc=0 tot=36 
p0:loc=0 tot=0 
p1:loc=0 tot=9 
p2:loc=0 tot=27

___buttons file/hash of lists_______
=r=
:3:
:4:
:5:

=database=
:Q:

=status=
:O:

=grps=
:A:
:N:
:M:
:D:
:H:
:P:
:G:
:R:
:Q:
:all:


--

/===================================================\
| Joe Kline                       | Try not.        |
| Quality Maintenance and Support | Do or do not.   |
| Product Modeling                | There is no try.|
| Phone (513) 576-5839            |                 |
| E-Mail: Joe.Kline@sdrc.com      |      -Yoda      |
\===================================================/


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

Date: Fri, 22 Aug 1997 14:03:29 -0400
From: John Smyczynski <jmski@grapevinenet.com>
Subject: Re: What is this EOF error?
Message-Id: <33FDD471.1C5A@grapevinenet.com>

Hedin Meitil wrote:
> 
> When I run the script below, I get the error message "EOF in string at
> hellow.pl line 5." Why?
> 
> #!/usr/bin/perl
> 
> print "Content-type: text/html\n\n";
> 
> print <<endHTML;        # This is line 5
> <html><head></head>
> <body>
> <p>
> 
> Hello World!
> </body>
> </html>
> 
> endHTML

Try print <<("HTML");
or  print <<"HTML";

and end with

HTML


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

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

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