simplest of simple web servers

2007-11-06 Thread Willy West
just the simplest webserver one can imagine.

I made a POE web server a long time ago and it was fun.  I've long
since lost that code.

Anyway, I'd like to make a perl webserver as simply as possible so
that I can play with dynamic web pages without configuring apache
everywhere I go..  actually a webserver in a USB key would be fun :)

I figured that I'd come here to see which directions I could go to
start off and where I should avoid going.

  thank you much

-- 
Willy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: simplest of simple web servers

2007-11-06 Thread Willy West
 http://search.cpan.org/

 Cheers!

 --Tom Phoenix
 Stonehenge Perl Training


Well of course!  *laugh*  funny how staring at a book for hours on end
addles the brain.


http://search.cpan.org/~jesse/HTTP-Server-Simple-0.27/lib/HTTP/Server/Simple.pm

seems to have what I want.  it will take time to play with it, but
that's fine.  This will let me learn/improve my CGI programming
without bothering with Apache or what have you until I am ready to/
want to do so.


Hmmm.  It's been a long time since I've posted here.  I really should
try to be more active.


Thank you, each of you who responded.

-- 
Willy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




regex: working with parts of strings several times over..

2005-06-20 Thread Willy West
here is the original:


namewilly

descneeds to take a nap

email[EMAIL PROTECTED]





here is the result that I want:

section
 name
  willy
 /name

 desc
  needs to take a nap
 /desc

 email
 [EMAIL PROTECTED]
 /email
/section






if i have the whole thing in one variable $data, then

$data =~ s/(.+?)(.*?)(.+?)/$1$2\\$1$3/;

might work (untested) for the the name part... but i need to be able
to work with $3 as if it
were $1 later on...  


perhaps i need a way to parse this several times over, but I'm not
sure about the best way.  this kind of data munging is really making
my brain hurt.

a couple of suggestions would make me a happy camper :)




-- 
Willy
http://www.hackswell.com/corenth

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regex: working with parts of strings several times over..

2005-06-20 Thread Willy West
 You want a look-ahead:
 
$data =~ s{
  (.+?)  # , then one or more characters ($1), then 
  (.*?)# zero or more characters ($2)
  (?= .+? )  # look ahead for '...' (but don't actually match it)
}{$1$2/$1}xg;

aah... this is a very useful part of regular expressions that i've
never used nor
understood untill now :)thank you very much for the help in
figuring this out.

i'll go off and play with this right now :)



-- 
Willy
http://www.hackswell.com/corenth

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Counting Multiple lines of data with a unique column of information

2005-03-08 Thread Willy West
forgot to reply to all for the following *laugh*



-- Forwarded message --
From: Willy West [EMAIL PROTECTED]
Date: Tue, 8 Mar 2005 19:20:24 -0500
Subject: Re: Counting Multiple lines of data with a unique column of information
To: Wilson, Josh --- Systems Analyst --- GO [EMAIL PROTECTED]



 The problem is that one shipment might have more than one palette and I
 don't know how to strip multiple lines of data (with a unique shipment
 number) for processing.  I'm using Active Perl 5.8 in a Windows
 environment.

 For Example here are a few lines of dummy data
 (header provided for information only):

 ShipmentNumber  Weight  Date  Time  LocationID

 01000 254 03082005 11:25:21 500
 01000 210 03082005 11:27:36 500
 01401 112 03082005 11:35:21 500
 01401 678 03082005 11:37:36 500
 01002 450 03082005 17:54:00 001
 01785 105 03082005 03:05:67 250

here is one way to do it:

use strict;
use warnings;

my @data =
(
01000 254 03082005 11:25:21 500,
01000 210 03082005 11:27:36 500,
01401 112 03082005 11:35:21 500,
01401 678 03082005 11:37:36 500,
01002 450 03082005 17:54:00 001,
01785 105 03082005 03:05:67 250
);

my $storage;

#replace the for loop with a
# while(FILEHANDLE) to get the results from an open file :)
#you may want to add chomp(); to the mix as
#well.

for (@data){
print one line is $_\n;

/(\d{5})(.*)/; #assumes a 5 digit part #

push (@{$storage-{$1}},$2);

#this last bit puts the data into a hash that
#uses the part numbers as its keys..

}

for (keys(%{$storage})){
print Item $_ has  . @{$storage-{$_}} .   entries\n;
}



and here is the sample data's output::

one line is 01000 254 03082005 11:25:21 500
one line is 01000 210 03082005 11:27:36 500
one line is 01401 112 03082005 11:35:21 500
one line is 01401 678 03082005 11:37:36 500
one line is 01002 450 03082005 17:54:00 001
one line is 01785 105 03082005 03:05:67 250
Item 01000 has 2 entries
Item 01401 has 2 entries
Item 01785 has 1 entries
Item 01002 has 1 entries

