[28561] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9925 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 3 06:05:59 2006

Date: Fri, 3 Nov 2006 03:05:06 -0800 (PST)
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, 3 Nov 2006     Volume: 10 Number: 9925

Today's topics:
        Calling Perl program from Java Script and populating th <kalyanrajsista@gmail.com>
    Re: Calling Perl program from Java Script and populatin <thepoet_nospam@arcor.de>
        Data plotting questions   Nov. 2, 2006 <edgrsprj@ix.netcom.com>
    Re: Data plotting questions   Nov. 2, 2006 yankeeinexile@gmail.com
    Re: Data plotting questions   Nov. 2, 2006 <tadmc@augustmail.com>
    Re: Data plotting questions   Nov. 2, 2006 <edgrsprj@ix.netcom.com>
    Re: Data plotting questions   Nov. 2, 2006 <edgrsprj@ix.netcom.com>
    Re: Data plotting questions   Nov. 2, 2006 <bik.mido@tiscalinet.it>
    Re: Data plotting questions   Nov. 2, 2006 <rvtol+news@isolution.nl>
        Getting huge data into memory in perl <rahul.thathoo@gmail.com>
    Re: Getting huge data into memory in perl <rahul.thathoo@gmail.com>
    Re: Getting huge data into memory in perl <rvtol+news@isolution.nl>
    Re: how do i update one section of a page leaving rest? <uri@stemsystems.com>
        new CPAN modules on Fri Nov  3 2006 (Randal Schwartz)
        perl and epoll <sonet.all@msa.hinet.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 2 Nov 2006 23:28:25 -0800
From: "alwaysonnet" <kalyanrajsista@gmail.com>
Subject: Calling Perl program from Java Script and populating the list boxes
Message-Id: <1162538905.569810.253250@k70g2000cwa.googlegroups.com>

Hi all,

Question 1 - Is it possible to call a perl subroutine from Javascript ?
Question 2 - Please provide an idea of how to build dynamic list boxes
using Javascript.

I have 2 list boxes containing Origin and Destination of flights. If i
select one Origin country then , second list box must populate only
those countries which have flights.

In the http://www.ryanair.com/site/EN/ site, If I select "Aarhus" as
origin and it will show only 2 countries "Barcelona" & "London". When i
see the code, it has pre-assigned arrays, whenever OnClick is triggered
it is calling the function and populating the array values.

But i need to populate the destinations from the database everytime i
select the origin from the listbox 1. Simply saying that I can't
hardcode the origin and destination arrays , as i need to get them from
the database...

Any help or suggestions are appreciated...

Thanks,
Raj



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

Date: Fri, 03 Nov 2006 09:22:45 +0100
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: Calling Perl program from Java Script and populating the list boxes
Message-Id: <454afc56$0$27619$9b4e6d93@newsspool2.arcor-online.net>

alwaysonnet wrote:
> Question 1 - Is it possible to call a perl subroutine from Javascript ?
> Question 2 - Please provide an idea of how to build dynamic list boxes
> using Javascript.
 >
> I have 2 list boxes containing Origin and Destination of flights. If i
> select one Origin country then , second list box must populate only
> those countries which have flights.
> 
> In the http://www.ryanair.com/site/EN/ site, If I select "Aarhus" as
> origin and it will show only 2 countries "Barcelona" & "London". When i
> see the code, it has pre-assigned arrays, whenever OnClick is triggered
> it is calling the function and populating the array values.
>
> But i need to populate the destinations from the database everytime i
> select the origin from the listbox 1. Simply saying that I can't
> hardcode the origin and destination arrays , as i need to get them from
> the database...

You're most probably looking for a good introduction to AJAX
(Asynchronuous Javascript And Xml), also popular as "Web 2.0".
AJAX works on the principle of having a set of client side scripts
that dynamically change contents of the page and a set of backend
scripts in any language that deliver the data on request via the XML
format.

There are a number of frameworks outside that ease the creation
of AJAX applications, maybe the fastest way to bring AJAX and
Perl together is the CGI::Ajax module which is available from
the CPAN archive:
http://search.cpan.org/~bct/CGI-Ajax-0.697/lib/CGI/Ajax.pm

