[7216] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 841 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 10 18:07:17 1997

Date: Sun, 10 Aug 97 15:00:21 -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           Sun, 10 Aug 1997     Volume: 8 Number: 841

Today's topics:
     Re: backquote command and floppy drive (Matthew Burnham)
     Re: backquote command and floppy drive (Matthew Burnham)
     Re: backquote command and floppy drive <rootbeer@teleport.com>
     Re: Browser interaction in DOS <rootbeer@teleport.com>
     Re: Converting cgi submission to variable names? <rootbeer@teleport.com>
     Re: Converting cgi submission to variable names? <weck@atweb.com>
     Re: HELP WITH INSTALLING PERL5 ON WINDOWS 95 <rootbeer@teleport.com>
     lib/io_sock.t test failure (John Paul Campbell)
     mixing sysread and print -- can it be done? (James Weisberg)
     newbie: can't export vars from module (Jeffery Chow)
     Re: Perl 5 FileCache module broken? <rootbeer@teleport.com>
     Re: Perl 5 FileCache module broken? (Mike Stok)
     perl.exp problem building perl on AIX mpheasant@csg.sitel.net
     Re: Pre-forking server example needed (Rick Klement)
     Q: Recompiling Modules during execution <aaron@bawcom.net>
     Serial Port Access <sepketod@pilot.msu.edu>
     Re: Server Push in Perl??? (Matthew Burnham)
     Re: Server Push in Perl??? (Jeffery Chow)
     Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
     Update: Perl 5 FileCache module broken? (Michael Borowiec)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 10 Aug 1997 19:12:39 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: backquote command and floppy drive
Message-Id: <33f50eda.3557354@news.enterprise.net>

Glenn Rowe <growe@mic.dundee.ac.uk> wrote:

[snip]
>the floppy drive gets accessed. The command works OK, though.
I have the same problem, but also when doing pipes to fly with open().


-- 
Matthew Burnham         | danew@enterprise.net
Manager, MindWeb        | http://www.mindweb.co.uk/
Web design and hosting  | UKP24/Mb/Year for DIY space
WWW, FTP, CGI scripting, mailing lists, autoresponders and more!


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

Date: Sun, 10 Aug 1997 19:12:55 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: backquote command and floppy drive
Message-Id: <33f40eb7.3522381@news.enterprise.net>

Tom Phoenix <rootbeer@teleport.com> wrote:

>Perl shouldn't do that, but I wonder whether your command interpreter (or
>the type command?) is the culprit. 
Why doesn't it do it with anything else then?

>> The command works OK, though.  The file being read is not on the floppy,
>> and the floppy isn't in my PATH environment, so I was wondering if there
>> is any way of stopping this access. The main reason I want to stop this
>> is that I use backquote commands in Perl CGI scripts and don't want the
>> floppy accessed every time someone uses the CGI script.
>Could the current working directory be on the floppy?
Even if it's run using:

C:\PERL>perl script.pl

?

>There may be some
>Windows-specific thing (such as an environment variable, perhaps?) that
>could also affect this. 
I can't think of anything :-(

