[23312] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5532 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 20 00:06:02 2003

Date: Fri, 19 Sep 2003 21:05:07 -0700 (PDT)
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, 19 Sep 2003     Volume: 10 Number: 5532

Today's topics:
        A question about nested eval for alarm <xqiu@wlv.agilent.com>
    Re: Conditionnal occurence modification <bwalton@rochester.rr.com>
    Re: debugging (Pete Butler)
    Re: debugging <bwalton@rochester.rr.com>
    Re: GD object problem <NOSPAM@bigpond.com>
    Re: Intermediate Page w/ CGI Script (Pete Butler)
    Re: kill command in a perl script <krahnj@acm.org>
    Re: kill command in a perl script <krahnj@acm.org>
    Re: Modify a text file directly <krahnj@acm.org>
    Re: Parsing A Report <krahnj@acm.org>
    Re: perl lib all over the place <samj@austarmetro.com.au>
    Re: perl lib all over the place (Tad McClellan)
    Re: perl man pages in xemacs <bwalton@rochester.rr.com>
    Re: referencing, closures, classes <x12code-del@del-yahoo.com>
    Re: regexp help - match on two backslashes <abigail@abigail.nl>
    Re: return() inside eval <bwalton@rochester.rr.com>
    Re: simple server <spam-block-@-SEE-MY-SIG.com>
    Re: sort  issue <krahnj@acm.org>
    Re: wtf is the deal? <me@privacy.net>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 19 Sep 2003 21:01:19 -0700
From: Xiaoqin Qiu <xqiu@wlv.agilent.com>
Subject: A question about nested eval for alarm
Message-Id: <3F6BD10F.4E3E4C2@wlv.agilent.com>

Hi,

I am trying to wirte code timout a possible hang process. I saw some
sample codes that uses nested evals. But I can not see the reason why
the nested evals are needed. I am listing both the nested eval and
single eval sample codes. Could anyone help me find out if there is any
problem using just single eval?

Thanks,

Xiaoqin

Single eval code:
-------------
$SIG{ALRM} = \&timeout;

sub timeout
{
  my $pid;
  ......          # To find out PID of cat bigfile
  kill 9 => $pid;
  die "Timeout";
}


if (open(FH, "cat bigfile 2>&1 |"))
{
  eval
  {
    alarm(10);
    while(<FH>)
    {
       print $_;
     }
     alarm(0);
  };
  alarm(0);
  close(FH);
}

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

Nested eval code:
-------------
$SIG{ALRM} = \&timeout;    # Same as single eval code

sub timeout    # Same as single eval code
{
  my $pid;
  ......          # To find out PID of cat bigfile
  kill 9 => $pid;
  die "Timeout";
}

if (open(FH, "cat bigfile 2>&1 |"))
{
  eval
  {
    alarm(10);
     eval
     {
      while(<FH>)
      {
         print $_;
       }
      };
     alarm(0);
  };
  alarm(0);
  close(FH);
}





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

Date: Sat, 20 Sep 2003 01:16:17 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Conditionnal occurence modification
Message-Id: <3F6BAA5B.7000505@rochester.rr.com>

Steve Hémond wrote:

> Hi,
> 
> I post something about that issue earlier : I want to modify a text-file
> that looks like this : (assume that * are random characters)
> 
> PS1****PW0.50****PW1****PW2.5***PS4*****PW5.5***PS1***PW4.2***PW2.0***
> 
> ..and so on.
> 
> For each PSx I have to set the PWx's to the same value :
> 
> PS1 = PW5.0
> PS2 = PW10.0
> PS3 = PW15.0
> 
> I have to scan the file using this logic :
> 
> 1. Scan the file until a PSx is found.
> 2. Scan until the next PWx and replace it to the PSx's correct value.
> 3. Continue scanning and replacing all PWx's until the next PSx is found.
> 
> Actually I can replace the PWx's between the PSx only if there is an even
> number of PWx between the PSx.
> 
> Any ideas?


Try:

use strict;
use warnings;
my %h=(1=>'5.0',2=>'10.0',3=>'15.0');
my($in,$n);
{local $/;$in=<DATA>;}
my @ps=split /(PS\d+)/,$in;
for(@ps){
	$n=$1 if /^PS(\d+)$/;
	my @pw=/PW[\d.]+/g;
	s/PW[\d.]+/PW$h{$n}/g if @pw%2==0 and @pw>1;
}
print join '',@ps;
__END__
PS1****PW0.50****PW1****PW2.5***PS4*****PW5.5***PS1***PW4.2***PW2.0***
PS1blahPW2.3blahPW1.2blahPS2
xxxPW3.4xxxPS3xPW5.6xPW6.7PS2xxx
xxxPW3.4xxxPS2xPW5.6xPW6.7xxPW8.9xxxxx

 ...