HTH
-Chris


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

Date: Fri, 03 Nov 2006 02:30:52 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Data plotting questions   Nov. 2, 2006
Message-Id: <wRx2h.1207$L6.197@newsread3.news.pas.earthlink.net>

Data Plotting Questions:   November 2, 2006

1.  What commands etc. can be used to have Perl generate simple two
dimensional x - y data plots from an array such as $data[$x,$y]?

2.  Does an additional graphics module have to be installed?

3.  When a plot is generated like that, how can it be stored as a GIF or BMP
file?  If all else failed I could probably generate the plot and do a screen
capture and store it that way.

If someone can provide enough information regarding how to get started on
this then I should be able to do whatever reading is necessary and fill in
the details myself.




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

Date: 02 Nov 2006 20:57:11 -0600
From: yankeeinexile@gmail.com
Subject: Re: Data plotting questions   Nov. 2, 2006
Message-Id: <87wt6dutiw.fsf@gmail.com>

"edgrsprj" <edgrsprj@ix.netcom.com> writes:
> Data Plotting Questions:   November 2, 2006
> 
> 1.  What commands etc. can be used to have Perl generate simple two
> dimensional x - y data plots from an array such as $data[$x,$y]?
> 

I'd probably start with abs atan2 cos exp int log sin sqrt pop push
shift splice unshift grep join map reverse pack unpack keys values
open close binmode sub defined and all of the other functions that
Perl provides.  

> 2.  Does an additional graphics module have to be installed?

Perl is turing-complete.  Any program that can be written, can be
written in Perl.  Taking perl subroutines and wrapping them up in
modules means you can use someone ELSE's time and money to write YOUR
program. 

An intrepid programmer with lots of time on his hands, sitting on a
desert island with nothing but a base Perl installation and the
specifications for his favorite graphic format can write a monstrous
perl program without any packages or modules that can produce
three-dimensional ray-traced animated visualizations of data.

> 3.  When a plot is generated like that, how can it be stored as a GIF or BMP
> file?  If all else failed I could probably generate the plot and do a screen
> capture and store it that way.

Any of the popular graphics libraries you may choose can easily write
in any popular format.

> If someone can provide enough information regarding how to get started on
> this then I should be able to do whatever reading is necessary and fill in
> the details myself.

http://search.cpan.org/