>Of course, if type is (as I seem to recall) a lot like Unix's cat command,
>maybe you want to simply read the file from Perl, something like this. 
>
>    {
>	my $name = 'testfile.txt';
>	local($/, *FILE);		# Magic
>	open FILE, $name or die "Can't open '$name': $!";
>	$fileContents = <FILE>;		# Read whole file
>	close FILE;
>    }
>
>If that runs the floppy drive, maybe something strange is going on. Hope
>this helps!
Last time I did something like that it didn't access the floppy drive
:-(



-- 
Matthew Burnham         | danew@enterprise.net
Manager, MindWeb        | http://www.mindweb.co.uk/
Web design and hosting  | UKP24/Mb/Year for DIY space
WWW, FTP, CGI scripting, mailing lists, autoresponders and more!


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

Date: Sun, 10 Aug 1997 13:18:18 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthew Burnham <danew@enterprise.net>
Subject: Re: backquote command and floppy drive
Message-Id: <Pine.GSO.3.96.970810130546.27854A-100000@kelly.teleport.com>

On Sun, 10 Aug 1997, concerning the way Windows Perl uselessly spins the
empty floppy drive whenever `type somefile.txt` is evaluated, Matthew
Burnham wrote: 

> Tom Phoenix <rootbeer@teleport.com> wrote:
> 
> >Perl shouldn't do that, but I wonder whether your command 
> >interpreter (or the type command?) is the culprit. 

> Why doesn't it do it with anything else then?

If I'm not mistaken (and I certainly may be) Windows Perl won't directly
run the command contained in the backticks in this case. Instead, it
passes it off to command.com. So, command.com then is told to do 'type
somefile.txt' (or whatever the command is). command.com will then
(perhaps?) hunt around for an executable type.xxx file, possibly running
the floppy drive in the search. (As you can tell, I'm not claiming to be
an expert on Windows! But maybe you can find something in your docs or by
experimenting, or maybe somebody who knows the true tale will speak up.) 

If you have a command which takes no arguments, you may be able to run it
in backticks without using command.com, so that might not run the floppy
drive.

If you can use system() instead of backticks to run a program, you can use
a list of arguments to be able to (probably) bypass command.com. Does that
invariably keep the floppy drive from running?

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 10 Aug 1997 11:06:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Hedin Meitil <hm@royal.net>
Subject: Re: Browser interaction in DOS
Message-Id: <Pine.GSO.3.96.970810110247.28252A-100000@julie.teleport.com>

On Sun, 10 Aug 1997, Hedin Meitil wrote:

> I am running PERL on a DOS machine. So far it seems to work OK.
> 
> Now, though, I would like to make a simulated trip into CGI-scripting.
> I thought, I could just create a HTML-page with a form, where the
> attribute ACTION points to my script, for instance ACTION="myscript"

That sort of thing won't normally work. Instead, use the popular CGI.pm
module. (I think that you can use that on your machine, but I'm not
certain, never having used Perl on a DOS machine.) That will provide you
with an easy way to test your script from the command line, with or
without Perl's built-in debugger.

If you can't run CGI.pm on your machine, you may want to trick your script
into getting its input another way. This is less easy than using CGI.pm,
which is one of the reasons that CGI.pm is so frequently recommended.

Or you could install Linux. :-)  Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 10 Aug 1997 11:10:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ariel Y Fishman <ayfishma@mail2.sas.upenn.edu>
Subject: Re: Converting cgi submission to variable names?
Message-Id: <Pine.GSO.3.96.970810110704.28252B-100000@julie.teleport.com>

On 10 Aug 1997, Ariel Y Fishman wrote:

> I want to assign a variable with the same name as the "name" function in
> the cgi form to the "value" submitted in the form. 

Why not just use a module like CGI.pm? Then you can easily access any of
the form's data.

> What I currently have is a script to parse the submission, which I
> copied from a book (the CGI Book, by W. Weinman)

The author of that book should have told you that it's easier to use a
module. Maybe you should get a better book. :-)

CGI.pm comes with new versions of Perl. If you don't yet have it, get
5.004 installed (highly recommended) or you can get CGI.pm from CPAN. 

    http://www.perl.com/CPAN/

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 10 Aug 1997 14:17:39 -0700
From: Peter Weck <weck@atweb.com>
To: Ariel Y Fishman <ayfishma@mail2.sas.upenn.edu>
Subject: Re: Converting cgi submission to variable names?
Message-Id: <33EE2FF2.DB1BB9C@atweb.com>

Ariel Y Fishman wrote:

> In principle, is there a way to assign a variable without actually
> typing out the variable name? (Can I assign $variable to be something
> without actually typing the command line '$variable = '?)

If you are using Perl 5, you can do the following:

$foo = "test";
$$foo = "hello";

This sets $test = "hello".


:::::::::::::::::::::::::::::::::::::::  /  ______ \  AtWeb Inc. :::::
                                        / / _____ \ \  . . . . . . .
        !Register-it!                  / // __  /\/ /\  . . . . . . .
    Promote Your Web Site             / // /_/ /_/ / / . . . . . . .
   register@register-it.com          / / \________/ / . . . . . . . .
  http://www.register-it.com         \ \/_\_______\/ . . . . . . . .
                                      \_________/\  . . . . . . . . .
:::::::::::::::::::::::::::::::::::::  \________\/ :::::::::::::::::::





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

Date: Sun, 10 Aug 1997 11:12:15 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ed Wilson <hbact647@csun1.csun.edu>
Subject: Re: HELP WITH INSTALLING PERL5 ON WINDOWS 95
Message-Id: <Pine.GSO.3.96.970810111038.28252C-100000@julie.teleport.com>