> Steve

-- 
Bob Walton



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

Date: 19 Sep 2003 18:55:08 -0700
From: pmbutler@attbi.com (Pete Butler)
Subject: Re: debugging
Message-Id: <9b766f0.0309191755.e651c03@posting.google.com>

"superfly2" <darius_fatakia@yahoo.com> wrote in message news:<bkfpl5$9aq$1@news.Stanford.EDU>...
> just a general debugging question:
> i'm writing a script (web script) and i keep getting back the infamous
> Error message:
> Premature end of script headers: new_batch_convert.pl
> 
> I have "use strict" and "use warnings", and I check the error log but that
> message is ALL i get. i'm trying to comment out different regions to get it
> to work that way but i was wondering if there were any other suggestions for
> approaching this. Basically, I had a working script that i modified and now
> i don't know where my bug is. If it was a missing semicolon or parentheses,
> I would get some line number reference right?
> 
> thanks!

I don't know if this will work for what you're doing, but one helpful
trick I've been using is to wrap all my "interesting" script code in
an eval block, then trap the error message and shunt it to an error
page.

eval {
    <CODE>
};
whineAndDie($@) if $@;

 . . . where "whineAndDie" is a subroutine that logs the error message
and sends the user an error page with that error message featured
prominently.

Makes it a hell of a lot easier to diagnose unexpected runtime errors.

-- Pete Butler


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

Date: Sat, 20 Sep 2003 02:14:35 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: debugging
Message-Id: <3F6BB803.1060507@rochester.rr.com>

superfly2 wrote:

> just a general debugging question:
> i'm writing a script (web script) and i keep getting back the infamous
> Error message:
> Premature end of script headers: new_batch_convert.pl
> 
> I have "use strict" and "use warnings", and I check the error log but that
> message is ALL i get. i'm trying to comment out different regions to get it
> to work that way but i was wondering if there were any other suggestions for
> approaching this. Basically, I had a working script that i modified and now
> i don't know where my bug is. If it was a missing semicolon or parentheses,
> I would get some line number reference right?


Wrong.


This is a FAQ.  Please check:

    perldoc -q 500

and follow everything there and in all the places to which it refers you 
to the letter.  If you still have trouble, ask again indicating you have 
done all that.  Hint:  the error message above is from your web server, 
not from Perl.  Your web server expects headers and then a null line 
from your script; it isn't getting that.  Maybe because the script 
didn't compile; maybe because it didn't output the right stuff -- it's 
all the same to the web server -- all it knows or cares about is that it 
didn't get the right stuff from your script.

BTW, debugging CGI stuff is considered off-topic for this newsgroup (the 
issues would be the same if your script was written in C, DOS batch 
file, etc).  You might have better luck at 
comp.infosystems.www.authoring.cgi .

-- 
Bob Walton



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

Date: Sat, 20 Sep 2003 10:06:23 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: GD object problem
Message-Id: <bkg5m8$1donk$1@ID-202028.news.uni-berlin.de>

"Vesselin Baev" <vesko_baev@abv.bg> wrote in message
news:cb413b7.0309191110.3f5bf86f@posting.google.com...
> Hello to All,
> Baybe I'm not alone with this message error when I started the script:
> Can't locate loadable objest for module GD...
> I've noticed that in the forum there is a lot of people with the same
> problem but I did't find the solution for it!
> We using Linux SuSE, and we have the latest version of Perl. We
> installed the GD package and we have also the libgd files (I've
> checked that)!
> What we have to do!
>
> Thanks!
> Vesselin Baev

When you install GD it runs some tests. What was the result?

What version of GD are you using? I could not install the latest version as
it required too much additional bloat^H^H^H^H^Hsoftware so I went back to an
earlier version.

gtoomey




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

Date: 19 Sep 2003 18:42:07 -0700
From: pmbutler@attbi.com (Pete Butler)
Subject: Re: Intermediate Page w/ CGI Script
Message-Id: <9b766f0.0309191742.6f4d2d39@posting.google.com>

 . . . and, of course, my sincere thanks to everyone who helped despite