--

look up regular expressions with perl and hash references in order
to make these
kinds of tasks easier.

good luck :)

Willy
http://www.hackswell.com/corenth

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Another regular expression matching quandry

2004-12-07 Thread Willy West
On Tue, 07 Dec 2004 11:07:54 -0700, Jeffrey Paul Burger [EMAIL PROTECTED] 
wrote:
 I've read a directory into an array called @file_list and need to remove any
 files that start with period from the list (., .., .DS_Store, etc.).
 This is what I've got so far, but it's only removing .., still leaving .
 and .DS_Store. Does the period need to be escaped somehow? Help!
 
 foreach (@file_list) {
   if ($_ =~ /^.+/ {

replace with  /^\.+/

have to escape the '.'  otherwise that should match ANY string .  '.' referes to
any character (if i recall correctly)  in a regex. actually, i'm surprised that
it didn't remove /all/ files from the list- maybe I'm wrong somewhere here?


 Thanks so much!
 
 Jeffrey Paul Burger

good luck :)


-- 
Willy
http://www.hackswell.com/corenth

My APALOGIES, WORLD!
  49% voted for a 
  Senator, 51% voted
  for the cute monkey
  that does tricks!
  DAMN YOU, MONKEY!
DAMN YOU!
--- from a photo posted to 
http://www.sorryeverybody.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: How to remove new line chars

2004-10-21 Thread Willy West
On Thu, 21 Oct 2004 11:23:59 -0400 (EDT), Steve Bertrand
[EMAIL PROTECTED] wrote:
  I am stucking with my problem of reading xml file ,
   I am trying  to remove the new line chars form xml  file and just
  readout the xml tags.
 
  Please any guys have a look at this one.
  please guide me some good stuff abut regex in perl .

look up chomp()   a non-regex way to take care of pesky \n characters

:)

-- 
Willy
http://www.hackswell.com/corenth

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: emacs and perl

2004-10-14 Thread Willy West
On Wed, 13 Oct 2004 22:24:11 -0500, Jon Mosco [EMAIL PROTECTED] wrote:
 I was wondering if anyone had some advice or pointers
 for perl and emacs.  I want to be able to run my
 programs in a window similar to the way you can
 with 'compile' mode with c.  If anyone has some
 tips or pointers, please let me know.
 
 Jon M.
 
 P.S.  I already know about eshell and the like.

an interesting idea- but there is one minor detail... is it that necessary?
i usually run with two terminals - one for editing and one for typing
'./foo.pl'.  Now, there might be an advantage to what you want- maybe
a GUI like stepping function.  Now /that/ would be neat :)I'd love
to learn how to do that with vi.

on occasion i'd run with the perl debugger to step through the code,
but i can't for the life of me remember how to do that now... anyway,
i like the idea of seeing the script as a whole while testing it.


-- 
Willy
http://www.hackswell.com/corenth

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: counting gaps in sequence data

2004-10-14 Thread Willy West
 PS: is this a common problem/exercise in some class somewhere?  I keep
 seeing requests for help having to do with those exact strings of DNA
 data.  Is there a bunch of people working on DNA projects using Perl
 somewhere?  Or, is this some homework?

bio-informatics is a big area in which Perl is involved...   there's even
a book from O'reilly on the subject...

also, a mailing-list is available...


from http://lists.perl.org/   -

bioperl-announce-l List is for people only interested in announcements
of Bioperl code releases, updates and events.

bioperl-l Unmoderated list for general discussion of bioperl modules,
current  future efforts and related topics.

-

in the latter of the two lists, i counted about 80 messages in the first half
of this month.

hmm... i might join it... :)  might be fun!!

-- 
Willy
http://www.hackswell.com/corenth

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: counting gaps in sequence data

2004-10-14 Thread Willy West
On Thu, 14 Oct 2004 14:47:57 -0500, Errin Larsen [EMAIL PROTECTED] wrote:
 

  bio-informatics is a big area in which Perl is involved...   there's even
  a book from O'reilly on the subject...

 
 If what you say is true, then maybe Mike needs to take his questions
 to those list?  I mean, if the problem he's describing is common and
 the data format he's using is common, I bet it's been solved already.
 
 Hey mike, have you searched on CPAN (search.cpan.org) for this?
 

that might be fine- but his question is fundamentally Perl in nature-
he may use the information for bio-informatics, but he is looking for
an answer regarding effective Perl use when dealing with strings-
that's classic Perl and a classic question for this list :)

i wish i could answer his question right off the bat, but i can't :/   

awell...



-- 
Willy
http://www.hackswell.com/corenth

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response