On Sun, 10 Aug 1997, Ed Wilson wrote:

> Subject: HELP WITH INSTALLING PERL5 ON WINDOWS 95

You don't need to shout. We're right here. :-)

> I downloaded the perl5 interpreter from the perl web site, but can't
> seem to get in working.  Can anyone help with the basic install
> procedures?  What to watch out for, tricks... anything would help.

In what way do the included docs and readme files fall short? Can you tell
us how far you've gotten? Do you know what step is causing you troubles?
That'll help us to help you.

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 10 Aug 1997 18:59:00 GMT
From: jpc@tango.cs.rice.edu (John Paul Campbell)
Subject: lib/io_sock.t test failure
Message-Id: <5sl31k$bkg$1@joe.rice.edu>

I'm installing perl5.004_01 and everthing was fine except that when I ran
the test for lib/io_sock.t, I got the following:

1..5
ok 1
Bad file descriptor at lib/io_sock.t line 55.


Line 55 has:

$sock = IO::Socket::INET->new(PeerPort => $port,
	Proto => 'tcp',
	PeerAddr => 'localhost'
	) or die "$!";

everything else passes.

I'm installing under FreeBSD2.2.2

If anyone can help, please reply by mail as well.

Thanks,

jpc
-------------------------------------------------------
John P. Campbell
jpc@rice.edu
www.cs.rice.edu/~jpc


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

Date: 10 Aug 1997 16:05:31 -0500
From: chadbour@sashimi.wwa.com (James Weisberg)
Subject: mixing sysread and print -- can it be done?
Message-Id: <5slaer$mul@miso.wwa.com>


I noticed in the Perl book that it warns to not mix sysread and read
and syswrite and print. However, mixing sysread and print seems to
be a no-no as well. 

Below is a simple echo-server using sockets but allows for multiple
connections to the server storing each new connection in the file
descriptor set and using select() to figure out which fd is making
a request. Each new filehandle is stored in an array and used in
subsequent reads/writes to the socket. All is well if I use syswrite
with sysread but no echo is made if I simply use a print. My
questions are these:

	1) does this behavior mean sysread() and print cannot be used
	together? If so, this should be noted in the documentation.

	2) if 1 is correct, can someone show me how to replace sysread
	with read so that print can be used. A straight replacement
	does not work in the code below.

Thanx for any help.


#!/usr/local/bin/perl

use Socket;
use FileHandle;
use POSIX qw(WNOHANG);	# don't want wait to block

$PROG	= "mserver";	# program name.
$PORT	= $ARGV[0] || 3000;

$AF_INET = &AF_INET;
$SOCK_STREAM = &SOCK_STREAM;
$sockaddr = 'S n a4 x8';

($name, $aliases, $proto) = getprotobyname('tcp');
$this = pack($sockaddr, $AF_INET, $PORT, "\0\0\0\0");

socket(S, $AF_INET, $SOCK_STREAM, $proto) ||
	die "$PROG: error opening socket: $!\n";

setsockopt(S, SOL_SOCKET, SO_REUSEADDR, 1);
bind(S, $this) || die "bind: $!\n";
listen(S, 5) || die "connect: $!\n";
select(S); $| = 1; select(stdout);

$origfd = fileno(S); $handles[$origfd] = S;
$allfds = ""; vec($allfds, $origfd, 1) = 1;

print "$PROG: waiting for connection on port $PORT.\n";
for ( ; ; ) {
	if ( select($readfds = $allfds, undef, undef, undef) < 0 ) {
      print STDERR "$PNAME: select() error: $!\n";
      next;
   }

	# Handle new connection 
	if ( vec($readfds, $origfd, 1) ) {
		my $NS = new FileHandle;
		($paddr = accept($NS, S)) || die $!;
		$newfd = fileno($NS);
		$handles[$newfd] = $NS;
		vec($allfds, $newfd, 1) = 1;
		my($PORT, $iaddr) = sockaddr_in($paddr);
		print "$PROG: connection from [",inet_ntoa($iaddr),"] on fd $newfd.\n";
	}

	# Handle old connections. 
	for ( $fd = $origfd + 1; $fd <= $#handles; $fd++ ) {
		next if ( ! vec($readfds, $fd, 1) );
      $bytes_read = sysread($handles[$fd], $request, 1024);
      if (not defined $bytes_read) {
         print STDERR "$PROG: closing fd $fd on error: $!\n";
         close_connection($fd);
      } elsif ($bytes_read == 0) {
         print STDERR "$PROG: closing fd $fd on eof.\n";
         close_connection($fd);
      } else {
         print "$PROG recv [$fd]: $request";
			# print to this filehandle does not work. 
         # print { $handles[$fd] } $request;
			# syswrite works.
         syswrite($handles[$fd], $request, 1024);
      }
   }

}

