[16282] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3694 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 17 14:30:30 2000

Date: Mon, 17 Jul 2000 11:10:16 -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: <963857416-v9-i3694@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 17 Jul 2000     Volume: 9 Number: 3694

Today's topics:
    Re: Out of Memory <mjcarman@home.com>
        perl/ftp/iis help needed <sturdevr@yahoo.com>
    Re: POP3 password <nospam@nospam.com>
    Re: Qs for professional Perl/CGI developers <nospam@nospam.com>
        Question: system() from C++ CGI to Perl with Kernel 2.2 <lwilcox@emory.edu>
    Re: Read a file into a hash ? <nospam@nospam.com>
    Re: Search a string for &lt; and replace it with < <nospam@nospam.com>
        stat on solaris 2.6 mercma@my-deja.com
        To Schwartz or not to Schwartz? <michael@visv.net>
        using HttpSniffer/PubMed <jdhunter@nitace.bsd.uchicago.edu>
        Viewing HTTP headers <guymal@hotmail.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 17 Jul 2000 10:43:57 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Out of Memory
Message-Id: <397329BD.57195453@home.com>

James McCallum wrote:
> 
> I'm running a perl script and I'm getting the
> message 'out of memory'
> I've check my ulimit which is currently set
> at 2097151 which should be buckets of
> space for files.  Anyone any thoughts??

I don't think your problem is disk space; How much RAM do you have
available? If you're on a shared system with lots of other activity and
your program has hefty memory requirements, there may not be enough
system resources for it. You may need to reduce the memory consumption
of your program (see the FAQ) or wait until things have quieted down so
that you can hog the system. ;)

-mjc


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

Date: Mon, 17 Jul 2000 12:27:00 -0400
From: "BobS" <sturdevr@yahoo.com>
Subject: perl/ftp/iis help needed
Message-Id: <8kvc36$84$1@bob.news.rcn.net>

Hi all,

 I have a problem that seems related to IIS4. I'm using perl and the
NET::FTP module to move files from several clients to the IIS4 server and
return other files. For reasons of legacy code, only one client can access
the server at a time. To control access to the server, I have worked out a
simple (I thought) protocol whereby a control file is placed on the server
whenever it is busy. Absence of the control file indicates the server is
avail for anonymous transfers. I use $ftp->size to determine whether the
control file is present on the server.

Initial transfers for the first client work fine. But then I get an unusual
response. The normal file size is 24 bytes which is correctly reported when
the file is located in the folder on the server. However, if the file is
removed (by the administrator) to the recycle bin, I still get a file size
of 8 bytes. I assume this has to do with cacheing of filehandles on IIS4 but
I can't locate any specific references. Anyway, the script thinks the file
is still there and further access is denied. Also, if the administrator then
tries to empty the recycle bin, an Access Denied results until the server is
rebooted.

I don't know if this is an IIS, perl, or headspace problem. Any ideas,
workarounds, etc. will be appreciated. TIA






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

Date: 17 Jul 2000 15:22:50 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: POP3 password
Message-Id: <8kv8ca$1c7$4@216.155.32.56>

In article <8uIb5.13947$V34.195662@news1.sttls1.wa.home.com>, "Propman" 
<propman@noemail.com> wrote:

 | I am looking for a Perl script that I can call from a simple web 
 | page to allow users to change their POP3 passwords directly.  I have 
 | found some, but they require that I also compile and run C programs 
 | on my server as root, which I can not do.
 | 
 | I've tried just piping the passwords into a system call to passwd, 
 | but that doesn't seem to work (I could be doing something else 
 | wrong, I've very new to Perl).
 | 
 | Any advice or pointers to links would be nice...

wouldn't it be MUCH safer and less prone to hacking if you simply posted 
instructions on your website on how to use passwd from the shell, along 
with a few links to software search engines for the users to download 
freeware telnet apps if they don't already have one?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 17 Jul 2000 17:22:57 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Qs for professional Perl/CGI developers
Message-Id: <8kvfdh$e0b$1@216.155.32.56>