the marginal topicality of my question.

-- Pete Butler


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

Date: Sat, 20 Sep 2003 00:33:59 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: kill command in a perl script
Message-Id: <3F6BA06D.5D4A8A6D@acm.org>

Bart Lateur wrote:
> 
> Ted Zlatanov wrote:
> 
> >I should warn you that the "largest" PID is meaningless - new
> >processes do not necessarily have larger PIDs than older processes on
> >any OS I have used, including Linux.
> 
> Indeed. The reason is simple: wraparound beyond a fixed number of bits
> for the ID numbers. So after a while they start back at zero. (Or 1...?)

There is no PID zero and PID one should always (AFAIK) be assigned to
init.


John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 20 Sep 2003 00:35:49 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: kill command in a perl script
Message-Id: <3F6BA0DC.ABDFA173@acm.org>

Ted Zlatanov wrote:
> 
> On Wed, 17 Sep 2003, krahnj@acm.org wrote:
> 
> > Not that I'm against using modules.  :-) I just like to know what
> > all my options are.
> 
> I absolutely agree.  In this case, your options are to either use
> Proc::ProcessTable or to write alpha-quality software.  Using ps -ef
> and trying to manually parse the output is an absolutely horrible
> solution, and please understand I say that because I've done it, not
> to criticize your efforts.

Well, I wasn't using "ps -ef", I was using "ps h -C command -o
pid,command".

:-)

John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 20 Sep 2003 02:36:22 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Modify a text file directly
Message-Id: <3F6BBD1D.2E8B4242@acm.org>

Steve Hémond wrote:
> 
> I have to replace some chuncks out of a text file. My actual way to do this
> is to put the file contents into a scalar variable :
> 
> open (INPUT, "$ARGV[0]") or die ("Can't open file : $!\n");
               ^        ^
This has been discussed to death in another thread but you don't need
quotes there.  Either open(INPUT,$ARGV[0]) or open(INPUT,"<$ARGV[0]") is
what you want.


> $in = <INPUT>;
> close INPUT;
> 
> Then I do my modifications to the file and I (must) write the replacements
> into another file :

No, you don't have to.


> open  (OUTPUT, ">$ARGV[1]") or die ("Can't create file : $!\n");
> seek  (OUTPUT,0,0);
> print (OUTPUT $in);
> close  OUTPUT;
> 
> That way, I must save the replacements to ANOTHER file, which I don't want.
> I would like to modify the file DIRECTLY. Since I cannot modify the file
> using the file handle like this :
> 
> <INPUT> = s/blahblah/blah2blah2/g
> 
> How could I modify the file directly?

There is a FAQ about file locking that describes how to do what you
want.

perldoc -q "I just want to increment the number in the file"



John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 20 Sep 2003 01:41:40 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Parsing A Report
Message-Id: <3F6BB04B.225A2B93@acm.org>

raven wrote:
> 
> I have a system report that some of you may be familiar with. It is
> the output from the print_manifest command on an HP-UX system with
> ignite installed. There are divisions in the text file that I am
> trying to break up, but feel like I am going about wrong. I am trying
> to extract the block of text within 'Installed Software' up to the
> next major heading. Can someone check my work and comment? Thanks. See
> below:
> 
> Report:
> 
> Installed Software
> 
>     Your system was installed with HP-UX version B.11.11.
> 
>     Your system has the following software products installed and
>     configured on the system disk drive(s).
> 
>     Product          Revision          Description
>     B2491BA          B.11.11           MirrorDisk/UX
>     B3701AA          C.03.25.00        HP GlancePlus/UX Pak for s800 11i
> 
> [snip]
> 
>     OnlineDiag       B.11.11.03.08     HPUX 11.11 Support Tools Bundle, Jun 2001
>     RAID-00          B.11.11.01        PCI RAID; Supptd HW=A5856A
> 
> LVM File System Configuration
> 
> [snip]
> 
> 
> #!/usr/contrib/bin/perl -w
> 
> open SOFTWARE, "system.txt" or die "Cannot open file!";

You should include the $! variable in the error message to find out why
the open failed and you might want to include the file name as well. 
You could probably run the print_manifest command through a pipe and
avoid using a report file if you want.


> $flag = 0;
> while (<SOFTWARE>) {
>         if (/^Installed Software/) {
>                 $flag = 1;
>                 next;
>         }
>         if ($flag) {
>                 last if (/^\w+/);
>                 # Where we do the work.
>         }
> }