sub close_connection {
   my($fd) = @_;

   close $handles[$fd];
   vec($allfds, $fd, 1) = 0;
}




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

Date: 10 Aug 1997 17:55:14 GMT
From: jefferyc@unixg.ubc.ca (Jeffery Chow)
Subject: newbie: can't export vars from module
Message-Id: <5skva2$f46$1@nntp.ucs.ubc.ca>

Hi, I'm trying to access some variables in one of my modules, but
can't get them exported properly. I would appreciate it if
you experts can comment:

--- here's what's in my module: --
package UVCommon
require Exporter;
@ISA=qw(Exporter);
@EXPORT=qw(MOB_DIR ZON_DIR OBJ_DIR WLD_DIR);
@EXPORT_OK=();

$BASE='/some/path/to/system/root';
$MOB_DIR="$BASE/m";
$ZON_DIR="$BASE/z";
$OBJ_DIR="$BASE/o";
$WLD_DIR="$BASE/w";
1;

--- here's what's in a module that uses UVCommon --
package UVMob
require Exporter;  
require UVCommon;
@ISA=qw(UVCommon Exporter);
@EXPORT=qw(sub1 sub2 sub3);
@EXPORT_OK=();

$test=$MOB_DIR;             # $test='';, This is the usage I want,
			    # if possible
$test=$UVCommon::MOB_DIR;   # $test='/some/path/to/system/root/m';
--- snip --

AFAIK:
1) I've used 'perl -c' on all these files, and Exporter.pm is in 
	/usr/lib/perl5,	which is in @INC
2) I've checked the Camel book (2nd edition), version 3 of The Faq, 
	the perlmod man page, and this and the comp.lang.perl.module
	 ng. Unfortunately, all of them say the same thing and really 
	don't provide troubleshooting info.

	
If someone can steer me in the right direction, I'd appreciate it
greatly.

TIA,
Jeff

--
|======================================================|
| Jeffery Chow   4th year Computer Science, UBC        |
|------------------------------------------------------|
| http://www.ugrad.cs.ubc.ca/spider/j8g1/fdoor.html    |
| "Here lives a competent, trustworthy salesman of     |
|  propane and propane accessories." -- H. Hill        |
| This message brought to you by Bill Gates, inventor  |
| of DOS, the World Wide Web, and the modern GUI.      |
|======================================================|


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

Date: Sun, 10 Aug 1997 11:28:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Borowiec <mikebo@MCS.COM>
Subject: Re: Perl 5 FileCache module broken?
Message-Id: <Pine.GSO.3.96.970810112057.28252E-100000@julie.teleport.com>

On 10 Aug 1997, Michael Borowiec wrote:

> Is the FileCache module broken, or am I doing something wrong? 

> #!/usr/local/bin/perl5
> use FileCache;
> $FileCache::maxopen = 20;
> for $i (0 .. 1024) {
>         $filename = "/tmp/crud$i";
>         cacheout($filename);
> }
> 
> prompt > maxfile
> Can't create /tmp/crud61: Too many open files at ./maxfile line 6

I can't duplicate this under 5.004 or 5.003_20. It runs with no trouble
for me. But from looking at the module itself, I think its docs are
mistaken, and that you need to set $FileCache::cacheout_maxopen on the
third line of your script. If that turns out to be right, could you send a
note about this to the Perl developers by running perlbug? Thanks!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: 10 Aug 1997 18:30:01 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl 5 FileCache module broken?
Message-Id: <5sl1b9$eio@news-central.tiac.net>

In article <5skv87$dpt$1@Mars.mcs.net>,
Michael Borowiec <mikebo@MCS.COM> wrote:
>Greetings -

>FileCache module broken, or am I doing something wrong?
>
>prompt> cat maxfile
>#!/usr/local/bin/perl5
>use FileCache;
>$FileCache::maxopen = 20;
>for $i (0 .. 1024) {
>        $filename = "/tmp/crud$i";
>        cacheout($filename);
>}
>
>prompt > maxfile
>Can't create /tmp/crud61: Too many open files at ./maxfile line 6
>
>> ulimit -n
>64