In article <8kv50r$n9p$1@eastnews1.east.sun.com>, 
nobody@contract.Sun.COM (Nobody) wrote:

 | Blazing :-)  Which makes a consultant like myself do a great
 | big happy dance, since I remember back to 1992 in this area
 | when I was unemployed for 8 months, along with many thousands
 | of others.  I have been (figuratively speaking) fighting the
 | recruiters/potential employers off with a stick.  I had to take
 | my phone number off of my resume (which is only posted on one 
 | consultants' web site) because my answering machine was full
 | every day.  It was nice to have the work come looking for me, not
 | to mention being quite a boost to the ego :-)  
 | 
 | The market is so hot here that companies are happy to get a warm body 
 | with half a clue.  

I would have sent this via e-mail but you didn't leave enough clues :) 

which consultant's website is this? 

I can only hope that my own area could be half as hot :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Mon, 17 Jul 2000 13:50:52 -0400
From: Lisa Wilcox <lwilcox@emory.edu>
Subject: Question: system() from C++ CGI to Perl with Kernel 2.2.16
Message-Id: <3973477B.6ABB6E9D@emory.edu>

Hello all,

I've got a C++ CGI making a syscall to a Perl program on a Red Hat Linux

test server with kernel 2.2.5, and working beautifully.  On another
system where the main difference is the kernel (2.2.16), it doesn't work

at all.  I have combed through all relevant logs in /var/log and there
are no error messages whatsoever.  It appears to be running the Perl
program, as error messages from its system calls are being logged to
/var/log/httpd/error_log.  I've tried using popen() instead, with no
success.  The C++ CGI compiles cleanly and runs as expected with
exception of the system call.  The Perl program runs as expected when
run from the command line.

What's the problem?!?!  Is this a security issue?  Is this just a bug
and all I need is a patch?  I'm using Perl 5.005_03, glibc 2.1.2-11,
apache 1.3.12, and compiling with g++.  I *really* don't want to embed a

Perl interpreter because I think its overkill for what I'm trying to
do.  However, if the problem is a security issue blocking the execution,

either within Apache or the kernel, I would be willing to do it.  If
someone could recommend an example that makes sense, I would appreciate
it.  All I want to do is run the program and have the results print back

to the user.

Any solutions to the problem would be joyously received.

Thanks,

--
Lisa Wilcox
SAGE Systems Developer
SAGE Project:  http://sage.library.emory.edu/
Woodruff Library/Emory University
Email: lwilcox@emory.edu
Phone: 404-727-0961




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

Date: 17 Jul 2000 17:18:04 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Read a file into a hash ?
Message-Id: <8kvf4c$e0b$0@216.155.32.56>

In article <8kulco$8ak$1@xs4.xs4all.nl>, rjn@pobox.com (Fidelio) wrote:

 | Hi,
 | 
 | I want to read a file into a hash. I now have code like:
 |     open(PASSWD, '/etc/passwd');
 |     while (<PASSWD>) {
 |         ($login, $passwd, $uid, $gid,
 |          $gcos, $home, $shell) = split(/:/);
 |         # do something
 |     }
 | 
 | Now everytime I want to access a user's home dir for example I
 | have to read the file.
 | Suppose I read the file into an array like:
 | 
 |   open(PASSWD, '/etc/passwd');
 |   @users = <PASSWD>;
 |   close (PASSWD);
 |   foreach $lines(@users) {
 |     chop($lines);
 |     @line = split(/\:/,$lines);
 |     # put users into %users ??
 |   }
 | 
 | Then I can access all the fields with @user{'root'} and eg. the home
 | dir with $user{'root'}[5]  right ?
 | I a lost how to do this. @user{$line[0]} = @line  just doesn't work.

you were close :)

I might do something like this, myself : 

#!perl -w
use strict;

my(%users);

open(PASSWD, '/etc/passwd');
while (<PASSWD>) {
  chomp;
  my($login, $passwd, $uid, $gid, $gcos, $home, $shell) = split(/:/);
  # create a HoL using a hash with a reference to an anonymous array
  # as the 'value' of the key $login represents
  $users{$login} = [ $passwd, $uid, $gid, $gcos, $home, $shell ];
}
close(PASSWD);

#just an example, you can do something like this
foreach (keys %users) {
  print "Name - $_:\n";
  print "  uid : $users{$_}->[1], ";
  print "  home: $users{$_}->[4]\n\n";
}

__END__

for more details see
perldoc perllol
perldoc perldsc

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 17 Jul 2000 16:18:36 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Search a string for &lt; and replace it with <
Message-Id: <8kvbks$88u$0@216.155.32.56>