You can use the range operator in scalar context to get the lines you
want

while ( <SOFTWARE> ) {
    chomp;
    if ( /^Installed Software/ .. /^\S/ ) {
        # Where we do the work.
        my ( $prod, $rev, $desc ) = split ' ', $_, 3;
        next unless $rev =~ /\d/;
    }
}



John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 19 Sep 2003 22:36:52 GMT
From: Sam <samj@austarmetro.com.au>
Subject: Re: perl lib all over the place
Message-Id: <3F6B86C2.6020302@austarmetro.com.au>

ko wrote:
> "Sam" <samj@austarmetro.com.au> wrote in message news:<3f69c8ff@news.comindico.com.au>...
> 
>>Hello
>>
>>I have Perl modules all over the place and I think it would be good house
>>keeping practice to get them all in one common dir. If that is true then how
>>can I do that?
>>
>>Or just keep adding "use lib "/my/location";" at the top of the programs?
>>
>>I have some module.pm in the following locations
>>
>>/usr/local/lib/perl/5.6.1
>>
>>/usr/lib/perl/5.6.1
>>
>>/usr/local/lib/perl5/5.8.0/i686-linux
>>
>>/usr/local/lib/perl5/5.8.0
>>
>>/usr/local/lib/perl5/site_perl/5.8.0/i686-linux
>>
>>/usr/local/lib/perl5/site_perl/5.8.0
>>
>>/usr/local/lib/perl5/site_perl
>>
>>
>>
>>thanks
> 
> 
> Please *don't* mess with the modules in these locations. These are the
> default (built when Perl is installed) libraries that Perl searches
> when you 'use' or 'require' a module/file, which can also be found in
> Perl's special @INC array. If you type:

after installing debian, I learned that the perl version is 5.6 so 
knowing perl 5.8 is out there and 6 is just around the cornor and also 
knowing there is now .deb file for 5.8 yet, I downloaed the source, 
compiled it and installed it, so now I have 5.8, later I knew I should 
not have done that since it would upset debian way of doing things.
so I hope I did not shot my self in the foot. but if I did how can I fix 
  and avoid future problems?


> 
> perl -e 'print "$_\n" foreach (@INC)'
> 

Can't open perl script "print "$_\n" foreach (@INC)": No such file or 
directory.



> You will get the same directories listed above (actually half of the
> directories, since you seem to have two versions of Perl installed).
> 
> So if you're using one of Perl's core modules or have installed other
> CPAN modules and haven't messed with the makefile, you should not need
> to "use lib '/my/location';" in your programs as stated above.
> *Usually*, you only need the 'use lib' pragma in two cases: (1)
> personal libraries, or (2) if you don't have permission (no
> root/administrator privileges) to install CPAN modules in the system
> directories.

using xemacs, perl->Run and if I don't have use lib 
"/usr/local/lib/perl/5.6.1"; near the top of my module I get

cd /home/username/perl-programs/
/usr/local/bin/perl -w "/home/usrname/perl-programs/datetest.pl"
Can't locate Date/Calc.pm in @INC (@INC contains: 
/usr/local/lib/perl5/5.8.0/i686-linux /usr/local/lib/perl5/5.8.0 
/usr/local/lib/perl5/site_perl/5.8.0/i686-linux 
/usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) 
at /home/username/perl-programs/trend.pl line 5.
BEGIN failed--compilation aborted at 
/home/username/perl-programs/datetest.pl line 5.

Compilation exited abnormally with code 2 at Sat Sep 20 08:39:55

> 
> On an off topic note, I just saw your post regarding browsing the perl
> documentation. If you don't find the 'perldoc...' interface intuitive,
> may I suggest that you try http://www.perldoc.com/ ? It may be easier
> to browse the documentation in HTML, and there is documentation for
> the last six versions of Perl. The 'Perl Manpage' link takes you to
> Perl's *core* documentation.
> 
> HTH - keith




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

Date: Fri, 19 Sep 2003 18:08:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl lib all over the place
Message-Id: <slrnbmn33l.k2i.tadmc@magna.augustmail.com>

Sam <samj@austarmetro.com.au> wrote:

> knowing perl 5.8 is out there and 6 is just around the cornor 


It will be a few *years* before Perl 6 is done.

The design is not even half done yet, and that has been in
work for 3 years.


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


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

Date: Sat, 20 Sep 2003 02:42:05 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: perl man pages in xemacs
Message-Id: <3F6BBE76.7080903@rochester.rr.com>

