From rox at tara-lu.com Thu Apr 1 13:57:39 1999 From: rox at tara-lu.com (Rox Reid-Bennett) Date: Wed Aug 4 23:56:53 2004 Subject: NT vs Unix perl nits Message-ID: <3703CFB3.D4B71D05@tara-lu.com> I'm relatively new to perl on NT, so.... Has anybody else run perl on an NT box and run up against "stat" not working? Jim was attempting to figure out the count of subdirs using stat. Works fine on a Unix box, returns "1" in all cases on the NT box. (using the value from nlink) Rox -- Roxanne Reid-Bennett rox@tara-lu.com President, Tara-Lu Corporation http://www.tara-lu.com/ From corliss at sinbad.net Thu Apr 1 15:16:33 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: NT vs Unix perl nits In-Reply-To: <3703CFB3.D4B71D05@tara-lu.com> Message-ID: On Thu, 1 Apr 1999, Rox Reid-Bennett wrote: > I'm relatively new to perl on NT, so.... > > Has anybody else run perl on an NT box and run up against "stat" not > working? ;-) I avoid NT at all costs, so can't help much. > Jim was attempting to figure out the count of subdirs using stat. Works > fine on a Unix box, returns "1" in all cases on the NT box. (using the > value from nlink) What filesystem is he trying it on? NTFS is somewhat limited in its posix compliance (or is it the OS'es fault ;-). While NTFS knows what links are, Windows apps wouldn't know what to do with it when they saw it. . . --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto From rox at tara-lu.com Thu Apr 1 15:35:55 1999 From: rox at tara-lu.com (Roxanne Reid-Bennett) Date: Wed Aug 4 23:56:53 2004 Subject: NT vs Unix perl nits References: Message-ID: <3703E6BB.B3CA7FB8@tara-lu.com> Arthur Corliss wrote: [...] > What filesystem is he trying it on? NTFS is somewhat limited in its posix > compliance (or is it the OS'es fault ;-). While NTFS knows what links are, > Windows apps wouldn't know what to do with it when they saw it. . . I'd thought about the limitations on the file system. The dir we were looking at is on a NTFS drive, so yeah it would be an issue for at least some of the "stat" data (for example, I would guess inode to be totally unsuppliable). However, nlinks identifies hard links within the dir. It seems to me that the concept of soft links is at best mirrored by "shortcut" under NT. Given that level of definition, couldn't the NT version of perl's stat give the equivalent information for nlink? Consider this a general grumble... We've already worked around the problem. I just wanted some input from others who have used it more or give a heads up for those who might be pushed into using NT and perl together. Rox -- Roxanne Reid-Bennett rox@tara-lu.com President, Tara-Lu Corporation http://www.tara-lu.com/ From rox at tara-lu.com Thu Apr 1 16:27:36 1999 From: rox at tara-lu.com (Roxanne Reid-Bennett) Date: Wed Aug 4 23:56:53 2004 Subject: NT vs Unix perl nits References: Message-ID: <3703F2D8.41E74F7D@tara-lu.com> Arthur Corliss wrote: >[...] > Does it? I had thought that nlinks was the number of hard links to that > particular file, not existing hard links within the directory. I didn't even start this path, Jim found an example of how to traverse directories in the O'Reilly Perl book (v4). Playing with stat, nlink gives back exactly how many directory entries are in the DIR (including "." and "..") every time. So... given no other more illuminating documentation on "stat" > As for soft > links, I believe that NTFS supports those as well, but not via the normal > Explorer interface. Shortcuts are just cheap shell tricks, if you ask me. > Just a file with an address that the Explorer shell interprets. Frankly I haven't played around with file systms under Unix or NT, so which does what is... outside my knowledge base. >[...] > I'm definitely interested in hearing more on this. Out of curiosity, are you > just looking for a faster method for gathering those statistics than using > readdir and -d? Jim was using it as a shortcut to finding out whether a subtraversal was even necessary (e.g. recursively processing dirs). He had to open the dir later for processing the contents, so he moved the recursion to there if the file was a -d type. He was also suitably impressed with the ease with which perl dealt with the string substitutions he was having to make. Example outputs of "stat" looking at the same file Unix: dev: 2081 inode: 802817 mode: 16877 nlink: 10 uid:501 mtime: 501 ctime: 0 blksize: 1024 blocks:923005473 NT: dev: 7 inode: 0 mode: 16895 nlink: 1 uid:0 mtime: 0 ctime: 7 blksize: 0 blocks:923005504 Rox -- Roxanne Reid-Bennett rox@tara-lu.com President, Tara-Lu Corporation http://www.tara-lu.com/ From corliss at sinbad.net Thu Apr 1 16:42:47 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: NT vs Unix perl nits In-Reply-To: <3703F2D8.41E74F7D@tara-lu.com> Message-ID: On Thu, 1 Apr 1999, Roxanne Reid-Bennett wrote: > I didn't even start this path, Jim found an example of how > to traverse directories in the O'Reilly Perl book (v4). Playing with > stat, nlink gives back exactly how many directory entries are in the DIR > (including "." and "..") every time. So... given no other more > illuminating documentation on "stat" Well, if we find out one way or the other, I want to know. :-) Good info. > Frankly I haven't played around with file systms under Unix or NT, so > which does what is... outside my knowledge base. Shortcuts are just simple files. ASCII under the original Win95, but binary under NT (they store more than the path, but also the host name of the creating computer). > Jim was using it as a shortcut to finding out whether a subtraversal was > even necessary (e.g. recursively processing dirs). He had to open the > dir later for processing the contents, so he moved the recursion to > there if the file was a -d type. > > He was also suitably impressed with the ease with which perl dealt with > the string substitutions he was having to make. > > Example outputs of "stat" looking at the same file > > Unix: > dev: 2081 inode: 802817 mode: 16877 nlink: 10 uid:501 mtime: 501 > ctime: 0 blksize: 1024 blocks:923005473 > NT: > dev: 7 inode: 0 mode: 16895 nlink: 1 uid:0 mtime: 0 > ctime: 7 blksize: 0 blocks:923005504 Hmm, looks like Jim's right on the nlinks, then, the man page only states hard links, and isn't the max on that 4? --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto From corliss at sinbad.net Fri Apr 2 02:21:35 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: Perl Monger Hats? Message-ID: <37047E0F.DF77BC0F@sinbad.net> Hey: Fred just passed me some info on some Perl Monger hats that brian d foy has ordered. The cost will be $15/hat, unless we can get ten or more, then it drops down to $10/hat. Anyone interested? His initial shipment is going fast. . . --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto From kevinc at gci.net Fri Apr 2 17:07:37 1999 From: kevinc at gci.net (Kevin Creason) Date: Wed Aug 4 23:56:53 2004 Subject: Piping a Javascript prompt to a scalar Message-ID: <002f01be7d5d$9a5a6b00$0b00a8c0@kevinj.creasonfam.net> I'm trying to pipe a javascript prompt into a scalar. It goes like this: the cgi prints the normal content-type yada yada yada and then : print " "; Which bring up a window before anything requesting input before a HTML document would proceed. How do I capture this into a scalar? Is there are better way to get a username before a CGi proceeds? I tried $scalar=(print all that stuff); and $scalar=; and $scalar=$ARGV[0]; Any 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 fred at alaska.net Fri Apr 2 17:34:30 1999 From: fred at alaska.net (Fred Steinberg) Date: Wed Aug 4 23:56:53 2004 Subject: Piping a Javascript prompt to a scalar In-Reply-To: <002f01be7d5d$9a5a6b00$0b00a8c0@kevinj.creasonfam.net> References: <002f01be7d5d$9a5a6b00$0b00a8c0@kevinj.creasonfam.net> Message-ID: <14085.21510.446920.354142@hamish.gridpoint.com> >>>>> "Kevin" == Kevin Creason writes: Kevin> I'm trying to pipe a javascript prompt into a scalar. ... Kevin> I tried $scalar=(print all that stuff); and $scalar=; and Kevin> $scalar=$ARGV[0]; It doesn't work that way a'tall; by the time the Javascript is executing (in the browser), your perl script (running on the server) has exited. Kevin> Is there are better way to get a username before a CGI proceeds? You might want to look into using server authentication; the user must identify themselves before your CGI is ever run. Then, in your script, you can simply do: $username = $ENV{REMOTE_USER}; This is a useful link about Web-based login: http://www.webthing.com/tutorials/login.html (not really anything to do with Perl, mind you.) =============================================================== 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 sinbad.net Fri Apr 2 17:44:38 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: Piping a Javascript prompt to a scalar References: <002f01be7d5d$9a5a6b00$0b00a8c0@kevinj.creasonfam.net> <14085.21510.446920.354142@hamish.gridpoint.com> Message-ID: <37055666.4DB695FA@sinbad.net> Fred Steinberg wrote: > > > It doesn't work that way a'tall; by the time the Javascript is executing > (in the browser), your perl script (running on the server) has exited. I replied to this, too, but ironically only sent it to Kevin, not the list. However, I had wondered something, not knowing javascript--can you have the javascript perform a http POST? If so, then a simple multi-form cgi would do the trick. --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto =============================================================== 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 fgd at alaska.net Sun Apr 4 22:07:44 1999 From: fgd at alaska.net (Fielder George Dowding) Date: Wed Aug 4 23:56:53 2004 Subject: Wow! First Real Working Perl Script! Message-ID: <37082900.B9AC8169@alaska.net> Greetings Fellow Anchorage Perl Mongers! I can officially say that since I just mongered my first perl script. I have been updating a web site on a monthly basis by hand. It involved a masthead image (gif) plus a variable number of page images (also gif). To say the least the work was tedious and fraught with errors. It was especially difficult to increase the number of pages from one month to the next. This thing I cobbled together today (after my post Easter Dinner nap) in about four hours has really delighted me. It was scary how fast it created the html files. Now I have more questions on how to do other things like automatically put the date time group where I want it. Cheerio for now! -- Fielder George Dowding dba Iceworm Enterprises fgd@alaska.net iceworm@customcpu.com 909 Chugach Way Lot 35, Anchorage, Alaska, US 99503-5667 =============================================================== 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 sinbad.net Mon Apr 5 02:34:22 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: Wow! First Real Working Perl Script! In-Reply-To: <37082900.B9AC8169@alaska.net> Message-ID: On Sun, 4 Apr 1999, Fielder George Dowding wrote: > Greetings Fellow Anchorage Perl Mongers! :-) Same to you! > I can officially say that since I just mongered my first perl script. I > have been updating a web site on a monthly basis by hand. It involved a > masthead image (gif) plus a variable number of page images (also gif). > To say the least the work was tedious and fraught with errors. It was > especially difficult to increase the number of pages from one month to > the next. > > This thing I cobbled together today (after my post Easter Dinner nap) in > about four hours has really delighted me. It was scary how fast it > created the html files. > > Now I have more questions on how to do other things like automatically > put the date time group where I want it. > > Cheerio for now! We'll be looking foward to any questions you have, and amazed at how easy such tasks are. :-) Share the knowledge, of course, if you've found a way to make site maintenance easier through Perl! BTW, on the date/time group thing, if your pre-processing output, you could do a simple regex search and replace on a custom date tag in the text, something like: $dt_group = scalar localtime(); $text =~ s//$dt_group/g; or what have you. . . --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto =============================================================== 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 sinbad.net Wed Apr 7 10:11:19 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: Last chance for Hats. . . Message-ID: All right, everyone, last call for hats. I need to get a check down to brian ASAP to grab what he has left. So far, I've only had one person interested. Any others? Also, how about an in-person meeting for the group on 17th? Any takers? Tell me now, so I can make arrangements for a place. . . :-) --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto =============================================================== 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 Fri Apr 23 22:36:18 1999 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:53 2004 Subject: The Perl Journal, issue 13 Message-ID: <19990423193617.C6184@pobox.alaska.net> Local Perl Mongers, I just got my issue of The Perl Journal today. I thought I'd share what interesting tidbits I've gleaned in the half hour or so of reading, seeing as noone else seems to be sharing anything. I'm not sure how many of you out there have subscriptions, but if you don't and enjoy Perl, I would suggest getting one (www.tpj.com). I saw a blurb about VelociGen 1.1 inside the front cover. It looks like mod_perl with Tcl and XML support (I'm not much into XML, so I'm not sure exactly what there is to support). It might be worth looking into. This Perl Mongers list is listed in the News section, yay! ddd (the data display debugger) now has Perl support. Net::Whois 0.23 has been released. Hopefully its better than the last time I tried using it.. I ended up rolling my own. The CPAN scripts archive is now up and running (www.per.com/CPAN/scripts/index.html). It's about time. You'll need a PAUSE account to upload scripts, information for which can be found at www.perl.com/CPAN/modules/04pause.html. TPJ Perl Oneliner #29 may prove insanely useful: sub is_balanced { my $it = $_[0]; $it =~ tr/()[]{}//cd; while ($it =~ /\(\)|\[\]|\{\}//g) { 1 } return !length($it); } This subroutine returns true if all of the parens, brackets, and braces in the string are balanced. Another useful TPJ Perl Oneliner (#32): ($definition) = <<'FINIS') =~ s/^\s+//gm; The five varieties of camelids are the familiar camel, his friends the llama and the alpaca, and the rather less well-known guanaco and vicuna. FINIS this allows you to indent a here-doc without printing the indentation. One caveat, however: you can't use it in conjunction with a subroutine (e.g. die <<'End_of_Death' =~ s/^\s+//gm; won't work). A useful article on XML is a must-read, now all I have to do is read it.. Ditto for a review of the O'Reilly Perl Resource Kit. I read through an article on Localization. Included was a horror-story of what it's like to localize a program with gettext (a C library for looking up translated versions of a string in a lexicon). I was dutifully horrified. The author then describes his module, Locale::Maketext, which seems utterly logical, and better than gettext, but beyond that I got lost. If you're trying to do localization, and are using Perl, you should look into this module. By far the most interesting article in this issue was a Perl Heresy by Greg Bacon, entitled "Perl Heresies: Building Objects Out of Arrays". In the past I have considered using other data types for objects, but hashes are simply more flexible. However, this was a poorly thought-out assumption. Arrays are faster and use less space, and if done correctly, can provide just as much flexibility. When considering arrays as objects one tends to think of the awkwardness of using unfriendly and faceless numbers for indexing, and one tends to then be put off. However, mixed with constants (perldoc constant), this problem is easily alleviated. Not only that, but using constants and use strict adds extra functionality, such as compile-time errors when a key is misspelled. All in all, it's a very good article. I may even decide to use arrays as objects in my next project... Welp, that's what I got out of it so far. Hopefully you found something interesting as well. Discussion, questions, comments, flames? Respectfully, 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 dpomeroy at greatland.net Wed Apr 28 00:01:29 1999 From: dpomeroy at greatland.net (Dave Pomeroy) Date: Wed Aug 4 23:56:53 2004 Subject: Perl/Tk Message-ID: <99042721052301.00514@server.network-service> I have Perl and Tk installed. When I do a perl -e 'use Tk' it appears to work correctly. However when I try a small program like this I get an error. Can one of you folks tell me if my installation is the problem. Here is the error: "Goto undefined subroutine &main::-1 at /usr/lib/perl5/site_perl/Tk/Widget.pm line 318." #!/usr/bin/perl use Tk; my $mw = MainWindow->new; $mw->title( "Hello World" ); $mw->Button(-text => "Done", -command => sub {exit})->pack; Mainloop; Anyone have any ideas? Thanks for the help. -- Dave Pomeroy =============================================================== 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 Wed Apr 28 23:31:10 1999 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:53 2004 Subject: Perl/Tk In-Reply-To: <99042721052301.00514@server.network-service>; from Dave Pomeroy on Tue, Apr 27, 1999 at 09:01:29PM -0800 References: <99042721052301.00514@server.network-service> Message-ID: <19990428203110.A284@pobox.alaska.net> On Tue, Apr 27, 1999 at 09:01:29PM -0800, Dave Pomeroy wrote: [snip] > #!/usr/bin/perl > use Tk; > my $mw = MainWindow->new; > $mw->title( "Hello World" ); > $mw->Button(-text => "Done", -command => sub {exit})->pack; > Mainloop; It's MainLoop, or better yet, Tk::MainLoop. [snip] Respectfully, 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 corliss at sinbad.net Thu Apr 29 11:07:41 1999 From: corliss at sinbad.net (Arthur Corliss) Date: Wed Aug 4 23:56:53 2004 Subject: The Perl Journal, issue 13 In-Reply-To: <19990423193617.C6184@pobox.alaska.net> Message-ID: On Fri, 23 Apr 1999, Michael Fowler wrote: > Local Perl Mongers, > > I just got my issue of The Perl Journal today. I thought I'd share what > interesting tidbits I've gleaned in the half hour or so of reading, seeing as > noone else seems to be sharing anything. I'm not sure how many of you out > there have subscriptions, but if you don't and enjoy Perl, I would suggest > getting one (www.tpj.com). One of these days I'll actually send in the subscription card, instead of buying it off the shelf at Barnes' every quarter. . . > This Perl Mongers list is listed in the News section, yay! Everybody hear the news that the Perl Institute is being disbanded? Perl.org and CPAN.org will be handed over to the Perl Mongers organisation. > TPJ Perl Oneliner #29 may prove insanely useful: > sub is_balanced { > my $it = $_[0]; > $it =~ tr/()[]{}//cd; > while ($it =~ /\(\)|\[\]|\{\}//g) { 1 } > return !length($it); > } > This subroutine returns true if all of the parens, brackets, and braces in > the string are balanced. > > Another useful TPJ Perl Oneliner (#32): > ($definition) = <<'FINIS') =~ s/^\s+//gm; > The five varieties of camelids are the familiar > camel, his friends the llama and the alpaca, and > the rather less well-known guanaco and vicuna. > FINIS > this allows you to indent a here-doc without printing the indentation. One > caveat, however: you can't use it in conjunction with a subroutine (e.g. die > <<'End_of_Death' =~ s/^\s+//gm; won't work). Some of these can be found in the Perl Cookbook as well. Speaking of one-liners, though, anyone interested in rolling up a CGI-based one-liner database? I think that would be a cool thing to put on alaskapm.org. And on that topic, no, the site is not dead, but awaiting some help from a buddy of mine for layout/colour schemes/graphics, etc. If there's anyone here that wants to participate, drop me a line! And for the rest of you, please send in your ideas on what can make it a valuable and useful resource on-line. :-) Let's get some traffic on this list! --Arthur =============================================================== 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