Two popular modules, each with a huge following are Perl::Magick (the
perl interface to the Imagemagick suite) and GD (the perl interface to
Boutell's GD library.)  Both of these are more targetted at image
manipulations, but they are both at the center of their own large
onion of modules.

I used to do a LOT of plotting with gnuplot.  I wonder if there's a
Perl interface to that ... [twelve seconds later I find ... ]

http://search.cpan.org/author/CAIDAPERL/Chart-Graph-3.2/Graph/Gnuplot.pm

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
	Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.


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

Date: Thu, 2 Nov 2006 22:19:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Data plotting questions   Nov. 2, 2006
Message-Id: <slrneklgqp.san.tadmc@tadmc30.august.net>

edgrsprj <edgrsprj@ix.netcom.com> wrote:

> Data Plotting Questions:   November 2, 2006


The date is in the Subject header.

The date is in the body.

The date is in the Date header.

Let's be really sure when this was posted for some reason?


> 1.  What commands etc. can be used to have Perl generate simple two
> dimensional x - y data plots from an array such as $data[$x,$y]?

> If someone can provide enough information regarding how to get started on


   http://search.cpan.org/search?query=plot&mode=all


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


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

Date: Fri, 03 Nov 2006 05:27:37 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Data plotting questions   Nov. 2, 2006
Message-Id: <drA2h.1515$ig4.550@newsread2.news.pas.earthlink.net>


> http://search.cpan.org/author/CAIDAPERL/Chart-Graph-3.2/Graph/Gnuplot.pm
>

The 3.2/Graph . program that you located looks like it will get the job
done.  It both plots data and produces various types of files such as GIF.

The main data processing Perl program that I have developed and am using is
presently about 150 KB in size.  I converted all of my other programs
written in Basic and other languages over a ten year period to Perl.  But I
am not an expert with getting Perl modules running and could use some
specific types of help with that program.  If someone would like to be of
assistance with that then that would be appreciated.

First, how do I decompress the program's tar.gz file which I downloaded.  Is
there a recommended unzip type program for doing that which can be
downloaded from some location and which is certified free of viruses?

I am already using Math::Trig;  Win32::Clipboard;  and Win32::GuiTest;.  So
I have at least some familiarity with these processes.




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

Date: Fri, 03 Nov 2006 05:29:07 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Data plotting questions   Nov. 2, 2006
Message-Id: <DsA2h.1518$ig4.1424@newsread2.news.pas.earthlink.net>

Thanks for the comments.  There does appear to be a plotting program
available which will work.




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

Date: Fri, 03 Nov 2006 11:52:51 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Data plotting questions   Nov. 2, 2006
Message-Id: <qq6mk2pr90dohlhh83hr5p75regokdiue3@4ax.com>

On Fri, 03 Nov 2006 05:27:37 GMT, "edgrsprj" <edgrsprj@ix.netcom.com>
wrote:

>written in Basic and other languages over a ten year period to Perl.  But I
>am not an expert with getting Perl modules running and could use some
>specific types of help with that program.  If someone would like to be of
>assistance with that then that would be appreciated.

Generally there's no need to be experts at "getting Perl modules
running": you just install them and they run out of the box. There
*are* occasional, rare, cases in which installing a module and/or
getting it to work may give you a headache

>First, how do I decompress the program's tar.gz file which I downloaded.  Is

If you were under *NIX, then with almost absolute certainty you would
have the tools and know how to use them. Thus I guess you're under
Windows, and checking the header of your post confirms this. Now,
there are native Win32 ports of common *NIX utilities, e.g. the
UNXUTILS and GnuWin32 which you may be interested in searching with
Google anyway. Anyway, if you prefer a GUI based solution, then there
are popular alternatives: e.g. 7-Zip (opensource) or IZArc (freeware).

>there a recommended unzip type program for doing that which can be
>downloaded from some location and which is certified free of viruses?

I answered this above. But now comes the surprise: you don't even need
it. First of all it should be important to know which Perl distro
you're using, and nother wild but very reasonable guess suggests it's
ActiveState's ActivePerl. Then you don't need and generally do not
*want* to download modules from CPAN: just use your own distro's
native tool, which is ppm. (With the latest build also available in
GUI form, they tell me.)


HTH,
Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Fri, 3 Nov 2006 11:54:33 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Data plotting questions   Nov. 2, 2006
Message-Id: <eifavs.1d0.1@news.isolution.nl>

edgrsprj schreef:

> First, how do I decompress the program's tar.gz file which I
> downloaded.

See www.cpan.org, / FAQ / install modules.
http://www.cpan.org/misc/cpan-faq.html#How_install_Perl_modules

If this is on Windows and with ActiveState's perl, use the AS package
manager.
Since 819 there is also a GUI.

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: 3 Nov 2006 01:10:49 -0800
From: "rahulthathoo" <rahul.thathoo@gmail.com>
Subject: Getting huge data into memory in perl
Message-Id: <1162545048.962267.173380@m73g2000cwd.googlegroups.com>

Hi

I have a huge data set with me. Its like over 10000 files each with
average 50KB of data. Assuming I have sufficient RAM, i need to be able
to load all this into memory so that when i have to look for it I dont
have to do an I/O. How do I go about this whole process in perl. 

Rahul



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

Date: 3 Nov 2006 02:27:55 -0800
From: "rahulthathoo" <rahul.thathoo@gmail.com>
Subject: Re: Getting huge data into memory in perl
Message-Id: <1162549675.218375.192310@f16g2000cwb.googlegroups.com>

when i print the result of the following code - it gives me just the
first
line of the file. What do u think is wrong?

my %table1=();
for($var=1;$var<2; $var++)
{
       ....
       .......
       .........
       open A, $mov_i || die "Shit there is some prob here $!";
       $table1{$var} = <A>;
       close A;
}

foreach $row ($table1{1})
{
       print "$row\n";
}



rahulthathoo wrote:
> Hi
>
> I have a huge data set with me. Its like over 10000 files each with
> average 50KB of data. Assuming I have sufficient RAM, i need to be able
> to load all this into memory so that when i have to look for it I dont
> have to do an I/O. How do I go about this whole process in perl.
> 
> Rahul



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

Date: Fri, 3 Nov 2006 11:58:59 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Getting huge data into memory in perl
Message-Id: <eifavs.1d0.2@news.isolution.nl>

rahulthathoo schreef:

>        open A, $mov_i || die "Shit there is some prob here $!";

Wrong or-operator or some () missing. 
See perlopentut.

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Thu, 02 Nov 2006 23:47:15 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: how do i update one section of a page leaving rest?
Message-Id: <x7hcxhdtm4.fsf@mail.sysarch.com>

>>>>> "g" == gavino  <bootiack@yahoo.com> writes:

  g> Michele Dondi wrote:
  >> 
  >> Oh, you should have specified these details in the first place. Then
  >> it would have been easier to help you. So here's another try: open the
  >> sources for that web app in your favourite editor and write some code
  >> that will delete the section you don't like, and update it with the
  >> new content.

  g> You realise you come off as an idiot when you talk like this?

nah, he was just treating you like the idiot you are. big difference.

  g> vote republican.

more proof of your idiocy.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Fri, 3 Nov 2006 05:42:09 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Nov  3 2006
Message-Id: <J853u9.1sow@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Alvis-NLPPlatform-0.2
http://search.cpan.org/~thhamon/Alvis-NLPPlatform-0.2/
Perl extension for linguistically annotating XML documents in Alvis
----
Alvis-TermTagger-0.2
http://search.cpan.org/~thhamon/Alvis-TermTagger-0.2/
Perl extension for tagging terms in a corpus
----
BSD-Process-0.02
http://search.cpan.org/~dland/BSD-Process-0.02/
Retrieve information about running processes
----
CGI-FormBuilder-Source-YAML
http://search.cpan.org/~markle/CGI-FormBuilder-Source-YAML/
Initialize FormBuilder from YAML file
----
CGI-FormBuilder-Source-YAML-1.0.1
http://search.cpan.org/~markle/CGI-FormBuilder-Source-YAML-1.0.1/
Initialize FormBuilder from YAML file
----
CGI-FormBuilder-Source-YAML-1.0.3
http://search.cpan.org/~markle/CGI-FormBuilder-Source-YAML-1.0.3/
Initialize FormBuilder from YAML file
----
Catalyst-Plugin-FormValidator-Simple-0.12
http://search.cpan.org/~lyokato/Catalyst-Plugin-FormValidator-Simple-0.12/
Validator for Catalyst with FormValidator::Simple
----
Catalyst-Plugin-FormValidator-Simple-01.12
http://search.cpan.org/~lyokato/Catalyst-Plugin-FormValidator-Simple-01.12/
Validator for Catalyst with FormValidator::Simple
----
Catalyst-View-GD-Barcode-QRcode-0.04
http://search.cpan.org/~hide/Catalyst-View-GD-Barcode-QRcode-0.04/
GD::Barcode::QRcode View Class
----
Class-DBI-Loader-Sybase-0.02
http://search.cpan.org/~djerius/Class-DBI-Loader-Sybase-0.02/
Class::DBI::Loader Sybase Implementation.
----
Convert-Binary-C-0.66
http://search.cpan.org/~mhx/Convert-Binary-C-0.66/
Binary Data Conversion using C Types
----
DBI-1.53
http://search.cpan.org/~timb/DBI-1.53/
Database independent interface for Perl
----
DBIx-Wrapper-VerySimple-0.051
http://search.cpan.org/~matisse/DBIx-Wrapper-VerySimple-0.051/
Simplify use of DBI
----
Data-Define-1.02
http://search.cpan.org/~stro/Data-Define-1.02/
Make undef's defined
----
Devel-XRay-0.94
http://search.cpan.org/~jbisbee/Devel-XRay-0.94/
See What a Perl Module Is Doing
----
Email-Filter-Rules-1.12
http://search.cpan.org/~jbisbee/Email-Filter-Rules-1.12/
Simple Rules for Routing Mail with Email::Filter
----
Games-ScottAdams-0.03
http://search.cpan.org/~mirk/Games-ScottAdams-0.03/
Perl extension for representing Scott Adams games
----
Getopt-Euclid-v0.1.0
http://search.cpan.org/~dconway/Getopt-Euclid-v0.1.0/
Executable Uniform Command-Line Interface Descriptions
----
Imager-Filter-Sepia-0.01
http://search.cpan.org/~kurihara/Imager-Filter-Sepia-0.01/
filter that convert to sepia tone.
----
Lemonldap-NG-Handler-0.6
http://search.cpan.org/~guimard/Lemonldap-NG-Handler-0.6/
The Apache module part of Lemonldap::NG Web-SSO system.
----
Lemonldap-NG-Handler-0.61
http://search.cpan.org/~guimard/Lemonldap-NG-Handler-0.61/
The Apache module part of Lemonldap::NG Web-SSO system.
----
Lemonldap-NG-Portal-0.4
http://search.cpan.org/~guimard/Lemonldap-NG-Portal-0.4/
The authentication portal part of Lemonldap::NG Web-SSO system.
----
Lingua-EN-Conjugate-0.2
http://search.cpan.org/~rwg/Lingua-EN-Conjugate-0.2/
Conjugation of English verbs
----
Object-InsideOut-2.19
http://search.cpan.org/~jdhedden/Object-InsideOut-2.19/
Comprehensive inside-out object support module
----
POE-Component-RSSAggregator-1.02
http://search.cpan.org/~jbisbee/POE-Component-RSSAggregator-1.02/
Watch Muliple RSS Feeds for New Headlines
----
SNMP-Persist-0.03
http://search.cpan.org/~anias/SNMP-Persist-0.03/
The SNMP pass_persist threaded backend
----
Security-CVSS-0.3
http://search.cpan.org/~jdennis/Security-CVSS-0.3/
Calculate CVSS values (Common Vulnerability Scoring System)
----
Sledge-View-0.02
http://search.cpan.org/~tokuhirom/Sledge-View-0.02/
abstract base class for Sledge's view(EXPERIMENTAL!!)
----
Sledge-View-0.03
http://search.cpan.org/~tokuhirom/Sledge-View-0.03/
abstract base class for Sledge's view(EXPERIMENTAL!!)
----
Spreadsheet-ParseExcel-0.27_03
http://search.cpan.org/~szabgab/Spreadsheet-ParseExcel-0.27_03/
Get information from Excel file
----
Sub-ScopeFinalizer-0.01
http://search.cpan.org/~hio/Sub-ScopeFinalizer-0.01/
execute a code on exiting scope. 1
----
Test-Class-0.21
http://search.cpan.org/~adie/Test-Class-0.21/
Easily create test classes in an xUnit/JUnit style
----
Text-Password-Pronouncable-0.26
http://search.cpan.org/~clkao/Text-Password-Pronouncable-0.26/
----
Time-Interval-1.1
http://search.cpan.org/~ahicox/Time-Interval-1.1/
Converts time intervals of days, hours, minutes, and seconds
----
WebService-Basecamp-0.1.2
http://search.cpan.org/~davidb/WebService-Basecamp-0.1.2/
Perl interface to the Basecamp API webservice
----
XML-RSS-Feed-2.21
http://search.cpan.org/~jbisbee/XML-RSS-Feed-2.21/
Persistant XML RSS Encapsulation
----
threads-1.48
http://search.cpan.org/~jdhedden/threads-1.48/
Perl interpreter-based threads
----
trace-0.54
http://search.cpan.org/~jbisbee/trace-0.54/
Module Reanmed to Devel::XRay
----
trace-0.55
http://search.cpan.org/~jbisbee/trace-0.55/
Module Reanmed to Devel::XRay


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
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: Fri, 3 Nov 2006 16:14:05 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: perl and epoll
Message-Id: <eietoh$jtq$1@netnews.hinet.net>

When i use one program to send data. The speed of upload file is slow.
But when i use two(>=2) programs to testing the transmission speed at
the same time. It is very fast. The  transmission speed is almost equal
to (* how many programs is running)

I can not find any solution to slove the problem.I try to modify the the
value of epoll_wait()'s parameter.

my $events_count = epoll_wait( $epoll,15,3600, $events );
my $events_count = epoll_wait( $epoll,2,0, $events );
my $events_count = epoll_wait( $epoll,2,-1, $events );
my $events_count = epoll_wait( $epoll,2,100, $events );

But the problem still exist.
And i find that the  $events_count always is 1 when i upload file via
another programs.
=========================================================
#!/usr/bin/perl
use strict;
use IO::Socket;
use Sys::Syscall ':epoll';
use Errno 'EWOULDBLOCK';
my ( $haveEpoll, $epoll );
if ( Sys::Syscall::epoll_defined() )
{
 $epoll = eval { epoll_create(1); };
 $haveEpoll = defined $epoll && $epoll >= 0;
}
if ( !$haveEpoll )
{
 require IO::Poll;
}

my $listen = IO::Socket::INET->new(Proto => 'tcp',
       LocalPort => 21,
       Listen =>  SOMAXCONN ,
       Reuse => 1) or die $!;

PollIn_Event_Add( $epoll, fileno($listen) );

my %accepthash;
my $events;
while (1)
{
 $events = [];
 my $events_count = epoll_wait( $epoll,15,3600, $events );

 for ( my $i = 0 ; $i < $events_count ; $i++ )
 {
  my $ev = $events->[$i];
  $ev ||= [];

        if (! defined $accepthash{$ev->[0] } && $ev->[0] eq
fileno($listen) ){
        my $connect=$listen->accept();
        PollIn_Event_Add( $epoll, fileno($connect) );
        $accepthash{fileno($connect)}=$connect;
   open(handle,">/usr/local/Portal/cache/" . fileno($connect) );
  close(handle);
        }else{

  if ( $ev->[1] == EPOLLIN )
  {
   my $buffer='';
   my $rc = sysread($accepthash{$ev->[0]}, $buffer, 16384,0 );
   if ( defined $rc )
   {
    if ( $rc > 0 )
    {
     #print $rc . "\n";
     open(handle,">>/usr/local/Portal/cache/" . $ev->[0]);
     print handle $buffer;
     close(handle);
     substr( $buffer, 0, $rc ) = '';
    } else
    {

                eval { shutdown( $accepthash{$ev->[0]}, 2 ); };
                delete $accepthash{$ev->[0]};
    }


   } elsif ( $! == EWOULDBLOCK )
   {

   } else
   {

                eval { shutdown( $accepthash{$ev->[0]}, 2 ); };
                delete $accepthash{$ev->[0]};
    PollIn_Event_Del( $epoll, $ev->[0] );
   }

  }elsif($ev->[1] == EPOLLERR){

                eval { shutdown( $accepthash{$ev->[0]}, 2 ); };
                delete $accepthash{$ev->[0]};
    PollIn_Event_Del( $epoll, $ev->[0] );
  }
        }
 }
}

sub PollIn_Event_Add
{
 my ( $epoll, $fd ) = @_;
 my $ctl_rtn;
 $ctl_rtn = epoll_ctl( $epoll, EPOLL_CTL_ADD, $fd, EPOLLIN | EPOLLERR );
 print 'PollIn_Event_Add:' . $ctl_rtn . "\n";
}

sub PollIn_Event_Del
{
 my ( $epoll, $fd ) = @_;
 my $ctl_rtn;
 $ctl_rtn = epoll_ctl( $epoll, EPOLL_CTL_DEL, $fd,0 );
 print 'PollIn_Event_Del:' . $ctl_rtn . "\n";
}




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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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