Sam wrote:

 ...


> another point:
> in the text of a perl doc "See section <SectionName> at the bottom of 
> this document.
> is there a pod reader where <SectionName> would hyperlinked to that 
> location in that documnet for easy of navigation
> even pod2html does not do this.


The HTML docs from ActiveState do.  You can also use 
http://www.perldoc.com -- it has proper hyperlinks.


-- 
Bob Walton



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

Date: Fri, 19 Sep 2003 17:09:03 -0500
From: David McDivitt <x12code-del@del-yahoo.com>
Subject: Re: referencing, closures, classes
Message-Id: <bbummvoq7ua0bgp39ehdbbg1mhqos1qe10@4ax.com>

The book was written for someone with little programming skill, supposedly.
But reading it, I know I could not have understood at all if not already
experienced.

The flow chart part was good, actually. They are Java happy where I am, and
as to be expected they can't get much done. This is for two reasons. One,
the learning curve is too great for immediate success coming from COBOL.
Two, along with Java comes UML and all the stick people. It's a data
modeler's paradise. More time is spent making requirements documents and
drawing pictures than writing programs. But, Perl offers an alternative.
Documentation is important here - just not stick people and event diagrams,
please. The approach given in the book is use of two symbols only for
conciseness, a square (action) and diamond (decision). Each of the Perl loop
and conditional statements were laid alongside corresponding flow chart
symbols, and arrows were drawn exactly matching Perl code. It was very good.
I do not like to document. I do not like to make flow charts. But, if it
gets some of this Java crap and all these stick people out of here, I will
give it a shot. My first Perl project will be a test project, and if
successful they will be doing a lot of it here.

One reason I haven't done web stuff here is because of UML, event diagrams,
and all the stick people. I stuck with VB and LAN applications. Seeing Perl
I jumped on that, and plan to do real well with it.

>From: Uri Guttman <uri@stemsystems.com>
>Subject: Re: referencing, closures, classes
>Date: Fri, 19 Sep 2003 21:24:04 GMT
>
>>>>>> "DM" == David McDivitt <x12code-del@del-yahoo.com> writes:
>
>  DM> The closure part was brief. Classes weren't too bad. The rest of
>  DM> the book looks like gravy. Databases, threads, etc. I spent $85 on
>  DM> the book. Too much, yes, but I wanted something immediately. Why
>  DM> were there not many Perl books at Barnes and Noble?
>
>way expensive. sounds like it tries to cover too much and in too little
>depth. a classic flaw in language books.
>
>  DM> The book does have good stuff such as a whole chapter on
>  DM> fundamental flow charting. It was not UML. I hate stick
>  DM> people. There as another good chapter on the history of computers
>  DM> and the internet. The book is not a total waste.
>
>what? this covered flow charts? what kind of dumb shit is that? anyone
>who is learning perl and knows any other language should not need flow
>charts. ewwwww!!
>
>see if this is on books.perl.org and write the appropriately scathing
>review.



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

Date: 20 Sep 2003 01:14:40 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: regexp help - match on two backslashes
Message-Id: <slrnbmnag0.lsq.abigail@alexandra.abigail.nl>

Ryan Shondell (shondell@cis.ohio-state.edu) wrote on MMMDCLXXI September
MCMXCIII in <URL:news:xcwznh0r8st.fsf@psi.cis.ohio-state.edu>:
::  danielems@myfastmail.com (Daniel Ems) writes:
::  
:: > Hello,
:: > 
:: > Apologies if this is the wrong place to post this question...
:: > 
:: > What regular expression can I use to match two backslashes?  
::  
::  /\Q\\/


That's incorrect:

    $ perl -wle '$_ = "\\\\"; print; print "Nope" unless /^\Q\\$/'
    \\
    Nope

Use /\\\\/ instead:

    $ perl -wle '$_ = "\\\\"; print; print "Yes" if /^\\\\$/'
    \\
    Yes


Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54"; s/<<EOT/<<EOT/e; print;
Just another Perl Hacker
EOT


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

Date: Sat, 20 Sep 2003 01:31:16 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: return() inside eval
Message-Id: <3F6BADDE.6000902@rochester.rr.com>

A.J. wrote:

