[19511] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1706 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 6 18:05:30 2001

Date: Thu, 6 Sep 2001 15:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <999813909-v10-i1706@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 6 Sep 2001     Volume: 10 Number: 1706

Today's topics:
    Re: bad header <gnarinn@hotmail.com>
    Re: cant send with GD generated image :(( <romanjoost@gmx.de>
    Re: Confused (again) over complex data structures. <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Confused (again) over complex data structures. (Stan Brown)
    Re: Confused (again) over complex data structures. (Randal L. Schwartz)
    Re: Daily iteration <sh@planetquake.com>
        DBI error in Apache setting (Jiqun Wang)
    Re: DBI error in Apache setting <tom.hoffmann@worldnet.att.net>
    Re: form input changed from Select to hidden, no errors <dmartin119@home.com>
    Re: Genericly printing the arguments to s afunction? (Tad McClellan)
    Re: Genericly printing the arguments to s afunction? (Stan Brown)
    Re: Genericly printing the arguments to s afunction? (Malcolm Dew-Jones)
    Re: How can I wait in perl? <gnarinn@hotmail.com>
    Re: need a loop command <mjcarman@home.com>
    Re: need a loop command <krahnj@acm.org>
        non-blocking Socket IO problem?  Help Req. <nv140a@boeing.com>
    Re: Permissions - Is nobody better? (Chris Fedde)
        reading lines from a file (Neil Elder)
    Re: reading lines from a file <krahnj@acm.org>
    Re: reading lines from a file (David Wall)
    Re: Regular Expression puzzle... <fredcoyoteno@spamgo.com>
        Status window <lhswartw@ichips.intel.com>
    Re: Status window <lhswartw@ichips.intel.com>
    Re: Storing a socket in an object. <gnarinn@hotmail.com>
    Re: Undef'ing multiple variables <tinamue@zedat.fu-berlin.de>
    Re: Undef'ing multiple variables <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Undef'ing multiple variables (Malcolm Dew-Jones)
    Re: win32 rmdir questions <stevea@wrq.com>
    Re: Win32:API module installation on a stand alone mach <thedannunn@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 6 Sep 2001 18:26:13 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: bad header
Message-Id: <999800773.570819896180183.gnarinn@hotmail.com>

In article <3B969A8E.3FD15620@country-life.com>,
Matt Carey  <mattc@country-life.com> wrote:
>I have a perl program which accepts input from an html form where a user
>can enter comments in a text area.(using Apache,Linux)
>When the form is submitted, the perl program stores the user input in a
>variable($parameter) and then executes a shell command passing the
>variable to a perl program on another machine(HP-UNIX) where the data
>gets written out to a file.
>
>$runcommand = "rsh machine /usr/bin/nsperl
>/u/data/CONSAC/SRC.PERL/runuvprog.pl $parameter";
>system ($runcommand);

bad bad bad BAD
consider what happens if the input contains: |rm -Rf /*

if you want to to use rsh, at least transform $parameter into some
harmless form, for example, you could urlencode it or something
make sure that at least all characters other than a-zA-Z are encoded
this will solve your error, because then no linefeeds will be emitted into
your system() commandline
the program on the other end, must decode the argument, of course.

but why use rsh?
why not let your cgi generate the file, and then just copy it over.
or you could just put it into a queue directory, and let some other
process copy the files over. this way, the cgi will not have to wait
for the other server.


>
>When the shell command returns the perl program reads in an html
>page(stating that the form has been received) from a file and prints it
>out to the browser.
>
>sub print_page{
> print "Content-type: text/html\n\n";
> open(INFILE, "<$infile");
>  while(<INFILE>){
>    print;
>    }
> close(INFILE);
>}
>
>This works fine when only one line of text has been input in the text
>area. When I submit the form after having entered more than one line of
>comments in the text area(and the text has wrapped) then I get an error
>message:
>

this happens because you have not yet printed the Content-type: line
when you do the system(). if that results in some output, that will
be sent to the webserver before the Content-type:

to be safe, you should 
  a) $|=1;
  b) print the  Content-type: line
  c) call the system
in this order

gnari


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

Date: Thu, 06 Sep 2001 20:18:20 +0200
From: Roman Joost <romanjoost@gmx.de>
Subject: Re: cant send with GD generated image :((
Message-Id: <9n8elt$5qmo5$1@ID-63142.news.dfncis.de>

Chris Fedde wrote:

> In article <9n83e5$64cc4$1@ID-63142.news.dfncis.de>,
> Roman Joost  <romanjoost@gmx.de> wrote:
>>Hi!
>>
>>$mail->attach(Type      =>'image/png',
>>                Path    => $png_data,
>>                Disposition=>'attachment'
>>        );
>>
> 
> 
> I think that you want 'Data => $ping_data' instaid of Path.
> 
> Good luck!
> 

Thats it! Thanks a lot!!

Greetings Roman..

--------------------------
www: http://www.romanofski.de


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

Date: Thu, 06 Sep 2001 20:17:04 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Confused (again) over complex data structures.
Message-Id: <3B97BDA0.4010204@post.rwth-aachen.de>

Stan Brown wrote:

>  foreach (@$records_array_ref)
>  {
> 	 $stho->execute (@$records_array_ref->[$i++]);
>  }
> 
>  But what is getting put in the DB are the references, not the data.
> 
>  What am I doing wrong?

Not long ago there was a discussion here whether better to use the 
full-blown way of dereferencing a variabile (@{$ref}) or rather the 
shortcut (@$ref). In your case these two are not equivalent and you have 
to say:

$stho->execute ( @{$records_array_ref->[$i++]} )

Both Uri and Randal in general spoke in favour of the notation with the 
curly brackets. The advantage over the shortcut is that this will always 
work and you wont accidently run into errors. It's also sort of an 
eye-catcher: @{ } indicating: Hey, this is a dereferenced array!

Tassilo

-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: 6 Sep 2001 14:56:16 -0400
From: stanb@panix.com (Stan Brown)
Subject: Re: Confused (again) over complex data structures.
Message-Id: <9n8gsg$9q6$1@panix1.panix.com>

In <3B97BDA0.4010204@post.rwth-aachen.de> Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> writes:

>Stan Brown wrote:

>>  foreach (@$records_array_ref)
>>  {
>> 	 $stho->execute (@$records_array_ref->[$i++]);
>>  }
>> 
>>  But what is getting put in the DB are the references, not the data.
>> 
>>  What am I doing wrong?

>Not long ago there was a discussion here whether better to use the 
>full-blown way of dereferencing a variabile (@{$ref}) or rather the 
>shortcut (@$ref). In your case these two are not equivalent and you have 
>to say:

>$stho->execute ( @{$records_array_ref->[$i++]} )

>Both Uri and Randal in general spoke in favour of the notation with the 
>curly brackets. The advantage over the shortcut is that this will always 
>work and you wont accidently run into errors. It's also sort of an 
>eye-catcher: @{ } indicating: Hey, this is a dereferenced array!

Thanks that works.

I geuss I see the point. Useing something that only works "sometimes" is
pobably a bad idea (tm).

So why does  @{$records_array_ref->[$i++]} work
and @$records_array_ref->[$i++] not work, in this case? 

I'm still trying to get a good handle on this.


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

Date: 06 Sep 2001 12:18:23 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Confused (again) over complex data structures.
Message-Id: <m1bsko162o.fsf@halfdome.holdit.com>

>>>>> "Stan" == Stan Brown <stanb@panix.com> writes:

Stan> So why does  @{$records_array_ref->[$i++]} work
Stan> and @$records_array_ref->[$i++] not work, in this case? 

Because you can delete {} only when it encloses a simple scalar, which
means the second one is

        @{$records_array_ref}->[$i++]

which means to evaluate @$records_array_ref in a scalar context
(yielding a length), dereference the number as a symref, use that as
an array name, go to the element $i++ of that array.  Unless you have
an array named @4 or something, you aren't likely to get a useful
result. :)

P.S., yes, I know there's a bug in the current implementation that
makes @a->[3] act *incorrectly* like $a[3], but that's a different
story.

P.P.S. Yes, Perl6 is even more bizarre here, and will even do the right
thing for this, modulo the odd syntax. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 06 Sep 2001 19:54:32 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: Re: Daily iteration
Message-Id: <YvQl7.5148$C57.684838@news1.telusplanet.net>

This is hardly a wheel. It should be a simple correction for when we are in
DST. A one-liner.

sh

"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1y9ns30zi.fsf@halfdome.holdit.com...
> >>>>> "Sean" == Sean Hamilton <sh@planetquake.com> writes:
>
> Sean> Woah, major misconception.
> Sean> I'm trying to draw a calendar (via CGI) with the first visible day
set to
> Sean> today.
>
> See HTML::CalendarMonthSimple in the CPAN.
> Don't reinvent the wheel.
>
> print "Just another Perl hacker,"
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!




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

Date: 6 Sep 2001 11:53:25 -0700
From: jwang@maill.com (Jiqun Wang)
Subject: DBI error in Apache setting
Message-Id: <c984ba95.0109061053.4b1ba65@posting.google.com>

All,

When I input "PerlModule DBI" in httpd.conf file of Apache.
Apache won't restart.
The error log of it shows:
[Thu Sep 06 13:29:19 2001] [notice] FastCGI: process manager
initialized
Can't locate object method "trace_msg" via package "DBI" at
D:\Apps\ORACLE\iSuites\Apache\Perl\site\5.00503\lib/DBI.pm line 345.
END failed--cleanup aborted.
run: No error
-----------------------------------------
The End block of DBI.pm (line 345) looks like:
END {
    return unless defined &DBI::trace_msg; # return unless bootstrap'd
ok
    local ($!,$?);
    DBI->trace_msg("    -- DBI::END\n", 2);
    # Let drivers know why we are calling disconnect_all:
    $DBI::PERL_ENDING = $DBI::PERL_ENDING = 1;	# avoid typo warning
    DBI->disconnect_all() if %DBI::installed_drh;
}
--------------------------------------

During my DBI building process, no error msg displayed. I am on NT,
Perl 5.00503, DBI1.19

Could anyone give me some help?
Thanks a lot.


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

Date: Thu, 06 Sep 2001 22:02:36 GMT
From: Tom Hoffmann <tom.hoffmann@worldnet.att.net>
Subject: Re: DBI error in Apache setting
Message-Id: <0oSl7.12781$151.1064469@bgtnsc05-news.ops.worldnet.att.net>

On Thursday 06 September 2001 14:53, Jiqun Wang wrote:

> When I input "PerlModule DBI" in httpd.conf file of Apache.

And why are you trying to put this in your httpd.conf file? It is *not* 
an Apache directive. It is no wonder Apache chokes on it.

DBI is a Perl module. If you are trying to use the DBI module in your 
Perl scripts, then simply put a:

use DBI;

statement in your script. You will also need to install the DBD module 
that corresponds to your database, e.g. DBD::Oracle, but you do not 
need a 'use DBD;' statement in your Perl script, only 'use DBI;'


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

Date: Thu, 06 Sep 2001 19:51:31 GMT
From: "JerryGarciuh" <dmartin119@home.com>
Subject: Re: form input changed from Select to hidden, no errors and no search results
Message-Id: <7tQl7.160463$oh1.67993409@news2.rdc2.tx.home.com>

First off thanks for the response!
Per the request I am posting the pertinent bits.  I'm trying to be thorough
so I have included both versions of the html as well as the Search
subroutine which uses the vars in question (case and boolean) from the
script.  I'm sorry if I am clouding the issue:

Ok here is original version of html which works:

<form method=POST action="http://www.mysite.com/cgi-bin/search.pl">
<center><table border>
<tr>
<th>Text to Search For: </th><th><input type=text name="terms"
size=40><br></th>
</tr><tr>
<th>Boolean: <select name="boolean">
<option>AND
<option>OR
</select> </th> <th>Case <select name="case">
<option>Insensitive
<option>Sensitive
</select><br></th>
</tr><tr>
<th colspan=2><input type=submit value="Search!"> <input
type=reset><br></th>
</tr></table></center></form>

Here is modified version which *works* but never finds anything:

<form method=POST action="http://www.mysite.com/cgi-bin/search.pl">
<center>
    Text to Search For:
    <input type="hidden" name="boolean" value="AND">
    <input type="hidden" name="case" value="Insensitive ">
    <input type=text name="terms" size=40>
    <input type=submit value="Search!" name="submit">
  </center></form>

And here is the Search subroutine which uses the vars case and boolean:

sub search {

   @terms = split(/\s+/, $FORM{'terms'});

   foreach $FILE (@FILES) {

      open(FILE,"$FILE");
      @LINES = <FILE>;
      close(FILE);

      $string = join(' ',@LINES);
      $string =~ s/\n//g;
      if ($FORM{'boolean'} eq 'AND') {
         foreach $term (@terms) {
            if ($FORM{'case'} eq 'Insensitive') {
               if (!($string =~ /$term/i)) {
                  $include{$FILE} = 'no';
      last;
               }
               else {
                  $include{$FILE} = 'yes';
               }
            }
            elsif ($FORM{'case'} eq 'Sensitive') {
               if (!($string =~ /$term/)) {
                  $include{$FILE} = 'no';
                  last;
               }
               else {
                  $include{$FILE} = 'yes';
               }
            }
         }
      }
      elsif ($FORM{'boolean'} eq 'OR') {
         foreach $term (@terms) {
            if ($FORM{'case'} eq 'Insensitive') {
               if ($string =~ /$term/i) {
                  $include{$FILE} = 'yes';
                  last;
               }
               else {
                  $include{$FILE} = 'no';
               }
            }
            elsif ($FORM{'case'} eq 'Sensitive') {
               if ($string =~ /$term/) {
    $include{$FILE} = 'yes';
                  last;
               }
               else {
                  $include{$FILE} = 'no';
               }
            }
         }
      }
      if ($string =~ /<title>(.*)<\/title>/i) {
         $titles{$FILE} = "$1";
      }
      else {
         $titles{$FILE} = "$FILE";
      }
   }
}

Thanks very much for your help!
jg



----- Original Message -----
From: "Chris Fedde" <cfedde@fedde.littleton.co.us>
Newsgroups: comp.lang.perl.misc
Sent: Thursday, September 06, 2001 11:09 AM
Subject: Re: form input changed from Select to hidden, no errors and no
search results


> In article <CBMl7.160097$oh1.67793303@news2.rdc2.tx.home.com>,
> JerryGarciuh <dmartin119@home.com> wrote:
> >Hi,
> >I'm working on modifying a the MSA Simple Search script for my site.
It's
> >written in perl.  The bug I have encountered is that when I changed the
> >boolean and case Select fields into hidden fields the script still runs
> >without error but returns no results even though the results display the
> >vars and they are the same whichever way I do it.  So the script is
> >receiving the vars, putting them in into the mix but somehow then
> >eliminating all the results.  I triple checked spelling and case between
the
> >2 setups and they match.
> >Any suggestions?
> >TIA
> >jg
> >
>
> Post a small but complete code segment that exhibits the problem.
> Maybe then we can see what is going on and make a suggestion.
> --
>     This space intentionally left blank





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

Date: Thu, 06 Sep 2001 18:21:37 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <slrn9pfcr9.508.tadmc@tadmc26.august.net>

Stan Brown <stanb@panix.com> wrote:
>In <mbudash-5A80D6.09300106092001@news.sonic.net> Michael Budash <mbudash@sonic.net> writes:
>
>>In article <9n87g3$ao8$1@panix1.panix.com>, stanb@panix.com (Stan 
>>Brown) wrote:
>
>>> I was wondering if there is a generic way
>>> to print the values of the argumnets to a given function?

>>uh, print "@_" ?? or did i miss something??
>
>Well, I was looking for somthieng that would generate output liek:
>
>Arg1 ->1<-, Arg2 ->xyz<- ....


   print join ', ', map { "Arg$_ ->$_[$_]<-" } 0 .. $#_;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Sep 2001 14:43:16 -0400
From: stanb@panix.com (Stan Brown)
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <9n8g44$87q$1@panix1.panix.com>

In <9n8bub$5viq8$1@fu-berlin.de> Tina Mueller <tinamue@zedat.fu-berlin.de> writes:

>Stan Brown <stanb@panix.com> wrote:
>> Having just discovered the recipie in the Perl Cookbook for using caller()
>> to print the name of a function, I was wondering if there is a generic way
>> to print the values of the argumnets to a given function?

>hm, that should be easy...
>use Data::Dumper;
>...
>print Dumper \@_;

Hmm, that looked good at first glance, but in practice, it provides _ro
much_ information.

I really don't want to derference all those huge rferences that get passed
around. The manual debug lines I had, just printed the reference itself.

An thoughts on how to simulate them, without having to hand code _each_
function?



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

Date: 6 Sep 2001 12:19:57 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <3b97cc5d@news.victoria.tc.ca>

Stan Brown (stanb@panix.com) wrote:
: In <9n8bub$5viq8$1@fu-berlin.de> Tina Mueller <tinamue@zedat.fu-berlin.de> writes:

: >Stan Brown <stanb@panix.com> wrote:
: >> Having just discovered the recipie in the Perl Cookbook for using caller()
: >> to print the name of a function, I was wondering if there is a generic way
: >> to print the values of the argumnets to a given function?

: >hm, that should be easy...
: >use Data::Dumper;
: >...
: >print Dumper \@_;

: Hmm, that looked good at first glance, but in practice, it provides _ro
: much_ information.

: I really don't want to derference all those huge rferences that get passed
: around. The manual debug lines I had, just printed the reference itself.

: An thoughts on how to simulate them, without having to hand code _each_
: function?


Modify Data::Dumper so it only recurses to a maximum depth, perhaps?



--
Want to access the command line of your CGI account?  Need to debug your
installed CGI scripts?  Transfer and edit files right from your browser? 

What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi


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

Date: Thu, 6 Sep 2001 18:06:43 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: How can I wait in perl?
Message-Id: <999799603.608076144941151.gnarinn@hotmail.com>

In article <9n5o0v$k40$1@newsy.ifm.liu.se>,
Jonas Nilsson <jonni@ifm.liu.nospam.se> wrote:
>I wan't to execute a subroutine every 5 seconds or so. How can I make perl
>wait some time without using something processor killer-stupid like:
(snip)

perldoc -f sleep

gnari


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

Date: Thu, 06 Sep 2001 14:31:43 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: need a loop command
Message-Id: <3B97CF1F.BA7AB719@home.com>

    Content-Type: multipart/alternative; 

Please don't do that. Usenet is a text only medium.

Mark Pennington wrote:
> 
> I need to make a loop in perl for a problem that I am working on.

Perl has several looping constructs. Take your pick:
    for
    foreach
    while 
    map (if you're feeling frisky)
    grep (if you're feeling really frisky)

> One example is as follows: 
> [snip]
> Does anyone have any ideas on how to make a loop for this problem??

What problem? All you did is describe some data and say that you wanted
a loop.

-mjc


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

Date: Thu, 06 Sep 2001 21:28:39 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: need a loop command
Message-Id: <3B97EAFF.366B3DD9@acm.org>

Michael Carman wrote:
> 
>     Content-Type: multipart/alternative;
> 
> Please don't do that. Usenet is a text only medium.
> 
> Mark Pennington wrote:
> >
> > I need to make a loop in perl for a problem that I am working on.
> 
> Perl has several looping constructs. Take your pick:
>     for
>     foreach
>     while
>     map (if you're feeling frisky)
>     grep (if you're feeling really frisky)

      until
      LABEL: {}; goto LABEL;
      do {} while ();
      do {} until ();



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 6 Sep 2001 20:39:41 GMT
From: nv140a <nv140a@boeing.com>
Subject: non-blocking Socket IO problem?  Help Req.
Message-Id: <3B97DF0D.4082A6E6@boeing.com>

Hello

I have a program that uses IO:Socket to connect to another black box on
a different host.  If for some reason that host program terminates i.e.
the connection is broken, my program hangs trying to read the socket. 
Eventually the program dumps but not for a long time.  What I need is to
reopen the listen socket and await another connect.  I believe the
problem revolves around the blocking IO used, but I am unsure. 

If you know how to set the socket to non-blocking IO or what the real
problem is please let me know.  Post a reply.

Thank you,
Lynwood Stewart


relevant code, there is more but I don't think it is involved.

use IO::Socket;

$Socket = IO::Socket::INET->new
                      (LocalPort => $Port,
                       Type      => SOCK_STREAM,
                       Proto     => "tcp",
                       Reuse     => 1,
                       Listen    => SOMAXCONN );
$count = sysread ( $Socket, $buffer, $length );


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

Date: Thu, 06 Sep 2001 18:20:46 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Permissions - Is nobody better?
Message-Id: <28Pl7.168$Owe.192140800@news.frii.net>

In article <23953-3B97A8C1-30@storefull-244.iap.bryant.webtv.net>,
BUCK NAKED1 <dennis100@webtv.net> wrote:
>[I thought I should repost this with a more appropriate subject line]
>
>At other Linux hosts, I was also running as "user" and this script
>worked; but this host says in order for it to work, he'll have to change
>the ownership on that script, and  run it as "nobody". Is this the only
>way to do it? I really don't want to lose the security of running
>scripts as "myself".
>

I suspect that this is  more a web server issue than it is a perl
issue.  Try asking in a group that has www somewhere in it's title.

On the off chance that you are using Apache you might take a look at
http://httpd.apache.org/docs/suexec.html and see if that gives you any
hints that might be useful.

good Luck!
-- 
    This space intentionally left blank


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

Date: 6 Sep 2001 14:02:55 -0700
From: neil.elder@teradyne.com (Neil Elder)
Subject: reading lines from a file
Message-Id: <ae7a3dc9.0109061302.5f08793a@posting.google.com>

The piece of script works fine in UNIX but not in NT. It is designed
to read lines in a file called dir.pass. The file opens ok, $fail
returns 1, but I can't get it to read the lines of the file into an
array. $tem has no value initially.
Can anyone help?


$fail = open(SFILE, ">D:/inetpub/wwwroot/directlink/resumetrack/dir.pass");
$linenum = 0;
while ($tem =<SFILE>) {
	chomp $tem;
	$pass[$linenum++] = $tem;
	}
close SFILE;


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

Date: Thu, 06 Sep 2001 21:34:24 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: reading lines from a file
Message-Id: <3B97EC57.52285826@acm.org>

Neil Elder wrote:
> 
> The piece of script works fine in UNIX but not in NT. It is designed
> to read lines in a file called dir.pass. The file opens ok, $fail
> returns 1, but I can't get it to read the lines of the file into an
> array. $tem has no value initially.
> Can anyone help?
> 
> $fail = open(SFILE, ">D:/inetpub/wwwroot/directlink/resumetrack/dir.pass");
> $linenum = 0;
> while ($tem =<SFILE>) {
>         chomp $tem;
>         $pass[$linenum++] = $tem;
>         }
> close SFILE;

Try it this way:

#            v  open file for INPUT
open(SFILE, "< D:/inetpub/wwwroot/directlink/resumetrack/dir.pass')
    or die "Cannot open
'D:/inetpub/wwwroot/directlink/resumetrack/dir.pass': $!";
chomp( my @pass = <SFILE> );
close SFILE:



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 06 Sep 2001 21:57:23 -0000
From: darkon@one.net (David Wall)
Subject: Re: reading lines from a file
Message-Id: <Xns9114B695C21E8darkononenet@207.126.101.97>

neil.elder@teradyne.com (Neil Elder) wrote on 06 Sep 2001:

> The piece of script works fine in UNIX but not in NT. It is designed
> to read lines in a file called dir.pass. The file opens ok, $fail
> returns 1, but I can't get it to read the lines of the file into an
> array. $tem has no value initially.
> Can anyone help?
> 
> 
> $fail = open(SFILE,
> ">D:/inetpub/wwwroot/directlink/resumetrack/dir.pass"); $linenum = 0;

The > before the path/filename means "open this file for OUTPUT only".  If 
you had had warnings enabled, you would have gotten an error message 
telling you exactly what was wrong.  

By the way, if dir.pass had stuff in it before, it doesn't now.  Opening it 
for-output-only clobbers the contents.


> while ($tem =<SFILE>) {
>      chomp $tem;
>      $pass[$linenum++] = $tem;
>      }
> close SFILE;

This is kind of a hard way to do it.  An easier way is:

use strict;               # recommended
use warnings;             # also recommended
open SFILE, "D:/inetpub/wwwroot/directlink/resumetrack/dir.pass" or die $!;
chomp( my @pass = <SFILE> );  # read entire file into @pass at once


See the FAQ, under perlfaq5 (File and Formats), under the heading "How can 
I read in an entire file all at once?"

perldoc -q entire

will get you there quickly.

-- 
David Wall
darkon@one.net


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

Date: Thu, 06 Sep 2001 13:16:16 -0700
From: Fred <fredcoyoteno@spamgo.com>
Subject: Re: Regular Expression puzzle...
Message-Id: <3B97D990.3D5E@spamgo.com>

Laocoon wrote:
> 
> 1 while $test =~ s/ ([\w&]\s)/$1/;
> 
> Note that the first character in the match is a space and not \s because \s
> will also match \n (and its shorter).Hope this helps..

ahh... that works very well... I see where I was remiss..

thanks


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

Date: Thu, 6 Sep 2001 12:46:18 -0700
From: "Swanthog" <lhswartw@ichips.intel.com>
Subject: Status window
Message-Id: <9n8jqa$i6e@news.or.intel.com>

Hi,

I'm looking for a widget that will display a window, containing status text,
that I can close once I'm done processing a routine. I don't want the window
to have any buttons as with Dialog or DialogBox. The user should have no
interaction with the status window. Any ideas?

Thanks,
Larry S.




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

Date: Thu, 6 Sep 2001 12:48:36 -0700
From: "Swanthog" <lhswartw@ichips.intel.com>
Subject: Re: Status window
Message-Id: <9n8juk$idh@news.or.intel.com>

Sorry all, I meant to post this to comp.lang.perl.tk.

Larry S.

"Swanthog" <lhswartw@ichips.intel.com> wrote in message
news:9n8jqa$i6e@news.or.intel.com...
> Hi,
>
> I'm looking for a widget that will display a window, containing status
text,
> that I can close once I'm done processing a routine. I don't want the
window
> to have any buttons as with Dialog or DialogBox. The user should have no
> interaction with the status window. Any ideas?
>
> Thanks,
> Larry S.
>
>




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

Date: Thu, 6 Sep 2001 19:27:19 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Storing a socket in an object.
Message-Id: <999804439.385887031909078.gnarinn@hotmail.com>

In article <d55785d7.0109052248.49ff22a1@posting.google.com>,
Michael <michaelb@championdata.com.au> wrote:
>Dear All,
>Is it possible to store a socket connection in an object that I have
>defined?
>Note,
>I'm not getting anything back from the socket I am connected to (I'm
>not expected to).  Nothing seems to be working so I am wondering if it
>is me or the other end of the socket?
>

(snipped code)

your code did not compile on my system. 
is there something you are not telling us?

anyways, yes you can store the socket object, just make sure it does
not go out of scope before you have used it.

gnari


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

Date: 6 Sep 2001 18:11:49 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Undef'ing multiple variables
Message-Id: <9n8e95$5viq8$3@fu-berlin.de>

Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
> Tina Mueller wrote:
>> Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:

>>>not to talk about GLOB, CODE, LVALUE, ...
>>>
>> 
>> okay, ignore CODE and LVALUE... it's just GLOB...
>> i'm typing quicker than thinking i guess... :-/

> No, CODE is in fact a valid ref-type so that's one more that should be 
> taken into account when rolling one's own undef() function.

yes it is, but a reference to CODE is still a REF, and with your
addition of REF it would work. if you always feed references to the
my_undef() it will only be HASH, SCALAR, ARRAY, REF and GLOB.
(not sure about LVALUE, though)

but anyway, as others pointed out,
i really think there's no need for undef(@array).
i don't see where it could be necessary to make a difference
between if (@a) and defined(@a). (it's deprecated anyway... =)
regards,
tina
-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Thu, 06 Sep 2001 20:22:50 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Undef'ing multiple variables
Message-Id: <3B97BEFA.50002@post.rwth-aachen.de>

Tina Mueller wrote:

> yes it is, but a reference to CODE is still a REF, and with your
> addition of REF it would work. if you always feed references to the
> my_undef() it will only be HASH, SCALAR, ARRAY, REF and GLOB.
> (not sure about LVALUE, though)

Ah, ok, you had been one step ahead of me.
But as for LVALUE: How can I create a ref to that? I don't think I have 
ever seen it before.

Tassilo

-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: 6 Sep 2001 12:14:22 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Undef'ing multiple variables
Message-Id: <3b97cb0e@news.victoria.tc.ca>

Tassilo von Parseval (Tassilo.Parseval@post.rwth-aachen.de) wrote:
: Tina Mueller wrote:
: > Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:

: >>not to talk about GLOB, CODE, LVALUE, ...
: >>
: > 
: > okay, ignore CODE and LVALUE... it's just GLOB...
: > i'm typing quicker than thinking i guess... :-/

: No, CODE is in fact a valid ref-type so that's one more that should be 
: taken into account when rolling one's own undef() function.


I liked Rafael Garcia-Suarez's suggestion best.

Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>	eval "undef $_" for qw/$s @a %h/;


You could put it in a function if you like

	sub my_undef { eval "undef $_" foreach @_ }

but you have to remember to call it with qw or such like

	my_undef(qw( $s @a %h )) ;



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

Date: Thu, 06 Sep 2001 19:26:02 GMT
From: Steve Allan <stevea@wrq.com>
Subject: Re: win32 rmdir questions
Message-Id: <uheugjf10.fsf@wrq.com>

"Knob" <andrew.savige@ir.com> writes:

>"keng" <keng@kengdom.per.sg> wrote in message
>news:9n1t1t$rtc$1@clematis.singnet.com.sg...
>> dear all
>>
>> how can i remove a directory that is not empty (can have other sub-dir or
>> files in it) ?

<snip>

>You could use the File::Path::rmtree() function.

FWIW, I'll vouch for the rmtree() solution - it's a staple in my
scripts.  I'm surprised more poeple don't recommend it.

-- 
-- Steve __


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

Date: Thu, 06 Sep 2001 21:51:49 GMT
From: "Dan Nunn" <thedannunn@yahoo.com>
Subject: Re: Win32:API module installation on a stand alone machine - solution.
Message-Id: <VdSl7.9394$Uf1.797658@bgtnsc06-news.ops.worldnet.att.net>

Glad to hear your successes :)

Dan




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1706
***************************************


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