In article <I0sc5.398065$k22.1760762@flipper>, "NightWish" <?@?.?> 
wrote:

 | Backoff Jason, he was just trying to help, and he did a hell of a lot 
 | more than you did, so go bother your mom!

*plonk*

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Mon, 17 Jul 2000 16:19:31 GMT
From: mercma@my-deja.com
Subject: stat on solaris 2.6
Message-Id: <8kvbls$uem$1@nnrp1.deja.com>

Hello,

On Redhat linux (2.2.5) and HP-UX 10.20, if you do

($dev,$ino,$mode,$nlink,$uid,$gid) = stat($filename);

and $filename is a file on an NFS mounted file system $dev will return a
negative number.  This is not the case on solaris 2.6 (and greater?).
Using solaris 2.6 is there a way with the stat command to check if it is
an NFS mounted file system or not?

Thanks,
Mike


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


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

Date: Mon, 17 Jul 2000 16:03:30 GMT
From: Michael Fischer <michael@visv.net>
Subject: To Schwartz or not to Schwartz?
Message-Id: <39732E4D.63C784DC@visv.net>

Some co-workers and I recently used the Schwartzian
transform to do some sorting of keys of hashes by 
the values of a hashref embedded in the former hash.

Something like

my @sorted = 	
	map { $_->[0] }
	sort { $a-[1] cmp $b->[1] }
	map { [ $_, $$hash{'key1'}{'key2'}{'key3'} ] }
	( keys %hash );

However, another co-worker pointed out that this was 
unnecessary, and that simply 

my @sorted = 
	sort { $$hash{$a}{'key2'}{'key3'} cmp $$hash{$b}{'key2'}{'key3'} }
	( keys %hash );

was both functional and more efficient.

We tried out the example from pp. 49-50 of _Effective 
Perl_Programming_ in this way:

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

use strict;

my @files = <*>;

my @sorted_files = sort { -M $a <=> -M $b } @files;

foreach my $file (@sorted_files) {
        print "$file\n";
}

and found that it works.

So, we find ourselves wondering _when_ the Schwartz is 
more appropriate or even necessary compared to this more
direct method. Is it that if the sorting keys and the 
list to be sorted must be linked together because they 
are originally not part of the same data structure?
( or fudgeable as 'the same data structure' as -M is
when applied to a list of filenames?)

Thank you for your time and input.

Michael Fischer
-- 
michael@visv.net


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

Date: 17 Jul 2000 12:04:17 -0500
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: using HttpSniffer/PubMed
Message-Id: <1ru2dod6y6.fsf@video.bsd.uchicago.edu>

I am using the WWW::Search::PubMed to search the PubMed.  I am trying
to figure out how to request the articles in MEDLINE format instead of
the default Summary format.

I wanted to figure out what was happening when I clicked on the
Display button with the MEDLINE option chosen, ie what kind of request
was being sent so perhaps I could hack PubMed.pm to send the kind of
request I want.

So I tried using HttpSniffer with 
HttpSniffer -r http://www.ncbi.nlm.nih.gov
and directing my http address to http://localhost:8080/PubMed but I
can't interact with the buttons and drop down menus in this way.

So my questions are: is there a way to get the information I want with
HttpSniffer?  Is there some other way to monitor all the traffic
between the web browser and server, ie a proxy app which just logs and
transmits all requests to a from a browser?


Thanks,
John Hunter 


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

Date: Mon, 17 Jul 2000 15:53:08 +0200
From: "Guy" <guymal@hotmail.com>
Subject: Viewing HTTP headers
Message-Id: <8kuvio$4qs$1@news.netvision.net.il>

How can I view everything that is passed to a script including all the http
headers?
I would like to submit a form to a certain url (lets say: test.pl on my web
server) and have the Perl script print all the http headers and parameters
that were passed to it. (I know how to view all parameters, but I don't know
how to view the http headers).
The reason I need this is that I have a hard coded html form that is used to
login to a web site (like the Hotmail login screen) and I wrote a Perl
script to do this automatically. The only problem is that although the
automatic authentication works, I see weird characters on the screen
(whereas with the html form everything works great). I would like to see
everything that the hard-coded html form passes to the server, and match it
to my automatic script, in order to see where the problem is.

Thanks,
Guy




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3694
**************************************


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