> This works as needed:
> 
> #!/usr/local/bin/perl
> use strict;
> use Exception::Class( 'Exception' );
> 
> sub test() {
>   eval {
>     return( param1 => 'first',
>             param2 => 'second' );
>   };
>   #print "here\n";
> }
> 
> my %ret = &test();
> print "param1:".$ret{param1}."\n";
> print "param2:".$ret{param2}."\n";
> 
> 
>>./test.pl
>>
> param1:first
> param2:second
> 
> This doesn't. Why doesn't return work
> properly in this case. Why is the print
> clause executed? perl5.8.0
> #!/usr/local/bin/perl
> use strict;
> use Exception::Class( 'Exception' );
> 
> sub test() {
>   eval {
>     return( param1 => 'first',
>             param2 => 'second' );
>   };
>   print "here\n";
> }
> 
> my %ret = &test();
> print "param1:".$ret{param1}."\n";
> print "param2:".$ret{param2}."\n";
> 
> 
>>./test.pl
>>
> here
> param1:
> param2:

Warnings are your friend.  If you had used them, you would have noticed:

    Odd number of elements in hash assignment at junk367.pl line 13.

which would have tipped you off to your problem.

-- 
Bob Walton



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

Date: Sat, 20 Sep 2003 03:32:32 +0100
From: James Taylor <spam-block-@-SEE-MY-SIG.com>
Subject: Re: simple server
Message-Id: <ant200232d07fNdQ@nospam.demon.co.uk>

Hi Alan,

In article <Pine.LNX.4.53.0309191947200.4262@ppepc56.ph.gla.ac.uk>,
Alan J. Flavell <flavell@ph.gla.ac.uk> wrote:
>
> On Fri, 19 Sep 2003, James Taylor wrote:
> >
> > I'd also like to play with a simple Perl web server so an answer
> > to his question would help me and probably many others too.
> 
> CPAN is always the first port of call for such a requirement,
> rather than usenet, no?

Yes agreed, which is why my answer included various links into
CPAN. This was my way of steering the OP in the right direction
without resorting to the kind of curtness and jaded sarcasm that
has sadly become all too common in this group. (Not pointing
the finger at you, of course). :-)

> > However, someone else may be able to point us
> > directly at a portable HTTP server that supports CGI.
> 
> Supporting CGI - supporting it properly, in accordance with the
> rules of HTTP and of the CGI spec - is not exactly "simple",

Sure, I accept that. On the other hand, by the tone of the
OP's question, it seems likely that even a simple calling
mechanism would suffice for his purposes. I guess we'll
never know unless he comes back with further clarification.

> My gut feeling still says this: Apache is a competent server[*],
> it's available for a wide range of platforms,

But not mine, which is exactly why it might be useful to have an
off the shelf HTTP server written in Perl to play with.

I accept, of course, that Apache (or equivalent) would be
the best choice on a platform for which it was available.

-- 
James Taylor, Cheltenham, Gloucestershire, UK.       PGP key: 3FBE1BF9
To protect against spam, the address in the "From:" header is not valid.
In any case, you should reply to the group so that everyone can benefit.
If you must send me a private email, use james at oakseed demon co uk.



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

Date: Sat, 20 Sep 2003 01:21:17 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: sort  issue
Message-Id: <3F6BAB84.2BF78751@acm.org>

Matija Papec wrote:
> 
> #untested
> my @arr = qw/hdisk1 hdisk10 hdisk11 hdisk2 hdisk3/;
> @arr =
>   map $_->[0],
>   sort {
>     $a->[1] cmp $b->[1] ||
>     $a->[2] <=> $b->[2]
>   }
>   map [ $_, /(\w+)(\d+)/ ], @arr;

Because \w includes \d and + is greedy, the third element will always be
one character.  In other words, /(\w+)(\d+)/ is the same as
/(\w+)(\d)/.  You probably want /(\w+?)(\d+)/ or /(\w*\D)(\d+)/ or
something else instead.


John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 20 Sep 2003 10:37:27 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: wtf is the deal?
Message-Id: <bkg0cl$1h8ad$1@ID-172104.news.uni-berlin.de>


"Tom" <tom@nosleep.net> wrote in message news:3f6b465b@nntp0.pdx.net...
> > Having worked in fields ranging from embedded systems to software QA,
> > I can definitively state that you're wrong.  That is not the 'proper'
> > way to do anything but confuse and irritate your audience.
> >
>
> Well, so far the hundreds and thousands of engineers I communicate with
> communicate the way I described.

Yes, but that has been via email.  There is a big difference in
communication methods between email and Usenet.  I'll let you read all the
various Usenet tutorials to see why.





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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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