The documentation for FileCache is wrong, it says

BUGS
       sys/param.h lies with its NOFILE define on some systems,
       so you may have to set $cacheout::maxopen yourself.

but eyeballing the code on my 5.004_02 suggests that
$FileCache::cacheout_maxopen may be a more worthwhile variable to set.

Hope this helps,

Mike

(I also mailed you privately before I saw this post, sorry for clogging
your mailbox...)

-- 
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: Sun, 10 Aug 1997 16:41:23 -0600
From: mpheasant@csg.sitel.net
Subject: perl.exp problem building perl on AIX
Message-Id: <871248510.12724@dejanews.com>

If anyone has had

ld: 0706-004 Cannot find or read export file: perl.exp

problems building perl on AIX (4.1), using AIX cc and AIX make, the
problem goes away using GNU make instead of AIX make. (why is this ?)

The problem may recurr installing other modules, so then you will have to
follow previous posted advice:

>Bosch Patrick wrote:
>In Config.pm (probably in /usr/local/lib/perl5/aix/5.003/), find the
>line which says: ccdlflags='-bE:perl.exp' and change it to have the
>fully-qualified path of perl.exp (probably
>/usr/local/lib/perl5/aix/5.003/CORE/perl.exp)
>Then redo the "perl Makefile.PL"...

or, copy perl.exp into the module's make directory.

Mike Pheasant.

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


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

Date: 10 Aug 97 18:50:29 GMT
From: rick@rick.infoserv.com (Rick Klement)
Subject: Re: Pre-forking server example needed
Message-Id: <88.8653@rick.infoserv.com>

In article <5savar$hn1$1@izvestia.its.unimelb.edu.au>, rns@ariel.ucs.unimelb.EDU.AU (Robert Sturrock) writes:
> Hi.
> 
> Does anyone have any examples of server code (in Perl) that "pre-fork()s"
> a number of child processes, and then uses those children to service
> client requests when they arrive.  Similar to the way servers like
> squid operate, but in Perl?
> 
> TIA.
> 
> /r.
> -- 
> Robert Sturrock                           _-_|\   E-mail: rns@its.unimelb.edu.au
> Information Technology Services          /     \  Phone:  +61 3 9344 7996
> The University of Melbourne              \_.-.*/  Fax:    +61 3 9347 4803
> Parkville 3052, AUSTRALIA                     v


It's trivial in Perl.

(I did this to win a bet from a friend on how modern OSs handle
multiple accepts from different processes.)

Warning: I did some cleanup on this at another site, watch for
interrupted system calls on the accept and the wait, also, for
production hardening, check for failed forks...

#!/usr/bin/perl -w
require 5.002;
use strict;
use Socket;
use Carp;

sub process;
my $i;
my $paddr;
my $count = 0;
my %pids = ();
my $pid;

sub logmsg { print STDERR "$0 $$ $i: @_ at @{[(split(/\s+/,localtime))[-2]]}\n" } 

$SIG{'INT'} = sub {close SERVER;print STDERR "\n"; logmsg "terminated"; exit(1)};

socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or die "socket: $!";
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or die "setsockopt: $!";
bind(SERVER, sockaddr_in(3142, INADDR_ANY))	or die "bind: $!";
listen(SERVER,SOMAXCONN) or die "listen: $!";

for($i = 0; $i < 4; $i++)
	{
	if($pid = fork)
		{
		$pids{$pid} = $count++;
		}
	else
		{
		process;
		}
	}
sleep 2;
while($count)
	{
	logmsg "$count active processes";
	$pid = wait;
	logmsg "proc $pid $pids{$pid} exited";
	$count--;
	}
logmsg "server parent exiting";
exit;

sub process
	{
	logmsg("started");

	while ( $paddr = accept(CLIENT,SERVER) )
		{
		my($port,$iaddr) = sockaddr_in($paddr);
		my $name = gethostbyaddr($iaddr,AF_INET);
		my $tuple = inet_ntoa($iaddr);
		logmsg "connection from $name [$tuple] port $port";
		my @query = ();
		while(<CLIENT>)
			{
			last unless /\S/;
			push @query,$_;
			}

# ............... your code here .................

		close CLIENT;
		logmsg "end connection from $name";
		} 
	logmsg("completed");
	exit;
	}
