From lsawyer at gci.com Tue Jan 4 13:55:32 2000 From: lsawyer at gci.com (Leif Sawyer) Date: Wed Aug 4 23:56:44 2004 Subject: FW: findhost.pl Message-ID: I figured that I'd been yelling and screaming enough, so I decided to give back to the community. Enclosed please find my latest perl hack. Yeah, it's ugly, but it works wonders. If you're a system administrator that uses DHCP for your LAN, you'll appreciate this script. It will allow you to search the active (and archived) dhcp logs for assignment information via a CGI application. It will "pretty-print" the output based on the type of dhcp action that took place -- however it currently ignores the DHCPDISCOVER message, because it's not relevant to what we're trying to provide. It currently handles gzip'd archive files -- you may have to edit the source to fix the logfile locations, since currently they're hardcoded for my server. Feel free to make bugfixes or add options. I'd appreciate being mailed any changes you make, just so I can keep a central copy. I'll be creating a real project for this on FreshMeat RealSoonNow. The source is hereby GPL'd Leif -------------- next part -------------- A non-text attachment was scrubbed... Name: findhost.pl Type: application/octet-stream Size: 8269 bytes Desc: not available Url : http://mail.pm.org/archives/anchorage-pm/attachments/20000104/b0518916/findhost.obj From kevinc at gci.net Wed Jan 12 16:56:14 2000 From: kevinc at gci.net (K Creason) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port Message-ID: <002101bf5d50$3a856210$4f00030a@k2> I've got a situation where I can use Perl, but not sure where to start. Because of crank calls to Emergency, we want to log PBX activity. I've got a unix machine nearby... heh heh. So I thinks, what better way to capture and parse the data from it's gobblety gook than to use Perl? Two big problems: 1. It's got to run all the time, even when no-one is logged in 2. How do you get info off the hardware in Perl? The actual OS is HPUX, not linux. :( ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From kevinc at gci.net Wed Jan 12 16:58:36 2000 From: kevinc at gci.net (Kevin Creason) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port Message-ID: <200001122254.RAA13815@happyfunball.pm.org> I've got a situation where I can use Perl, but not sure where to start. Because of crank calls to Emergency, we want to log PBX activity. I've got a unix machine nearby... heh heh. So I thinks, what better way to capture and parse the data from it's gobblety gook than to use Perl? Two big problems: 1. It's got to run all the time, even when no-one is logged in 2. How do you get info off the hardware in Perl? The actual OS is HPUX, not linux. :( AND that's another issue: how do you configure the port to be the right config? (1200/7/E/1) I'm not sure how to do that under linux, either. ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Wed Jan 12 17:12:56 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port In-Reply-To: <002101bf5d50$3a856210$4f00030a@k2> Message-ID: On Wed, 12 Jan 2000, K Creason wrote: > I've got a situation where I can use Perl, but not sure where to start. > > Because of crank calls to Emergency, we want to log PBX activity. I've got > a unix machine nearby... heh heh. So I thinks, what better way to capture > and parse the data from it's gobblety gook than to use Perl? > > Two big problems: > 1. It's got to run all the time, even when no-one is logged in > 2. How do you get info off the hardware in Perl? > > The actual OS is HPUX, not linux. :( What kind of PBX are you using? Most of the have data ports (or slots for such expansion), do you have access to one? You might be able siphon off the data over a serial link or what have you. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From kevinc at gci.net Wed Jan 12 17:20:58 2000 From: kevinc at gci.net (K Creason) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port References: Message-ID: <002d01bf5d53$af9cc9a0$4f00030a@k2> Yes, exactly: we have the serial port added to the PBX, and I'm trying to ascertain where to plug it in! :) I don't want a messy/dusty dot matrix printer sitting in there, besides which, the output is not more readable than French for me. I can count through the data and find what I need..... The PBX port is 1200 bd, 7 data, Even, 1 stop. ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Wed Jan 12 17:38:29 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port In-Reply-To: <002d01bf5d53$af9cc9a0$4f00030a@k2> Message-ID: On Wed, 12 Jan 2000, K Creason wrote: > Yes, exactly: we have the serial port added to the PBX, and I'm trying to > ascertain where to plug it in! :) I don't want a messy/dusty dot matrix > printer sitting in there, besides which, the output is not more readable > than French for me. I can count through the data and find what I need..... > > The PBX port is 1200 bd, 7 data, Even, 1 stop. What are the specs on the port: does it support data streaming over a kermit session or something? --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From kevinc at gci.net Wed Jan 12 17:44:25 2000 From: kevinc at gci.net (K Creason) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port References: Message-ID: <004301bf5d56$f57995e0$4f00030a@k2> I don't know. :( How would I test it? ----- Original Message ----- From: To: K Creason Cc: ; Sent: Wednesday, January 12, 2000 2:38 PM Subject: Re: Working off serial port > On Wed, 12 Jan 2000, K Creason wrote: > > > Yes, exactly: we have the serial port added to the PBX, and I'm trying to > > ascertain where to plug it in! :) I don't want a messy/dusty dot matrix > > printer sitting in there, besides which, the output is not more readable > > than French for me. I can count through the data and find what I need..... > > > > The PBX port is 1200 bd, 7 data, Even, 1 stop. > > What are the specs on the port: does it support data streaming over a kermit > session or something? > > --Arthur Corliss > Perl Monger/Alaska Perl Mongers > http://www.alaskapm.org/ > ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From michael at shoebox.net Wed Jan 12 17:52:15 2000 From: michael at shoebox.net (Michael Fowler) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port In-Reply-To: <200001122254.RAA13815@happyfunball.pm.org>; from kevinc@gci.net on Wed, Jan 12, 2000 at 01:58:36PM -0900 References: <200001122254.RAA13815@happyfunball.pm.org> Message-ID: <20000112145215.U301@shoebox.net> On Wed, Jan 12, 2000 at 01:58:36PM -0900, Kevin Creason wrote: > Because of crank calls to Emergency, we want to log PBX activity. I've got > a unix machine nearby... heh heh. So I thinks, what better way to capture > and parse the data from it's gobblety gook than to use Perl? This may not be as well-suited to Perl as you would initially think. The gobblety-gook, I assume, is a stream of bits, and while Perl can handle streams of bits (with pack and unpack), it can get a little awkward. You may want to consider C or C++. Considering the fact that you're dealing with a serial device (which will probably involve ioctl() invocations), Perl may be even less well-suited. While Perl does have ioctl(), many ioctl() calls involve C data structures, which can be a little messy to deal with. > Two big problems: > 1. It's got to run all the time, even when no-one is logged in Easy enough, just have it fork itself then have the parent exit. There is a set procedure for this, involving a pair of forks and a setsid() call to truly daemonize, but this should be sufficient to allow it to run indefinately. > 2. How do you get info off the hardware in Perl? Usually the same way you'd do it in C. Opening the serial device (/dev/ttyS[0-1] on Linux, I don't know about HP-UX. Perl also has ioctl(). If worst comes to worst, you can write a module for Perl in C. > The actual OS is HPUX, not linux. :( > > AND that's another issue: how do you configure the port to be the right > config? (1200/7/E/1) I'm not sure how to do that under linux, either. In Linux, setserial is used for this I believe. I have no idea how to do it with HP-UX, possibly through ioctl()'s. A good way of figuring it out is to find a program that talks to a modem (such as minicom), and looking at the source. Michael -- There isn't a mome rath alive that can outgrabe me. -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From kevinc at gci.net Wed Jan 12 22:05:47 2000 From: kevinc at gci.net (Kevin Creason) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port Message-ID: <003501bf5d7b$7c1b7cc0$0b00030a@kevinj.creasonfam.net> Hmmm. So a simple script of any sort (sh, et al) won't cut this mustard? What a drag. I don't know enough C to drown in. :) I'll have to get some more statistics on the PBX card. They did tell me that it will store up to 1,000 entries if nothing is connected. Hmmm. So the streaming may not be a problem. I'll have to check and see if the buffer drops the oldest data. If that happens, then a Perl script could retreive the data, parse it, add it to a flatfile..... Is that feasible-- if it doesn't have to be streaming/ forked? Of course there is that ioctl() messiness you mentioned. Know any good CPAN modules that I could look at for direction? Or for that matter, I could spawn something else to log the data to a file. Don't have a clue how to do that just yet, but I'm workin' on stormin' up a brain. gimme me some time.... or better yet- some better ideas. ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Jan 13 12:21:15 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:44 2004 Subject: Working off serial port In-Reply-To: <003501bf5d7b$7c1b7cc0$0b00030a@kevinj.creasonfam.net> Message-ID: On Wed, 12 Jan 2000, Kevin Creason wrote: > Hmmm. > So a simple script of any sort (sh, et al) won't cut this mustard? Don't give up hope, yet. Michael's assuming that the serial interface is nothing more than that. From personal experience, some of those PBXs do have support for psuedo terminal sessions, so you may be able to set up a standard terminal link and let the OS handle the actual line control. Just check out the documentation on the PBX, first. . . > What a drag. I don't know enough C to drown in. :) > > I'll have to get some more statistics on the PBX card. They did tell me that > it will store up to 1,000 entries if nothing is connected. Hmmm. So the > streaming may not be a problem. I'll have to check and see if the buffer > drops the oldest data. If that happens, then a Perl script could retreive > the data, parse it, add it to a flatfile..... Is that feasible-- if it > doesn't have to be streaming/ forked? Sounds like it is dropping the oldest data. Appending it to a log maintianed on the Unix box is your best bet, then. > Of course there is that ioctl() messiness you mentioned. Know any good CPAN > modules that I could look at for direction? Or for that matter, I could > spawn something else to log the data to a file. Don't have a clue how to do > that just yet, but I'm workin' on stormin' up a brain. gimme me some > time.... or better yet- some better ideas. Before you lose too much hair, try my previous suggestion: either hook up a dumb terminal to the port, or set up a null modem serial cable to the unix box, and try to access the port with term software. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Sat Jan 15 05:02:17 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:44 2004 Subject: Site Calendar Message-ID: Greetings: For those of you with projects listed on the AKPM site, and those considering it, I wanted to let you know that our News and Event calendars are available to use for announcing project releases and notes. If you'd like a user account that would allow you post your announcements on the calendar (Perl only, of course), let us know. And, as always, alaskpm.org addresses (either forwarded to current accounts, or as separate e-mail boxes) are available as well. With the attention we're getting from some of the search engines, it might not be a bad way to help get the word out, especially in conjuction with other sites, like Freshmeat.net. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Sat Jan 15 05:11:24 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:44 2004 Subject: From the Who Really Gives A . . . Dept. Message-ID: Greetings: Well, I just beat the 13 month mark, from initial development to stable release, but it's finally here. I just released Curses::Widgets v1.0. For those of you who still do console interface programming, the Curses::Widgets package gives you higher level access to common screen widgets, such as: List box Button bars Text Fields Calendars Message Dialogs Input Dialogs and a few other specialised functions. As always, I'm very interested in feedback on its utility, as well as any platform issues that you may run into. . . You can find its current home page at http://www.odinicfoundation.org/arthur/computing/scripts/curses_widgets/ . :-) --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From KJC Tue Jan 18 17:43:04 2000 From: KJC (KJC) Date: Wed Aug 4 23:56:44 2004 Subject: logging from a serial port Message-ID: <200001182338.SAA24642@happyfunball.pm.org> I first posed this question to the Anchorage Perl group list. This is a recap for them, since I've cross posted this to the AkLUG for more people to give me insight: I've got a PBX that sends calling info out via a serial port. It waits until a call is finished and the 'spurts' info all jumbled together in the following format: 0!KA0101280018284 01181259090118125912 000010010844 0000 0 where the first block of characters is mostly throw away--except the last four digits are the 'calling from' extension. The next block is begin and end time in this format mo.day.beg-hour.beg-min.beg-sec.end-mo.end-day..... And the third block is trunk route data and ends with the actual number dialed being the last whatever digits (844 in this instance). This is the dilemma: I want to hook this serial line up to a unix serial port, capture it, and parse it out. In the end I want to be able to hit a web page running on the box and view it. All the point after the 'capture' I think I can handle. How do I capture it to the point where I can start parsing it via Perl? Could it go straight to a file, and let my script retreive the data and empty the file? Help, I'm just a naive guy who loves to do things in unix. I may have the luxury of doing this in a low power Linux box; or I may use HP-UX; naturally I'd prefer the former even if it is a small lightbulb in comparison. ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Mon Jan 24 16:37:59 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:45 2004 Subject: Manning Book for Beginner Programmers (fwd) Message-ID: Greetings: Anyone have any answers to Helen's questions? She's looking for schools with Perl courses. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ---------- Forwarded message ---------- Date: Mon, 24 Jan 2000 17:13:24 -0500 From: Helen Trimes To: pmaf Subject: Manning Book for Beginner Programmers Hello, I hope you might be willing to share some of your expertise about Perl in your community. Our recently released book "Elements of Programming with Perl" was written to be a useful resource to those interested in learning how to program using Perl as a first language. We have received lots of feedback indicating that it would be an ideal text for college instructors of introductory Perl courses. It has, in fact, already been adopted by several U.S. schools. In her December '99 book review at perlmonth.com, Rachel Rawlings called it, "the well-written equivalent of a first-year computer science text with all concepts and examples explained in Perl." Tom Christiansen has indicated to us he plans to give the book "5 Camels" and should be posting a review shortly. I am hoping that you have some knowledge of Perl instruction and may know which colleges offer Perl programming courses in your area. You may even know Perl instructors within your Perl Mongers group membership. I would appreciate any information you can pass along to me, such as which schools to contact and, if possible, instructors' names, addresses and phone or email. I am planning to communicate with these individuals either by mail or email. Manning is a small publisher and we try to present our books only to those who would really benefit from them. In appreciation of your valuable information, we will send you one complementary copy of a current or upcoming Manning book for review and raffle at an upcoming Perl Mongers group meeting. You can select it from www.manning.com. Please make sure to include your current address. I hope to hear from you soon and thanks for your help. Regards, Helen Trimes Manning Publications Co. ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Jan 27 12:01:45 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:45 2004 Subject: Data Validation Message-ID: Greetings: I was recently talking to some people off list about using regexes for data validation. I thought this was a good topic for the list, too, though, so I'm asking for your thoughts: what are your favourite regexes to use for common data types? Here's a few that I use often: e-mail: /^[\w\.]+\@[\w\.-]+\.\w{2,3}$/ telephone: /^(\(?\d{3}\)?[\s-]?)?\d{3}[-\s]?\d{4}$/ zip code: /^\d{5}(-\d{4})?/ Anyone have any other nifty ones to share? --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Thu Jan 27 16:05:23 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:45 2004 Subject: Data Validation In-Reply-To: ; from corliss@alaskapm.org on Thu, Jan 27, 2000 at 09:01:45AM -0900 References: Message-ID: <20000127130523.A7507@shoebox.net> On Thu, Jan 27, 2000 at 09:01:45AM -0900, corliss@alaskapm.org wrote: > Greetings: > > I was recently talking to some people off list about using regexes for data > validation. I thought this was a good topic for the list, too, though, so I'm > asking for your thoughts: what are your favourite regexes to use for common > data types? > > Here's a few that I use often: > > e-mail: /^[\w\.]+\@[\w\.-]+\.\w{2,3}$/ > telephone: /^(\(?\d{3}\)?[\s-]?)?\d{3}[-\s]?\d{4}$/ > zip code: /^\d{5}(-\d{4})?/ > > Anyone have any other nifty ones to share? Regexen to get the unquoted part out of a quoted string. Backwacking the quote character, and backwacking the backwack are dealt with: single-quoted string: '((?:\\\\|\\'|[^\\']+)*)' double-quoted string: "((?:\\\\|\\"|[^\\"]+)*)" It'd be nice if I could combine them, using \1, but as far as I can tell, \1 can't be used in a character class, and that negated character class is a must. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Jan 27 16:29:50 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:45 2004 Subject: Data Validation In-Reply-To: <20000127130523.A7507@shoebox.net> Message-ID: On Thu, 27 Jan 2000, Michael Fowler wrote: > Regexen to get the unquoted part out of a quoted string. Backwacking the > quote character, and backwacking the backwack are dealt with: > > single-quoted string: '((?:\\\\|\\'|[^\\']+)*)' > double-quoted string: "((?:\\\\|\\"|[^\\"]+)*)" > > It'd be nice if I could combine them, using \1, but as far as I > can tell, \1 can't be used in a character class, and that negated character > class is a must. :-) That's a good one. I could see some good uses for that one. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list