__END__


Have fun with it...

Rick

-- 
Rick Klement - email:   rick@infoserv.com

#include <standard.disclaimer>
RULE #5: When you can say something in a positive way or a negative way,
         don't say it in the negative way.


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

Date: Sun, 10 Aug 1997 14:47:09 -0500
From: Aaron Bawcom <aaron@bawcom.net>
Subject: Q: Recompiling Modules during execution
Message-Id: <33EE1ABD.F4916778@bawcom.net>

Given the following situation:
1) Script foo:

#! /usr/bin/perl
if (fork) {exit;}
use MyClass;

while (1) {
    do stuff..
}

2) Package MyClass:

package MyClass;
More code....

1;

Is it possible to ask Perl to recompile the MyClass module during
run-time?
I tried doing a 'require MyClass;' in the while loop but the originally
compiled
code is used instead of any new code that was introduced since the
module was 'require'd.




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

Date: Sun, 10 Aug 1997 17:17:38 -0400
From: "Todd C. Sepke" <sepketod@pilot.msu.edu>
Subject: Serial Port Access
Message-Id: <33EE2FF2.4D156F9C@pilot.msu.edu>

I was woundering if there is any way to access the serial port in linux
with perl.

I want to attach a serial port cable and insert the loose wires in a
breadboard, so I can use my computer to control circuits that I build.

Thanks in advance.

-- 
-------------------------------------------------------------------
Todd C. Sepke              |                                      |
686 E. McDonel, MSU        | How can anyone be enlightened,       |
E. Lansing, MI 48825       | Truth is after all so poorly light.  |
353-1275                   |                                      |
-------------------------------------------------------------------


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

Date: Sun, 10 Aug 1997 19:12:22 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Server Push in Perl???
Message-Id: <33f20d4b.3158460@news.enterprise.net>

yves@streamwave.com (Yves Dagenais) wrote:

>I am trying to write a script for doing a server push.  I have
>successfully made one in Shell, but when trying to do the same thing
>in Perl, it does not display the data as it is comming done.  In Perl,
>it waits till the whole script running and then displays only the last
>part.
Try unbuffering the output: $| = '';



-- 
Matthew Burnham         | danew@enterprise.net
Manager, MindWeb        | http://www.mindweb.co.uk/
Web design and hosting  | UKP24/Mb/Year for DIY space
WWW, FTP, CGI scripting, mailing lists, autoresponders and more!


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

Date: 10 Aug 1997 17:36:13 GMT
From: jefferyc@unixg.ubc.ca (Jeffery Chow)
Subject: Re: Server Push in Perl???
Message-Id: <5sku6d$dqe$1@nntp.ucs.ubc.ca>


: I am trying to write a script for doing a server push.  I have
: successfully made one in Shell, but when trying to do the same thing
: in Perl, it does not display the data as it is comming done.  In Perl,
: it waits till the whole script running and then displays only the last
: part.

Did you try using '$|=1;' at the beginning of your script?
Don't forget to include the HTTP headers yourself.

Jeff
--
|======================================================|
| Jeffery Chow   4th year Computer Science, UBC        |
|------------------------------------------------------|
| http://www.ugrad.cs.ubc.ca/spider/j8g1/fdoor.html    |
| "Here lives a competent, trustworthy salesman of     |
|  propane and propane accessories." -- H. Hill        |
| This message brought to you by Bill Gates, inventor  |
| of DOS, the World Wide Web, and the modern GUI.      |
|======================================================|


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

Date: 10 Aug 1997 20:37:05 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <5sl8ph$t3n$1@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 02 Aug 1997 09:24:40 GMT and ending at
09 Aug 1997 06:46:47 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" e-mail address and name.
    - Original Content Rating is the ratio of the original content volume
      to the total body volume.
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Find the NewsScan junkyard at http://www.cs.uah.edu/~gbacon/clpm/

Excluded Posters
================

perlfaq-suggestions@mox.perl.com

Totals
======

Total number of posters:  451
Total number of articles: 927 (368 with cutlined signatures)
Total number of threads:  399
Total volume generated:   1544.7 kb
    - headers:    626.7 kb (12,629 lines)
    - bodies:     835.0 kb (26,510 lines)
    - original:   623.2 kb (20,299 lines)
    - signatures: 80.6 kb (1,805 lines)
Original Content Rating: 0.7464

Averages
========

Number of posts per poster: 2.1
Number of posts per thread: 2.3
Message size: 1706.3 bytes
    - header:     692.3 bytes (13.6 lines)
    - body:       922.4 bytes (28.6 lines)
    - original:   688.4 bytes (21.9 lines)
    - signature:  89.1 bytes (1.9 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

  117   195.7 ( 97.0/ 78.5/ 51.7)  Tom Phoenix <rootbeer@teleport.com>
   32    59.9 ( 21.2/ 38.7/ 22.2)  Tad McClellan <tadmc@flash.net>
   28    52.0 ( 15.1/ 28.2/ 18.5)  Mike Stok <mike@stok.co.uk>
   23    33.8 ( 16.2/ 17.6/ 10.3)  Doug Seay <seay@absyss.fr>
   14    27.8 ( 10.8/ 11.8/  7.7)  Randal Schwartz <merlyn@stonehenge.com>
   14    15.4 (  7.3/  8.1/  4.1)  Eric Bohlman <ebohlman@netcom.com>
   12    21.4 (  8.9/ 12.5/  7.3)  petri.backstrom@icl.fi
   12    20.4 (  7.7/ 12.1/  6.5)  Tom Grydeland <tom@mitra.phys.uit.no>
    8    17.5 (  4.6/ 11.7/  6.9)  Clark Dorman <clark@s3i.com>
    8    13.7 (  4.0/  9.5/  6.2)  Andrew M. Langmead <aml@world.std.com>

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 195.7 ( 97.0/ 78.5/ 51.7)    117  Tom Phoenix <rootbeer@teleport.com>
  59.9 ( 21.2/ 38.7/ 22.2)     32  Tad McClellan <tadmc@flash.net>
  52.0 ( 15.1/ 28.2/ 18.5)     28  Mike Stok <mike@stok.co.uk>
  33.8 ( 16.2/ 17.6/ 10.3)     23  Doug Seay <seay@absyss.fr>
  27.8 ( 10.8/ 11.8/  7.7)     14  Randal Schwartz <merlyn@stonehenge.com>
  21.4 (  8.9/ 12.5/  7.3)     12  petri.backstrom@icl.fi
  20.9 (  3.9/ 17.1/ 15.4)      3  Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
  20.4 (  7.7/ 12.1/  6.5)     12  Tom Grydeland <tom@mitra.phys.uit.no>
  19.5 (  3.3/ 16.2/ 15.5)      4  Armando Ortiz <aortiz@vcnet.com>
  17.7 (  3.5/  0.7/  0.6)      6  "Joshua Marotti" <jpm@iti-oh.comNOSPAM>

Top 10 Posters by OCR (minimum of three posts)
==============================================

          (kb)    (kb)
OCR       orig /  body  Posts  Address
------  --------------  -----  -------

1.0000     1.6 /   1.6      3  paries@advicom.net
0.9954     4.7 /   4.7      4  "Ryan" <rmcguigan@ramresearch.com>
0.9912     0.4 /   0.4      3  Suzan <yquem@hotmail.com>
0.9550    15.5 /  16.2      4  Armando Ortiz <aortiz@vcnet.com>
0.9182     3.4 /   3.7      3  Jarkko Hietaniemi <jhi@alpha.hut.fi>
0.9077     9.5 /  10.5      7  nvp@shore.net
0.9014    15.4 /  17.1      3  Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
0.8949     0.6 /   0.7      6  "Joshua Marotti" <jpm@iti-oh.comNOSPAM>
0.8311     5.4 /   6.6      4  tina@mail.scandinaviaonline.se
0.8279     5.6 /   6.7      8  Tim  Smith <trs@azstarnet.com>

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

          (kb)    (kb)
OCR       orig /  body  Posts  Address
------  --------------  -----  -------

0.4672     0.7 /   1.5      3  xxbbell@voicenet.com
0.4655     2.0 /   4.2      4  Doug MacEachern <dougm@osf.org>
0.4501     0.8 /   1.7      4  Bart Lateur <bart.mediamind@tornado.be>
0.4135     2.6 /   6.3      5  Charles DeRykus <ced@bcstec.ca.boeing.com>
0.3995     2.3 /   5.8      7  Matthew Burnham <danew@enterprise.net>
0.3858     0.6 /   1.5      3  Gisle Aas <aas@bergen.sn.no>
0.3764     1.9 /   5.1      4  Adam Rogoyski <ifqa242@spice.cc.utexas.edu>
0.3607     1.1 /   3.0      4  xewj@odin.sunquest.com
0.3054     0.7 /   2.4      3  Darin Burleigh <burleigh@hackberry.chem.niu.edu>
0.2542     0.5 /   2.1      4  Dave Lilly <lilly@fedex.com>

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   14  [Q] Converter between ELM filter-rules file to procmailrc file?
   11  EASY PROBABLY: removing names from paths
   10  Buy any Perl book in print
    9  JAPH (was: function pointer dereferencing)
    8  How-to cut the last characters of a varibles
    8  Inserting within a string?
    8  How to make Perl Regular expressions "Rightmost is greediest"?
    7  ? on Server Redirection with Perl
    7  html --> perl
    7  Counting Files

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  29.9 (  3.8/ 15.1/ 13.7)      5  parsing techniques (advice needed)
  27.8 ( 13.7/ 13.3/  8.6)     14  [Q] Converter between ELM filter-rules file to procmailrc file?
  22.6 (  2.7/ 19.8/ 19.3)      4  Calculating distances in Perl?
  19.9 (  4.4/ 15.5/  9.2)      6  [Q]: Use a Variable to Provide $vars to Split?
  16.3 (  1.9/ 14.4/ 14.2)      2  I GOT IT!  I GOT IT! [WAS: Re: Trouble With : Delimited Database]
  14.9 (  7.1/  6.6/  4.1)      9  JAPH (was: function pointer dereferencing)
  14.8 (  7.8/  6.1/  3.2)     11  EASY PROBABLY: removing names from paths
  14.0 (  3.3/ 10.5/  6.1)      5  sleep not mixing well with other signal handlers
  12.3 (  3.7/  8.3/  7.5)      6  Case Statement..
  12.0 (  0.8/ 11.2/ 10.9)      1  Too Stupid For Their Own Good? [Intel v Randal]

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      27  comp.lang.perl.modules
      14  comp.mail.misc
      14  comp.mail.elm
      13  alt.fan.e-t-b
      12  comp.lang.perl
       7  comp.sys.sun.misc
       7  comp.sys.sun.admin
       4  comp.unix.unixware.misc
       3  kristoff.bonne
       3  comp.lang.perl.tk

Top 10 Crossposters
===================

Articles  Address
--------  -------

      12  Martin Ramsch <ramsch@forwiss.uni-passau.de>
      11  guckes@math.fu-berlin.de
       7  Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
       7  Jeffrey Kegler <cybersalem@algorists.com>
       6  Randal Schwartz <merlyn@stonehenge.com>
       4  Matthew Burnham <danew@enterprise.net>
       4  Tom Phoenix <rootbeer@teleport.com>
       4  Chris Gaston <cgaston@lds.com>
       4  Al <spohn@millcomm.com>
       3  Steve Edberg <sbedberg@ucdavis.edu>


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

Date: 10 Aug 1997 13:03:26 -0500
From: mikebo@MCS.COM (Michael Borowiec)
Subject: Update: Perl 5 FileCache module broken?
Message-Id: <5skvpe$e2c$1@Mars.mcs.net>

In article <5skv87$dpt$1@mars.mcs.net>,
Michael Borowiec <mikebo@MCS.COM> wrote:
>Greetings -
>I'm trying to use the Perl 5 FileCache module to keep a couple hundred
>files open under Perl 5.004_01 and SunOS 4.1.4. However, even in the
>following simple test script, I'm not able to open more than 63 files
>(including STDIN, STDOUT and STDERR). I even tried to lower the
>FileCache "maxopen" variable, but it fails in the same spot. Is the
>FileCache module broken, or am I doing something wrong?
>
>prompt> cat maxfile
>#!/usr/local/bin/perl5
>use FileCache;
>$FileCache::maxopen = 20;
>for $i (0 .. 1024) {
>        $filename = "/tmp/crud$i";
>        cacheout($filename);
>}
>
>prompt > maxfile
>Can't create /tmp/crud61: Too many open files at ./maxfile line 6
>
Stranger still...

prompt> ulimit -n 1024
ksh: ulimit: exceeds allowable limit
prompt> ulimit -n 256
prompt> maxfile
Can't create /tmp/crud125: Bad file number at ./maxfile line 6

Regards,
- Mike


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

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

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