From tim at consultix-inc.com Wed Feb 2 08:45:48 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: WEB/Oracle Programmer Needed In-Reply-To: <000b01bf6d11$92448960$3db939cc@dopey.asix.com>; from traci.townsend@asix.com on Tue, Feb 01, 2000 at 04:08:01PM -0800 References: <000b01bf6d11$92448960$3db939cc@dopey.asix.com> Message-ID: <20000202064548.A6030@timji.consultix.wa.com> ACP180, Developer/Report Writer, 6 month contract, Redmond, WA Job Description Develop web application to extract information from Oracle database and distribute to intranet users. Work with end users to determine requirements, design and develop the application. Qualifications Perl CGI, HTML, UNIX Oracle required, Access a plus Education BA in Computer Science a plus For contracting, need to be a 1099 telecommuting possible?, no must be at the client site. pay range, depends on the years of experience About ASIX, we are an Information Technology Consulting and software development company located in Bellevue, WA. SIX is a privately held company. Much of ASIX work is based on Object Oriented, multi-tiered environments, where we provide high level analysis and design services. Our clients bring us in to help with full development lifecycles, or parts of the cycle. About ASCEND, it is a comprehensive and highly integrated property assessment and tax administration system which is marketed to county governments. It's technology is distributed client/serve (complied C++ on the client), and we are currently reengineering the applications with web-based development tools. ASCEND is live in 11 counties, which includes 4 states Traci L. Townsend Technical Recruiter ASIX 425-635-0709 ex 164 traci.townsend@asix.com www.asix.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Thu Feb 3 20:51:24 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Tied Hashes: Works with Nested Hashes? Message-ID: <20000203185124.A10850@timji.consultix.wa.com> For the first time, I'm trying to "tie" a non-trivial hash (one with values that are references to other "nested" hashes), and having trouble. With the "dbmopen() or die" and "dbmclose()" calls commented-out, I can load, manipulate, and print-out my hash structure just fine; when I remove the comment symbols, all I seem to be left with in my complex data structure is the keys for the uppermost hash! The *.dir, *.pag files DO get created, and loaded with stuff. I don't see any statement anywhere that you can only tie simple hashes, but now I'm wondering if that's the limitation. What's the scoop? *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | | 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dougb at scalar.org Thu Feb 3 21:30:51 2000 From: dougb at scalar.org (Doug Beaver) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Tied Hashes: Works with Nested Hashes? In-Reply-To: <20000203185124.A10850@timji.consultix.wa.com>; from tim@consultix-inc.com on Thu, Feb 03, 2000 at 06:51:24PM -0800 References: <20000203185124.A10850@timji.consultix.wa.com> Message-ID: <20000203193051.A34702@scalar.org> On Thu, Feb 03, 2000 at 06:51:24PM -0800, Tim Maher/CONSULTIX wrote: > For the first time, I'm trying to "tie" a non-trivial hash (one with > values that are references to other "nested" hashes), and having > trouble. > > With the "dbmopen() or die" and "dbmclose()" calls commented-out, I > can load, manipulate, and print-out my hash structure just fine; when > I remove the comment symbols, all I seem to be left with in my complex > data structure is the keys for the uppermost hash! The *.dir, *.pag > files DO get created, and loaded with stuff. > > I don't see any statement anywhere that you can only tie simple > hashes, but now I'm wondering if that's the limitation. It is a limitation, using the normal tie modules you end up storing the string value of the reference if you try to stick something complex in the hash. Check out MLDBM on CPAN, it uses Data::Dumper (or FreezeThaw or Storable) to pack the data structure appropriately. If you use MLDBM, there's also a gotcha because of limitations with perl's tie mechanism, you have to do this: $ref = $tied_hash{$key}; $ref->{'blah'}->{'blah'} = 'blah'; $tied_hash{$key} = $ref; instead of: $tied_hash{$key}->{'blah'}->{'blah'} = 'blah'; The MLDBM docs cover everything you need though... Also, dbm* were carried over from perl4, you should use tie() so that you can use DB_File. It's btree features allow you to store the keys in sorted order for really fast key access, and you can create your own comparison functions that are used when you sort the keys, so you can create dictionaries that store their keys in a case insensitive way (which can be quite useful). Also, there are no size limits on the values, and the speed stays really fast even with dbs that are over a gig in size. I'm biased though, I really like Berkeley DBs. Good luck with your project... HTH, Doug -- Smithers: I'm afraid we have a bad image, Sir. Market research shows people see you as somewhat of an ogre. Burns: I ought to club them and eat their bones! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andy at n2h2.com Thu Feb 3 21:36:49 2000 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Tied Hashes: Works with Nested Hashes? In-Reply-To: <20000203185124.A10850@timji.consultix.wa.com> Message-ID: On Feb 3, 2000 @ 6:51pm, Tim Maher/CONSULTIX wrote: > For the first time, I'm trying to "tie" a non-trivial hash (one with > values that are references to other "nested" hashes), and having trouble. > > I don't see any statement anywhere that you can only tie simple hashes, > but now I'm wondering if that's the limitation. > > What's the scoop? The referencishness of the values in the top hash is lost when saved to the tied hash (or else what would they refer to?). Serialize the structure with Freeze/Thaw or whatever. Sorry, I don't remember what it is off hand... -- Andrew Sweger | N2H2, Incorporated v=206.336.2947 f=206.336.1541 | 900 Fourth Avenue, Suite 3400 Advanced Technologies | Seattle WA 98164-1059 Development | http://www.n2h2.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Feb 4 08:48:36 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Call for Papers: TPC 4.0 Message-ID: <20000204064836.B12741@timji.consultix.wa.com> SPUGsters, A few months after having our first meeting in 1998, members of our group earned 25% of the available slots for refereed papers at the 2nd Perl Conference, and one of those presenters (Marty Cudmore) won the award for best paper! Last year, Andy Sweger won a prize for his Perl Quiz performance. So we have a reputation to live up to! Please consider sharing your Perl wisdom with the community by proposing a talk for this July's Perl Conference (TPC) - and of course, you'll want to warm up for your talk by first presenting your material at a SPUG meeting! (The March meeting is available; along with April, May, etc. . . . 8-} ) -Tim P.S. 2/18 is the deadline for submissions (see below). ========================================================== | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | | SPUG Founder & Leader Email: spug@halcyon.com | | Seattle Perl Users Group HTTP: www.halcyon.com/spug | ========================================================== ----- Original Message ----- From: Denise Olliffe Sent: Thursday, 3 February 2000 6:55 Subject: Call for Papers for Perl Conference 4.0 > CALL FOR PAPERS for the PERL CONFERENCE 4.0 > > Want to make all those endless nights hacking away at Perl finally pay > off? This is your chance to share those jewels of code with your > peers! > > > Submit your proposal for talks, tutorials and refereed papers for The > Perl Conference 4.0 Part of The O'Reilly Open Source Software > Convention July 17-20, 2000 in Monterey, California > > ******************************************************************** > > Last year's event attracted over 1700 attendees, with an audience > hungry for information and eager to hear about the latest developments > and trends in the Open Source world. > > This time, it could be YOUR chance to enlighten, and maybe even > enrapture, a room full of your peers with your latest innovation or > foray into Perl. But not only that: it's also an excellent opportunity > for you to rub shoulders with the heroes, founders and demi-gods of the > Open Source community - plus have a ton of fun! > > Here are the topics: > > * Perl > * Linux > * Apache > * Python > * Sendmail > * Open Source Business Strategies > * Tcl/Tk > * Other open source technologies > > This year, we are focusing on Open Source technologies enabling secure, > high-volume e-commerce. Technical talks in any of the above tracks that > zoom in on e-commerce will be particularly welcomed! > > All submissions should be directed to: oscon00proposals@oreilly.com > > For detailed information on submitting a proposal, please see: > http://conferences.oreilly.com/oscon2000/call.html > > If you have any questions about submitting a proposal, please contact > Joseph McIntyre at joseph@oreilly.com > > Need some additional time to put together that mind blasting proposal > that is going to knock the socks off your fellow hacker's feet? You > got it! We are extending the original submission deadline to Feb. 18, > 2000. Don't miss it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From torin at daft.com Wed Feb 9 08:04:04 2000 From: torin at daft.com (Darren/Torin/Who Ever...) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: File headers In-Reply-To: "Steve Laybourn"'s message of "Mon, 31 Jan 2000 13:52:07 PST" References: <20000131215207.20590.qmail@hotmail.com> Message-ID: <877lge8smk.fsf@perv.daft.com> Steve Laybourn, in an immanent manifestation of deity, wrote: > I'm wondering if there is a way to be able to open a remote file long >enough to get the first 256 bytes and close the record again. >Example: > If I wanted to scan the first 1024 bytes of > >http://www.arglebargle.com/images/very_big_graphic.jpg > >to make sure it WAS a JPEG file without having to load the entire image, >could it be done? If so, how? open / read don't seem to do it. Yes, you can use the Ranges header in HTTP to request only a certain amount. The http server that you talk to must support HTTP/1.1 and support byte-ranges but most of them do, so that's okay. Note that to comply with HTTP/1.1 BTW, you want to use example.com as an example instead of other hostnames. www.arglebargle.com exists but there is no images directory. :) example.com is specifically reserved for use in examples and will never be allocated to anyone. So, you could do the following: (use !perl -x on this message to run it.) #!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; use Image::Size; my $ua = LWP::UserAgent->new; my $res = $ua->request(GET 'http://www.pm.org/Images/tshirt.jpg', Range => 'bytes=0-1023', Connection => 'Close', ); die "Unable to retrieve image: " . $res->status_line unless $res->is_success; # the third element of imgsize's return is the file type. i.e. JPG print +(imgsize($res->content_ref))[2], "\n"; __END__ -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Harry.Wegley at pss.boeing.com Wed Feb 9 17:39:07 2000 From: Harry.Wegley at pss.boeing.com (Wegley, Harry L) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC Message-ID: Has anyone configured Perl on a Unix box (Solaris in my case) to query a remote Microsoft SQL server using ODBC? If so, what Perl modules did you use? What did you use for the driver and the driver manager? I haven't been able to put all the pieces together for what I thought was a pretty simple problem. Any help would be greatly appreciated. Harry Wegley E-mail: Harry.L.Wegley@Boeing.Com Phone: 206.655.8531 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From rbark at cobaltgroup.com Wed Feb 9 18:08:58 2000 From: rbark at cobaltgroup.com (Ryan Bark) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC In-Reply-To: References: Message-ID: <00020916120100.00779@reganol> Have you looked into FreeTDS? It should work for Sybase and SQL Sever. It's available at http://www.freetds.org Good luck! -Ryan On Wed, 09 Feb 2000, Wegley, Harry L wrote: > Has anyone configured Perl on a Unix box (Solaris in my case) to query > a remote Microsoft SQL server using ODBC? If so, what Perl modules did > you use? What did you use for the driver and the driver manager? I haven't > been able to put all the pieces together for what I thought was a pretty > simple problem. > > Any help would be greatly appreciated. > > Harry Wegley > E-mail: Harry.L.Wegley@Boeing.Com > Phone: 206.655.8531 > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ced at carios2.ca.boeing.com Wed Feb 9 18:21:08 2000 From: ced at carios2.ca.boeing.com (Charles DeRykus) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC Message-ID: <200002100021.QAA08941@carios2.ca.boeing.com> > Has anyone configured Perl on a Unix box (Solaris in my case) to query > a remote Microsoft SQL server using ODBC? If so, what Perl modules did > you use? What did you use for the driver and the driver manager? I haven't > been able to put all the pieces together for what I thought was a pretty > simple problem. I'm also interested but haven't yet tried this item I saw on DejaNews: Please let me everyone know if you get this to work and I'll do the same. Rgds, -- Charles DeRykus (from: http://ftp.digital.com/pub/plan/perl/CPAN/modules/01modules.index.html) How do I access a MS Windows based database from UNIX/Linux using DBI::Proxy? * On the UNIX/Linux machine install DBI and all the modules to support DBD::Proxy. * On the Windows system install DBI, all the modules for DBD::Proxy, and DBD::ODBC. * Define a system DSN (using ODBC connection manager) to the Windows database. * Using the ODBC Test connection, test the ODBC connection. Now, configure the proxy server on the Windows machine. Here is a sample of my test configuration: dbiproxy.conf { 'localport' => 1234, 'pidfile' => 'c:\tmp\dbiproxy.pid', 'logfile' => 1, 'debug' => 1, 'mode' => 'threads', 'timeout' => 60, 'clients' => [ { 'mask' => '^lowery-t$', 'accept' => 1 }, { 'mask' => '^localhost$', 'accept' => 1 }, { 'mask' => '.*', 'accept' => 1 } ] } Start dbiproxy on the Windows machine: c:\dbiproxy --configfile=c:\tmp\proxy.conf On the UNIX/Linux machine do the following: * Modify this script to access the Windows NT machine: use DBI; use Data::Dumper; my $dbh = DBI->connect( 'dbi:Proxy:hostname=YourMSHostName;port=1234;dsn=dbi:ODBC :YourDSN' , 'UserId', 'PassWord', { RaiseError => 1, PrintError => 1 } ) or die $DBI::errs tr; my $sth = $dbh->prepare( 'select * from authors (YourTable)' ); $sth->execute; while( $row = $sth->fetchrow_hashref ) { print Dumper($row); } $sth->finish; $dbh->disconnect; * At the command prompt, execute using perl -w scriptname.pl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From a-seano at microsoft.com Wed Feb 9 18:51:44 2000 From: a-seano at microsoft.com (Sean Owens (Entex)) Date: Wed Aug 4 00:07:08 2004 Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? Message-ID: I'm sure there's a very simple answer, but I'm still a bit new at this perl stuff... I want to sequentially read in all the files in a directory (there aren't _that_ many, but I'm lazy and don't want to create a hash with all the filenames listed), munge them, and save them out (then open the next one... etc.). Can I assign a variable to a filename on a server, or can I open it some other way? In this case my script always runs, and always processes the files every 5-10 mintues Even better, I'd like to have the munging happen only on change, so my script always runs and only processes whenever necessary. Now I'm really out of my depth! To make this even more fun (as you might guess from my email), I'm on a Win32 system. Can anyone point me in the right direction to get me started? thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20000209/64d0a31d/attachment.htm From greg.mushen at gettyimages.com Wed Feb 9 19:41:54 2000 From: greg.mushen at gettyimages.com (Greg Mushen) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC Message-ID: <990EFA5D5CA7D311B44300A0C9D5E149221174@SEAEXCHG02> I did this once and got it working. I had a similar environment to your (Solaris and NT). I had to use a couple different pieces. I'm not sure if this is the best way to do it though. Here's what you'll need on the Microsoft side: 1. PlRPC version version 0.2012 or higher 2. Net-Daemon version 0.27 or higher 3. Bundle-DBI 4. DBD-ODBC version 0.20 or higher There is a utility called dbiproxy that comes with either the DBI bundle or the DBD-ODBC module. This is going to be the key utility in the process. Basically, it sits on the Microsoft box waiting for queries. Configure a dbiproxy configuration file (I've included the one I used) and then start the daemon from the command line (you can also use certain utilities to convert this into an actual service): c:\dbiproxy --configfile= Then on the UNIX side, you'll need the following: 1. PlRPC 2. Net-Daemon 3. DBI On the perl side, you will be able to connect to the database as normal. Be sure to include the DSN, etc. such as: $dbh = DBI->connect("dbi:Proxy:hostname=; port=; dsn=, , ) or die "DBI->errstr\n"; Hope this helps! Here's the configuration file... -Greg Mushen #File: dbiproxy.ini #Author: Greg Mushen (greg.mushen@gettyimages.com) #Date: 9/1/99 #Version: 1.0 # # This is a configuration file for dbiproxy # For more information on this file, consult the Net::Daemon documentation at: # http://theory.uwinnipeg.ca/CPAN/data/Net-Daemon/Net/Daemon.html # # Copy this version out and save as an ini file { ##localport -- Specify the port number you want the service running on here 'localport' => 9999, ##pidfile -- Arbitrary file specifying the process number of the daemon # must specify the full path to the file 'pidfile' => 'c:\tmp\dbiproxy.pid', ##logfile -- This specifies the path to the log file. Setting this value to # 1 will cause logging to go to standard error. 'logfile' => 1, ##debug -- This option turns debugging mode to on (1). Change this value # to zero if you wish to turn debugging off. 'debug' => 1, ##mode -- The daemon can run in three different modes: threads, fork # and single connection mode. I tested in fork, but then decided # to run it in single connection mode(default). This may need # to be changed in the future if we decide to have more than one # concurrent connection to the database. #'mode' => '', ##timeout -- Defines the timeout period for each connection in seconds. 'timeout' => 60, ##clients -- Clients is an array reference with a list of clients. You can # specify patterns of authentication with the mask element. # This mask element is a Perl regular expression with either an # IP address or a client's hostname. You can then specify # whether or not this client is authorized by setting the # "accept" variable to 1 (accept) or 0 (deny). # 'clients' => [ { 'mask' => '.*', 'accept' => 1 } ] # End of client list } #End of configuration -----Original Message----- From: Wegley, Harry L [mailto:Harry.Wegley@pss.boeing.com] Sent: Wednesday, February 09, 2000 3:39 PM To: 'spug-list@pm.org' Cc: 'myself' Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC Has anyone configured Perl on a Unix box (Solaris in my case) to query a remote Microsoft SQL server using ODBC? If so, what Perl modules did you use? What did you use for the driver and the driver manager? I haven't been able to put all the pieces together for what I thought was a pretty simple problem. Any help would be greatly appreciated. Harry Wegley E-mail: Harry.L.Wegley@Boeing.Com Phone: 206.655.8531 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From greg.mushen at gettyimages.com Wed Feb 9 19:49:37 2000 From: greg.mushen at gettyimages.com (Greg Mushen) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? Message-ID: <990EFA5D5CA7D311B44300A0C9D5E149221175@SEAEXCHG02> Hi Sean, To process all the files in a directory, your code should go something like this: # This will open the directory opendir(DIR, "") or die "Can't open dir: $!\n"; # This will go through each file in that directory. while(defined ($file = readdir(DIR))) { open(FILE, "$file"); do whatever else here } If you wanted to add functionality so that it only processes it when it has been changed, you'd have to figure out how you wanted to approach it. You could get really complex or just check the modification time of the file and process it if it is greater than 10 min or so using the -M file test switch. Hope this helps, Greg -----Original Message----- From: Sean Owens (Entex) [mailto:a-seano@microsoft.com] Sent: Wednesday, February 09, 2000 4:52 PM To: SPUG (E-mail) Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? I'm sure there's a very simple answer, but I'm still a bit new at this perl stuff... I want to sequentially read in all the files in a directory (there aren't _that_ many, but I'm lazy and don't want to create a hash with all the filenames listed), munge them, and save them out (then open the next one... etc.). Can I assign a variable to a filename on a server, or can I open it some other way? In this case my script always runs, and always processes the files every 5-10 mintues Even better, I'd like to have the munging happen only on change, so my script always runs and only processes whenever necessary. Now I'm really out of my depth! To make this even more fun (as you might guess from my email), I'm on a Win32 system. Can anyone point me in the right direction to get me started? thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20000209/22deddd2/attachment.htm From ericd at webforia.com Wed Feb 9 21:03:49 2000 From: ericd at webforia.com (ericd@webforia.com) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? Message-ID: There's also a Win32::ChangeNotification module that will let you monitor events relating to files and directory trees. It's available on both CPAN and ActiveState. Eric -----Original Message----- From: Greg Mushen [mailto:greg.mushen@gettyimages.com] Sent: Wednesday, February 09, 2000 5:50 PM To: 'Sean Owens (Entex)'; SPUG (E-mail) Subject: RE: SPUG: Filehandes -- slurping up the files in \folder\*.htm? Hi Sean, To process all the files in a directory, your code should go something like this: # This will open the directory opendir(DIR, "") or die "Can't open dir: $!\n"; # This will go through each file in that directory. while(defined ($file = readdir(DIR))) { open(FILE, "$file"); do whatever else here } If you wanted to add functionality so that it only processes it when it has been changed, you'd have to figure out how you wanted to approach it. You could get really complex or just check the modification time of the file and process it if it is greater than 10 min or so using the -M file test switch. Hope this helps, Greg -----Original Message----- From: Sean Owens (Entex) [mailto:a-seano@microsoft.com] Sent: Wednesday, February 09, 2000 4:52 PM To: SPUG (E-mail) Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? I'm sure there's a very simple answer, but I'm still a bit new at this perl stuff... I want to sequentially read in all the files in a directory (there aren't _that_ many, but I'm lazy and don't want to create a hash with all the filenames listed), munge them, and save them out (then open the next one... etc.). Can I assign a variable to a filename on a server, or can I open it some other way? In this case my script always runs, and always processes the files every 5-10 mintues Even better, I'd like to have the munging happen only on change, so my script always runs and only processes whenever necessary. Now I'm really out of my depth! To make this even more fun (as you might guess from my email), I'm on a Win32 system. Can anyone point me in the right direction to get me started? thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20000209/5ae9bab5/attachment.htm From andy at n2h2.com Thu Feb 10 09:50:33 2000 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC In-Reply-To: Message-ID: What version of MS SQL? I've used DBI and DBD::Sybase to connect to an older version (6.5 I think). MS SQL and Sybase ASE used to be one and the same. It wasn't until around MS SQL 7 that Microsoft started significantly changing the protocol (TDS). Surprise! I don't use MS SQL anymore. I use something much more stable. I didn't have to change any of my code either. On Feb 9, 2000 @ 3:39pm, Wegley, Harry L wrote: > Has anyone configured Perl on a Unix box (Solaris in my case) to query > a remote Microsoft SQL server using ODBC? If so, what Perl modules did > you use? What did you use for the driver and the driver manager? I haven't > been able to put all the pieces together for what I thought was a pretty > simple problem. -- Andrew Sweger | N2H2, Incorporated v=206.336.2947 f=206.336.1541 | 900 Fourth Avenue, Suite 3400 Advanced Technologies | Seattle WA 98164-1059 Development | http://www.n2h2.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dean at ero.com Thu Feb 10 18:49:35 2000 From: dean at ero.com (Dean Hudson) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? In-Reply-To: <990EFA5D5CA7D311B44300A0C9D5E149221175@SEAEXCHG02> Message-ID: On Wed, 9 Feb 2000, Greg Mushen wrote: > # This will open the directory > opendir(DIR, "") or die "Can't open dir: $!\n"; > > # This will go through each file in that directory. > while(defined ($file = readdir(DIR))) { > open(FILE, "$file"); > do whatever else here > } Or if you're feeling slightly more "fast & loose": my $dir = "/your/dir/here"; while ( my $file = <$dir/*> ) { # process file } dean. -- dean hudson, research fellow, esoteric research organization - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From smorton at pobox.com Fri Feb 11 01:14:22 2000 From: smorton at pobox.com (Sanford Morton) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Introduction to Objects Message-ID: <20000211071422.2B9B032585@scribe.pobox.com> I have completed another draft of the Tour of References, Modules and Objects http://www.pobox.com/~cgires/modules/ Comments are always welcome, particularly if you have suggestions for exercises on modules. BTW, Damian Conway's OOPerl book received some spectacular reviews in the last Perl Journal. I think I'll buy it. As I recall there was a lengthy excerpt at http://www.cs.monash.edu.au/~damian/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From stuart_poulin at yahoo.com Fri Feb 11 13:01:49 2000 From: stuart_poulin at yahoo.com (Stuart Poulin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm? Message-ID: <20000211190149.27261.qmail@web110.yahoomail.com> --- Dean Hudson wrote: > On Wed, 9 Feb 2000, Greg Mushen wrote: > > > # This will open the directory > > opendir(DIR, "") or die "Can't open dir: $!\n"; > > > > # This will go through each file in that directory. > > while(defined ($file = readdir(DIR))) { > > open(FILE, "$file"); > > do whatever else here > > } > > Or if you're feeling slightly more "fast & loose": > > my $dir = "/your/dir/here"; > while ( my $file = <$dir/*> ) { > # process file > } > I just wanted to throw a little caution to this. This last example example uses file globbing. Globbing is not built into perl. This on Unix means calling csh, or tcsh depending on how perl is built, and on NT it calls perlglob.exe. These don't always glob the same. And csh shell can throw a error about the file list being too long. Plus, it's actually slower since perl has to call an external program. Readdir is the safest way to go but I often first reach for globbing. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Feb 11 19:19:12 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Top 10 Pre-IPO Perl Jobs? Message-ID: <20000211171912.A8722@timji.consultix.wa.com> Somebody asked me today to name some companies in downtown Seattle that are pre-IPO, and hiring Perl programmers. Apparently, this guy has the idea that by joining such a company pre-IPO, he could leverage his Impatience to rapidly become a gazillionaire and lead a life of greater Laziness and Hubris. Where would he ever get such an idea? 8-} Anyway, the downtown Perl-friendly companies that came to my mind were all post-IPO, so I'll appeal to the wisdom of the SPUGsters . . . What are the best pre-IPO companies hiring Perl programmers in downtown Seattle? How about the best in other regions too, for the benefit of those interested in other locations? *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | | 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Mon Feb 14 14:59:09 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: ASIX, Bothell: Perl/UNIX/DB Job Message-ID: <20000214125909.A25018@timji.consultix.wa.com> ACP187,Application Support Specialist, 6 month contract to hire, Bothell, WA * This is a 6 month to hire position. * core work hours will be from 7 to 5, but are changing to more of a flex time. * 4X10 are a possibility * telecommuting is an option for some of the work * working in a team of 2 to 3 people, there will be an "on call" responsibility, but it's rotated so no one is "on call" continuously. Job description: Support systems are all based on Sun (Unix) servers and are data base applications in Informix, Oracle or Sybase. As the "Application Owner" it is necessary to team with a data base administrator and a Unix system administrator, to maintain operation of the server hardware, the data base operations and the application software. Also work with the development and engineering organizations to keep informed of new features and enhancements that will be implemented into the production environment. Help establish schedules for new releases and upgrades of the software and hardware. Coordinate backups of the systems and disaster recovery plans. These applications are supported 24 x 7. Operations environment will require periods of being "on call". Handle calls from nationwide employees who need assistance with the data or reports on the data stored in the application databases. Qualifications: * Basic Unix background of 3+ years experience. * Experience writing Shell and Perl scripts. * Basic data base familiarity of several years experience, with knowledge of SQL. * Good communications skills and telephone "etiquette". * Ability to plan and schedule for installation of changes to production systems. * Experience as programmer in 4GL's, C/C++ or other high level language. * Experience working in an Operations environment. * Web page development and maintenance. Please email or fax resumes to: Traci.townsend@asix.com ASIX,Inc. 109000 NE 8th Street, Suite 700 Bellevue, WA 98004-4447 Phone 425-635-0709 x164 Fax 425-635-0809 www.asix.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at erwin.org Mon Feb 14 14:25:23 2000 From: ryan at erwin.org (Ryan Erwin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: ESPUG Feb Meeting = OO Perl Message-ID: The ESPUG February Meeting will be Object Oriented Perl On Wednesday, the 23rd of February at 7 pm, Robert Abarbanel will discuss interesting aspects of Object Orient Perl from Damian Conway's book Object Oriented Perl. Topics will include: pseudo-hashes automatic class and method construction lexical protection polymorphism encapsulation and how to get there aspects of persistence For more Information, Please visit the new and improved espug website: -> http://espug.pm.org If you would be interested in speaking on some topic for an upcoming ESPUG meeting, please contact me. Thanks, and hope to see you all next Wednesday Ryan Erwin [ryan@erwin.org] http://ryan.erwin.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Mon Feb 14 23:53:10 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Feb. Meeting: Non-Forking Servers Message-ID: <20000214215310.A27004@timji.consultix.wa.com> FEBRUARY SPUG MEETING * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SPUG, the Seattle Perl Users Group, will meet on February 15th (3rd Tuesday) from 7-9pm, in the 5th floor meeting room of the Union Bank of California Bldg. in downtown Seattle. Phillip Neal (formerly of RealNetworks) will talk about his experiments with "Non-Forking Servers". Attendees should prepare by reading pp. 628-632 of "The Perl Cookbook". Admission is free and open to the general public. Attendees are encouraged to arrive at the building's 5th & Madison door by 6:45pm, to meet their escorts. Parking Parking is available in an underground garage beneath the building, at the price of $4 for the entire period from 4pm - 11pm. Additional parking is available at other ground-level lots and on the street. Pre-Meeting Gathering Place Those arriving early to the downtown area are encouraged to gather at the Rock Bottom brewpub, at 1333 5th Ave., (206) 623-3070, to "prepare for the meeting". Look for other SPUGers at the bar, on your left as you enter. For more information, including driving directions and street addresses, see http://www.halcyon.com/spug/. -Tim P.S. We still don't have a speaker or topic for the March meeting; when this has happened in the past, I've saved the day by opting to do the talk myself at the last minute, but I'll be in Australia for that one, so somebody else had better volunteer! ========================================================== | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | | SPUG Founder & Leader Email: spug@halcyon.com | | Seattle Perl Users Group HTTP: www.halcyon.com/spug | ========================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From phillipneal at hotmail.com Wed Feb 16 14:05:16 2000 From: phillipneal at hotmail.com (Phillip Neal) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Non-forking server stuff Message-ID: <20000216200516.68814.qmail@hotmail.com> Dear Spugsters, If you go to http://philly.tensegrity.net/spug you should find the html and code from the talk. I haven't taken the line numbers off the server.pl code yet. Please try to run the client tomorrow (Thursday 17 Feb. 2000) at high noon (12:00 hours) I will try to monitor the load at that time. Thanks. Phil ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From pdarley at serviceintelligence.com Thu Feb 17 12:05:10 2000 From: pdarley at serviceintelligence.com (Peter Darley) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: CGI::Cookies question Message-ID: <000701bf7971$87c58f40$61ee6fd8@rc-701> Friends, I guess I'll take advantage of this slow period on the list to ask my stupid question. The problem I'm having is that I have a problem with IE accepting my cookies. My code is thus: ---------------------------------------------------------------- use CGI qw/:standard/; use CGI::Cookie; print SetStandardCookies($UserName, $Password); s*b SetStandardCookies { my ($UserName, $Password) = @_; my ($UserNameCookie, $PasswordCookie); $UserNameCookie = new CGI::Cookie(-name => 'UserName', -value => $UserName, -domain => 'cdarley.dyndns.org', -path => '/games/', -expires => "+1h"); $PasswordCookie = new CGI::Cookie(-name => 'Password', -value => $Password, -domain => 'cdarley.dyndns.org', -path => '/games/', -expires => "+1h"); return header(-cookie=>[$UserNameCookie, $PasswordCookie]); }; ---------------------------------------------------------------- It sets the cookie on Netscape, and used to set the cookie on IE browsers when my application was being served from a Win98 machine, but now that I've ported it to Apache mod_perl under Linux, IE doesn't end up with any cookies. Anybody have any experience with this kind of thig, or is there some obvouse error in my code? Thanks for your help! Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From cmeyer at zipcon.net Thu Feb 17 15:54:24 2000 From: cmeyer at zipcon.net (Colin Meyer) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: CGI::Cookies question In-Reply-To: <000701bf7971$87c58f40$61ee6fd8@rc-701>; from Peter Darley on Thu, Feb 17, 2000 at 10:05:10AM -0800 References: <000701bf7971$87c58f40$61ee6fd8@rc-701> Message-ID: <20000217135424.A2366@sim.zipcon.net> At first glance, your code looks fine. One possible gotcha that I've been tricked by happens when the clocks of the two systems (server and client) significantly differ. Your cookie is set to expire in one hour. The cookie's expiration time is not actually communicated as "one hour from now", but rather as a specific time, GMT. That date could be miscalculated at either the client or the server end, causing the cookie to prematurely expire. -C. On Thu, Feb 17, 2000 at 10:05:10AM -0800, Peter Darley wrote: > Friends, > I guess I'll take advantage of this slow period on the list to ask my > stupid question. The problem I'm having is that I have a problem with IE > accepting my cookies. My code is thus: > > ---------------------------------------------------------------- > use CGI qw/:standard/; > use CGI::Cookie; > > print SetStandardCookies($UserName, $Password); > > s*b SetStandardCookies > { > my ($UserName, $Password) = @_; > > my ($UserNameCookie, $PasswordCookie); > > $UserNameCookie = new CGI::Cookie(-name => 'UserName', > -value => $UserName, > -domain => 'cdarley.dyndns.org', > -path => '/games/', > -expires => "+1h"); > > $PasswordCookie = new CGI::Cookie(-name => 'Password', > -value => $Password, > -domain => 'cdarley.dyndns.org', > -path => '/games/', > -expires => "+1h"); > return header(-cookie=>[$UserNameCookie, $PasswordCookie]); > }; > ---------------------------------------------------------------- > > It sets the cookie on Netscape, and used to set the cookie on IE browsers > when my application was being served from a Win98 machine, but now that I've > ported it to Apache mod_perl under Linux, IE doesn't end up with any > cookies. Anybody have any experience with this kind of thig, or is there > some obvouse error in my code? > > Thanks for your help! > > Peter Darley > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From phillipneal at hotmail.com Thu Feb 17 19:01:15 2000 From: phillipneal at hotmail.com (Phillip Neal) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: RE: Non-forking servers. Sorry sorry sorry. Version poison Message-ID: <20000218010115.82756.qmail@hotmail.com> Dear Spugsters, I'm sorry. The experiment at noon today didn't work. It was my fault. My server script version did not match the client script version Passwd authentication scheme. Would you please try it again tomorrow at noon ? Attached is the client.pl script in case you need it. Phil ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: pub.pl Type: application/octet-stream Size: 2391 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20000217/996976fa/pub.obj From tim at consultix-inc.com Thu Feb 17 23:13:43 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? Message-ID: <20000217211343.A9904@timji.consultix.wa.com> SPUG-ticians, The less experienced students in our Perl Programming classes tend to have lots of trouble dealing with my vs. local, and hate nasty surprises like File::Find trashing the $_ that's acting as their loop variable. So I've been trying to come up with a "Cookbook" approach to providing "Scoping Guidance", and would be interested in the comments of you professional Perl programmers out there on what I've come up with so far. Have I left anything important out? Have I made recommendations that you disagree with? There's at least one recommendation here that I've never seen in any Perl documentation; enclosing your main program in {}. This either means I've been amazingly clever in figuring out this useful technique n my own, or else I'm stupid because everybody else achieves the same result in some other way; which is it? 8-} There's also a sample program to drive home some of the points, which must be somewhat cryptic to fit on the same page. TIA, -Tim The Consultix "Perl Scoping Guidelines", v0.8 FOR SMALL OR SIMPLE PROGRAMS Relax and enjoy the freedom of Perl ! FOR ALL NON-TRIVIAL PROGRAMS (including LARGE/COMPLEX ones) * limit scope of variables > use my for user variables, local for pre-defineds ($_, $/, etc.) * pass data to subs via the argument list (i.e., avoid globals) * enclose main program in { } > so my vars won't have file scope, and leak into subs defined below IN LARGE OR COMPLEX PROGRAMS * avoid using $_ ; widespread use creates many problems! * localize temporary changes to built-in vars with new block { local $,=' '; print; } * put "use strict" at top of program, to force use of my() > if you need a global variable, qualify with package name; $count becomes $main::count SPECIAL CASES * $_ automatically localized to { } when provided as default loop or function variable * foreach (LIST) { }, grep { } LIST, map { } LIST, etc. EXAMPLE (somewhat nonsensical, but fits on page with above!) { # these parens confine MAIN variables declared with my() my @names=('Joe', 'Nancy'); local $_='(303) 456-7890'; foreach (@names) { print "$_\n"; } # different, local $_ print "$_\n"; # print the phone number my $result = compute(@names); { $\='\cL'; print $result; } } # end of MAIN sub compute { local $_='Test Data'; # won't collide with main's $_ foreach my $var (@_) { # $var unavailable to s2() s2( ) and print $var ; } # $_ available to s2() my $result=s2(); return $result; # not main's $result } *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | | 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From phillipneal at hotmail.com Fri Feb 18 10:04:15 2000 From: phillipneal at hotmail.com (Phillip Neal) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? Message-ID: <20000218160415.83548.qmail@hotmail.com> Tim, My rules of thumb have always been: 1. Suspect everything is global 2. Use clever names in main for all variables. After all, it's not Fortran IV anymore. 3. Use even more clever names for variables in subroutines. 4. Avoid using $_ for all but the most trivial cases,especially in subroutines. 5. Use lot's of print statements when debugging so you can see exactly what you're playing with. 6. Suspect everything is global. 7. Suspect everything is global. And most of all, suspect everything is global. Phil > >SPUG-ticians, > >The less experienced students in our Perl Programming classes tend to >have lots of trouble dealing with my vs. local, and hate nasty surprises >like File::Find trashing the $_ that's acting as their loop variable. > >So I've been trying to come up with a "Cookbook" approach to >providing "Scoping Guidance", and would be interested in the comments >of you professional Perl programmers out there on what I've come up >with so far. Have I left anything important out? Have I made >recommendations that you disagree with? > >There's at least one recommendation here that I've never seen in any >Perl documentation; enclosing your main program in {}. This either >means I've been amazingly clever in figuring out this useful technique >n my own, or else I'm stupid because everybody else achieves the same >result in some other way; which is it? 8-} > >There's also a sample program to drive home some of the points, which >must be somewhat cryptic to fit on the same page. > >TIA, > >-Tim > > The Consultix "Perl Scoping Guidelines", v0.8 > >FOR SMALL OR SIMPLE PROGRAMS > Relax and enjoy the freedom of Perl ! > >FOR ALL NON-TRIVIAL PROGRAMS (including LARGE/COMPLEX ones) >* limit scope of variables > > use my for user variables, local for pre-defineds ($_, $/, etc.) >* pass data to subs via the argument list (i.e., avoid globals) >* enclose main program in { } > > so my vars won't have file scope, and leak into subs > defined below > >IN LARGE OR COMPLEX PROGRAMS >* avoid using $_ ; widespread use creates many problems! >* localize temporary changes to built-in vars with new block > { local $,=' '; print; } >* put "use strict" at top of program, to force use of my() > > if you need a global variable, qualify with package name; > $count becomes $main::count > >SPECIAL CASES >* $_ automatically localized to { } when provided as default > loop or function variable >* foreach (LIST) { }, grep { } LIST, map { } LIST, etc. > > EXAMPLE > (somewhat nonsensical, but fits on page with above!) > >{ # these parens confine MAIN variables declared with my() > my @names=('Joe', 'Nancy'); > local $_='(303) 456-7890'; > foreach (@names) { print "$_\n"; } # different, local $_ > print "$_\n"; # print the phone number > my $result = compute(@names); > { $\='\cL'; print $result; } >} # end of MAIN > >sub compute { > local $_='Test Data'; # won't collide with main's $_ > foreach my $var (@_) { # $var unavailable to s2() > s2( ) and print $var ; } # $_ available to s2() > my $result=s2(); return $result; # not main's $result >} > ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Feb 18 11:04:41 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? In-Reply-To: <20000218160415.83548.qmail@hotmail.com>; from phillipneal@hotmail.com on Fri, Feb 18, 2000 at 08:04:15AM -0800 References: <20000218160415.83548.qmail@hotmail.com> Message-ID: <20000218090441.A11273@timji.consultix.wa.com> On Fri, Feb 18, 2000 at 08:04:15AM -0800, Phillip Neal wrote: > Tim, Just to be clear on this, are you saying one should *Suspect Everything is Global*? -Tim ($::Tim, $main::Tim, etc.) > > My rules of thumb have always been: > > 1. Suspect everything is global > > 2. Use clever names in main for all variables. After all, it's > not Fortran IV anymore. > > 3. Use even more clever names for variables in subroutines. > > 4. Avoid using $_ for all but the most trivial cases,especially > in subroutines. > > 5. Use lot's of print statements when debugging so you can > see exactly what you're playing with. > > 6. Suspect everything is global. > > 7. Suspect everything is global. > > And most of all, suspect everything is global. > > Phil > > > > > >SPUG-ticians, > > > >The less experienced students in our Perl Programming classes tend to > >have lots of trouble dealing with my vs. local, and hate nasty surprises > >like File::Find trashing the $_ that's acting as their loop variable. > > > >So I've been trying to come up with a "Cookbook" approach to > >providing "Scoping Guidance", and would be interested in the comments > >of you professional Perl programmers out there on what I've come up > >with so far. Have I left anything important out? Have I made > >recommendations that you disagree with? > > > >There's at least one recommendation here that I've never seen in any > >Perl documentation; enclosing your main program in {}. This either > >means I've been amazingly clever in figuring out this useful technique > >n my own, or else I'm stupid because everybody else achieves the same > >result in some other way; which is it? 8-} > > > >There's also a sample program to drive home some of the points, which > >must be somewhat cryptic to fit on the same page. > > > >TIA, > > > >-Tim > > > > The Consultix "Perl Scoping Guidelines", v0.8 > > > >FOR SMALL OR SIMPLE PROGRAMS > > Relax and enjoy the freedom of Perl ! > > > >FOR ALL NON-TRIVIAL PROGRAMS (including LARGE/COMPLEX ones) > >* limit scope of variables > > > use my for user variables, local for pre-defineds ($_, $/, etc.) > >* pass data to subs via the argument list (i.e., avoid globals) > >* enclose main program in { } > > > so my vars won't have file scope, and leak into subs > > defined below > > > >IN LARGE OR COMPLEX PROGRAMS > >* avoid using $_ ; widespread use creates many problems! > >* localize temporary changes to built-in vars with new block > > { local $,=' '; print; } > >* put "use strict" at top of program, to force use of my() > > > if you need a global variable, qualify with package name; > > $count becomes $main::count > > > >SPECIAL CASES > >* $_ automatically localized to { } when provided as default > > loop or function variable > >* foreach (LIST) { }, grep { } LIST, map { } LIST, etc. > > > > EXAMPLE > > (somewhat nonsensical, but fits on page with above!) > > > >{ # these parens confine MAIN variables declared with my() > > my @names=('Joe', 'Nancy'); > > local $_='(303) 456-7890'; > > foreach (@names) { print "$_\n"; } # different, local $_ > > print "$_\n"; # print the phone number > > my $result = compute(@names); > > { $\='\cL'; print $result; } > >} # end of MAIN > > > >sub compute { > > local $_='Test Data'; # won't collide with main's $_ > > foreach my $var (@_) { # $var unavailable to s2() > > s2( ) and print $var ; } # $_ available to s2() > > my $result=s2(); return $result; # not main's $result > >} > > > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > -- *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | | 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From rick at libronix.com Fri Feb 18 11:33:33 2000 From: rick at libronix.com (Rick Brannan) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? Message-ID: A few years back, Tom Christiansen (who else?) posted a decent expository tome on the subject to comp.lang.perl.misc. I just searched deja.com for it, and found it. The link (hopefully it'll work) is: http://x46.deja.com/[ST_rn=if]/getdoc.xp?AN=295246159&CONTEXT=950895037.2147 352618&hitnum=1 If the link doesn't work, the message title is "Re: need the skinny on my() vs. local()", the message date is 12/04/1997. I found it by searching on "tom, who can't believe anyone made it this far" which appears at the bottom of the message, with my range set as the archives for comp.lang.perl.misc. After referencing perlfaq7, Tom goes on to explain differences between local & my. It's good stuff. As a matter of fact, at the time it was posted, I read it, copied it, popped on the company intranet, and made sure everyone read it and understood it. ------------------------------ Rick Brannan, Libronix Corp. web: http://www.libronix.com "I don't need no radio, I got yodelin' on my noodle-o" -- Swirling Eddies >-----Original Message----- >From: Tim Maher/CONSULTIX [mailto:tim@consultix-inc.com] >Sent: Thursday, February 17, 2000 9:14 PM >To: spug-list@pm.org >Subject: SPUG: Scoping Guidelines; comments? > > >SPUG-ticians, > >The less experienced students in our Perl Programming classes tend to >have lots of trouble dealing with my vs. local, and hate nasty >surprises >like File::Find trashing the $_ that's acting as their loop variable. > >So I've been trying to come up with a "Cookbook" approach to >providing "Scoping Guidance", and would be interested in the comments >of you professional Perl programmers out there on what I've come up >with so far. Have I left anything important out? Have I made >recommendations that you disagree with? > >There's at least one recommendation here that I've never seen in any >Perl documentation; enclosing your main program in {}. This either >means I've been amazingly clever in figuring out this useful technique >n my own, or else I'm stupid because everybody else achieves the same >result in some other way; which is it? 8-} > >There's also a sample program to drive home some of the points, which >must be somewhat cryptic to fit on the same page. > >TIA, > >-Tim > > The Consultix "Perl Scoping Guidelines", v0.8 > >FOR SMALL OR SIMPLE PROGRAMS > Relax and enjoy the freedom of Perl ! > >FOR ALL NON-TRIVIAL PROGRAMS (including LARGE/COMPLEX ones) >* limit scope of variables > > use my for user variables, local for pre-defineds ($_, $/, etc.) >* pass data to subs via the argument list (i.e., avoid globals) >* enclose main program in { } > > so my vars won't have file scope, and leak into subs > defined below > >IN LARGE OR COMPLEX PROGRAMS >* avoid using $_ ; widespread use creates many problems! >* localize temporary changes to built-in vars with new block > { local $,=' '; print; } >* put "use strict" at top of program, to force use of my() > > if you need a global variable, qualify with package name; > $count becomes $main::count > >SPECIAL CASES >* $_ automatically localized to { } when provided as default > loop or function variable >* foreach (LIST) { }, grep { } LIST, map { } LIST, etc. > > EXAMPLE > (somewhat nonsensical, but fits on page with above!) > >{ # these parens confine MAIN variables declared with my() > my @names=('Joe', 'Nancy'); > local $_='(303) 456-7890'; > foreach (@names) { print "$_\n"; } # different, local $_ > print "$_\n"; # print the phone number > my $result = compute(@names); > { $\='\cL'; print $result; } >} # end of MAIN > >sub compute { > local $_='Test Data'; # won't collide with main's $_ > foreach my $var (@_) { # $var unavailable to s2() > s2( ) and print $var ; } # $_ available to s2() > my $result=s2(); return $result; # not main's $result >} > >*============================================================== >==========* >| Tim Maher, PhD Consultix & (206) 781-UNIX/8649 > | >| Pacific Software Gurus, Inc Email: >tim@consultix-inc.com | >| UNIX/Linux & Perl Training http://www.consultix-inc.com | | 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jimfl at colltech.com Fri Feb 18 12:29:11 2000 From: jimfl at colltech.com (jimfl) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? In-Reply-To: <20000218160415.83548.qmail@hotmail.com> Message-ID: <398918.3159858551@erdos.nwest.attws.com> --Quoth Phillip Neal On Friday, February 18, 2000 8:04 AM +0000: > My rules of thumb have always been: > > 1. Suspect everything is global My, my, my. At some point when a perl program gets to be a certain size I use strict; use vars qw($foo $bar %baz); I also am generally in the habit of doing stuff like foreach my $thing in (@stuff) { my $tmp = munge($thing); } I generally only use 'local' when I have to, i.e.: sub spit_it_out { local *FILEHANDLE = shift; my @stuff = @_; print FILEHANDLE join("\n", @stuff); } or { local $SIG{__DIE__} = \&dont_die; do_something_deadly; } My guideline would be use lexical scoping unless you understand why you would need to use dynamic scoping, which boils down, for beginners, to "Never, ever use 'local'." Don Knuth has a good philosophy: In the earlier chapters I'm going to make statements which, by the time you get to later chapters you will recognise as being blatantly false. -- Jim Flanagan Collective Technologies jimfl@colltech.com http://www.colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Feb 18 12:34:36 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: tchrist on my vs. local Message-ID: <20000218103436.A12019@timji.consultix.wa.com> SPUG-sters: I've been informed the link on a previous email didn't work. No surpise there, I was hoping against hope that it would work. Here's the article on local vs. my, which (as I recall) may be a strategic munging of various exerpts from perdoc stuff. -------------------------------------------- In comp.lang.perl.misc, "Dave Kaufman" writes: :I was about to paste some functions from a "require" -ed script into my the :calling script, and forego the require and the need for two files. But I :see that the functions I'm (ripping off) --copying, use local() to declare :all the variables, whereas I always use my() to avoid namespace collisions :from inside functions. local() doesn't declare anything. Hence your confusion. :I'm afeared. What is the difference between my() and local() ? Read perlfaq7 about this. I believe that for each Perl programmer who understands the difference, there are fully 10,000 who do not. You are not alone. It's very depressing. :I read the camel book explanation but it sailed right over my pea brain. Ok, then don't try to understand, just believe the following: NEVER USE local() AT ALL (unless you get a syntax error otherwise), because it doesn't create a local variable; its name is deceiving. Consider local deprecated, at least for you. Use my instead. I explain this so many times every day I'm too tired to do it again now. Well, here; I'll cite myself. Q: What's the difference between dynamic and lexical (static) scoping? Between local() and my()? A: local($x) saves away the old value of the global variable $x, and assigns a new value for the duration of the subroutine, which is visible in other functions called from that subroutine. This is done at run-time, so is called dynamic scoping. local() always affects global variables, also called package variables or dynamic variables. my($x) creates a new variable that is only visible in the current subroutine. This is done at compile-time, so is called lexical or static scoping. my() always affects private variables, also called lexical variables or (improperly) static(ly scoped) variables. For instance: sub visible { print "var has value $var\n"; } sub dynamic { local $var = 'local'; # new temporary value for the still-global visible(); # variable called $var } sub lexical { my $var = 'private'; # new private variable, $var visible(); # (invisible outside of sub scope) } $var = 'global'; visible(); # prints global dynamic(); # prints local lexical(); # prints global Notice how at no point does the value "private" get printed. That's because $var only has that value within the block of the lexical() function, and it is hidden from called subroutine. In summary, local() doesn't make what you think of as private, local variables. It gives a global variable a temporary value. my() is what you're looking for if you want private variables. See also the perlsub manpage, which explains this all in more detail. And here the referenced section from perlsub: Private Variables via my() Synopsis: my $foo; # declare $foo lexically local my (@wid, %get); # declare list of variables local my $foo = "flurp"; # declare $foo lexical, and init it my @oof = @bar; # declare @oof lexical, and init it A "my" declares the listed variables to be confined (lexically) to the enclosing block, conditional (if/unless/elsif/else), loop (for/foreach/while/until/continue), subroutine, eval, or do/require/use'd file. If more than one value is listed, the list must be placed in parentheses. All listed elements must be legal lvalues. Only alphanumeric identifiers may be lexically scoped--magical builtins like $/ must currently be localized with "local" instead. Unlike dynamic variables created by the "local" statement, lexical variables declared with "my" are totally hidden from the outside world, including any called subroutines (even if it's the same subroutine called from itself or elsewhere--every call gets its own copy). (An eval(), however, can see the lexical variables of the scope it is being evaluated in so long as the names aren't hidden by declarations within the eval() itself. See the perlref manpage.) The parameter list to my() may be assigned to if desired, which allows you to initialize your variables. (If no initializer is given for a particular variable, it is created with the undefined value.) Commonly this is used to name the parameters to a subroutine. Examples: $arg = "fred"; # "global" variable $n = cube_root(27); print "$arg thinks the root is $n\n"; fred thinks the root is 3 sub cube_root { my $arg = shift; # name doesn't matter $arg **= 1/3; return $arg; } The "my" is simply a modifier on something you might assign to. So when you do assign to the variables in its argument list, the "my" doesn't change whether those variables is viewed as a scalar or an array. So my ($foo) = ; my @FOO = ; both supply a list context to the right-hand side, while my $foo = ; supplies a scalar context. But the following declares only one variable: my $foo, $bar = 1; That has the same effect as my $foo; $bar = 1; The declared variable is not introduced (is not visible) until after the current statement. Thus, my $x = $x; can be used to initialize the new $x with the value of the old $x, and the expression my $x = 123 and $x == 123 is false unless the old $x happened to have the value 123. Lexical scopes of control structures are not bounded precisely by the braces that delimit their controlled blocks; control expressions are part of the scope, too. Thus in the loop while (defined(my $line = <>)) { $line = lc $line; } continue { print $line; } the scope of $line extends from its declaration throughout the rest of the loop construct (including the continue clause), but not beyond it. Similarly, in the conditional if ((my $answer = ) =~ /^yes$/i) { user_agrees(); } elsif ($answer =~ /^no$/i) { user_disagrees(); } else { chomp $answer; die "'$answer' is neither 'yes' nor 'no'"; } the scope of $answer extends from its declaration throughout the rest of the conditional (including elsif and else clauses, if any), but not beyond it. (None of the foregoing applies to if/unless or while/until modifiers appended to simple statements. Such modifiers are not control structures and have no effect on scoping.) The foreach loop defaults to scoping its index variable dynamically (in the manner of local; see below). However, if the index variable is prefixed with the keyword "my", then it is lexically scoped instead. Thus in the loop for my $i (1, 2, 3) { some_function(); } the scope of $i extends to the end of the loop, but not beyond it, and so the value of $i is unavailable in some_function(). Some users may wish to encourage the use of lexically scoped variables. As an aid to catching implicit references to package variables, if you say use strict 'vars'; then any variable reference from there to the end of the enclosing block must either refer to a lexical variable, or must be fully qualified with the package name. A compilation error results otherwise. An inner block may countermand this with "no strict 'vars'". A my() has both a compile-time and a run-time effect. At compile time, the compiler takes notice of it; the principle usefulness of this is to quiet use strict 'vars'. The actual initialization is delayed until run time, so it gets executed appropriately; every time through a loop, for example. Variables declared with "my" are not part of any package and are therefore never fully qualified with the package name. In particular, you're not allowed to try to make a package variable (or other global) lexical: my $pack::var; # ERROR! Illegal syntax my $_; # also illegal (currently) In fact, a dynamic variable (also known as package or global variables) are still accessible using the fully qualified :: notation even while a lexical of the same name is also visible: package main; local $x = 10; my $x = 20; print "$x and $::x\n"; That will print out 20 and 10. You may declare "my" variables at the outermost scope of a file to hide any such identifiers totally from the outside world. This is similar to C's static variables at the file level. To do this with a subroutine requires the use of a closure (anonymous function). If a block (such as an eval(), function, or package) wants to create a private subroutine that cannot be called from outside that block, it can declare a lexical variable containing an anonymous sub reference: my $secret_version = '1.001-beta'; my $secret_sub = sub { print $secret_version }; &$secret_sub(); So long as the reference is never returned by any function within the module, no outside module can see the subroutine, because its name is not in any package's symbol table. Remember that it's not REALLY called $some_pack::secret_version or anything; it's just $secret_version, unqualified and unqualifiable. This does not work with object methods, however; all object methods have to be in the symbol table of some package to be found. Just because the lexical variable is lexically (also called statically) scoped doesn't mean that within a function it works like a C static. It normally works more like a C auto. But here's a mechanism for giving a function private variables with both lexical scoping and a static lifetime. If you do want to create something like C's static variables, just enclose the whole function in an extra block, and put the static variable outside the function but in the block. { my $secret_val = 0; sub gimme_another { return ++$secret_val; } } # $secret_val now becomes unreachable by the outside # world, but retains its value between calls to gimme_another If this function is being sourced in from a separate file via require or use, then this is probably just fine. If it's all in the main program, you'll need to arrange for the my() to be executed early, either by putting the whole block above your main program, or more likely, placing merely a BEGIN sub around it to make sure it gets executed before your program starts to run: sub BEGIN { my $secret_val = 0; sub gimme_another { return ++$secret_val; } } See the perlrun manpage about the BEGIN function. Temporary Values via local() NOTE: In general, you should be using "my" instead of "local", because it's faster and safer. Exceptions to this include the global punctuation variables, filehandles and formats, and direct manipulation of the Perl symbol table itself. Format variables often use "local" though, as do other variables whose current value must be visible to called subroutines. Synopsis: local $foo; # declare $foo dynamically local local (@wid, %get); # declare list of variables local local $foo = "flurp"; # declare $foo dynamic, and init it local @oof = @bar; # declare @oof dynamic, and init it local *FH; # localize $FH, @FH, %FH, &FH ... local *merlyn = *randal; # now $merlyn is really $randal, plus # @merlyn is really @randal, etc local *merlyn = 'randal'; # SAME THING: promote 'randal' to *randal local *merlyn = \$randal; # just alias $merlyn, not @merlyn etc A local() modifies its listed variables to be local to the enclosing block, (or subroutine, eval{}, or do) and any called from within that block. A local() just gives temporary values to global (meaning package) variables. This is known as dynamic scoping . Lexical scoping is done with "my", which works more like C's auto declarations. If more than one variable is given to local(), they must be placed in parentheses. All listed elements must be legal lvalues. This operator works by saving the current values of those variables in its argument list on a hidden stack and restoring them upon exiting the block, subroutine, or eval. This means that called subroutines can also reference the local variable, but not the global one. The argument list may be assigned to if desired, which allows you to initialize your local variables. (If no initializer is given for a particular variable, it is created with an undefined value.) Commonly this is used to name the parameters to a subroutine. Examples: for $i ( 0 .. 9 ) { $digits{$i} = $i; } # assume this function uses global %digits hash parse_num(); # now temporarily add to %digits hash if ($base12) { # (NOTE: not claiming this is efficient!) local %digits = (%digits, 't' => 10, 'e' => 11); parse_num(); # parse_num gets this new %digits! } # old %digits restored here Because local() is a run-time command, it gets executed every time through a loop. In releases of Perl previous to 5.0, this used more stack storage each time until the loop was exited. Perl now reclaims the space each time through, but it's still more efficient to declare your variables outside the loop. A local is simply a modifier on an lvalue expression. When you assign to a localized variable, the local doesn't change whether its list is viewed as a scalar or an array. So local($foo) = ; local @FOO = ; both supply a list context to the right-hand side, while local $foo = ; supplies a scalar context. A note about local() and composite types is in order. Something like local(%foo) works by temporarily placing a brand new hash in the symbol table. The old hash is left alone, but is hidden "behind" the new one. This means the old variable is completely invisible via the symbol table (i.e. the hash entry in the *foo typeglob) for the duration of the dynamic scope within which the local() was seen. This has the effect of allowing one to temporarily occlude any magic on composite types. For instance, this will briefly alter a tied hash to some other implementation: tie %ahash, 'APackage'; [...] { local %ahash; tie %ahash, 'BPackage'; [..called code will see %ahash tied to 'BPackage'..] { local %ahash; [..%ahash is a normal (untied) hash here..] } } [..%ahash back to its initial tied self again..] As another example, a custom implementation of %ENV might look like this: { local %ENV; tie %ENV, 'MyOwnEnv'; [..do your own fancy %ENV manipulation here..] } [..normal %ENV behavior here..] --tom, who can't believe anyone made it this far. -- Tom Christiansen tchrist@jhereg.perl.com With a PC, I always felt limited by the software available. On Unix, I am limited by my knowledge. --Peter J. Schoenster - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From stuart_poulin at yahoo.com Fri Feb 18 13:04:25 2000 From: stuart_poulin at yahoo.com (Stuart Poulin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? Message-ID: <20000218190425.23844.qmail@web111.yahoomail.com> I think it was on this list that I saw you can use: perl -MO=Lint,all script.pl to catch implied usage of $_ perldoc B::Lint --- Tim Maher/CONSULTIX wrote: > SPUG-ticians, > > The less experienced students in our Perl Programming classes tend to > have lots of trouble dealing with my vs. local, and hate nasty surprises > like File::Find trashing the $_ that's acting as their loop variable. > > So I've been trying to come up with a "Cookbook" approach to > providing "Scoping Guidance", and would be interested in the comments > of you professional Perl programmers out there on what I've come up > with so far. Have I left anything important out? Have I made > recommendations that you disagree with? > > There's at least one recommendation here that I've never seen in any > Perl documentation; enclosing your main program in {}. This either > means I've been amazingly clever in figuring out this useful technique > n my own, or else I'm stupid because everybody else achieves the same > result in some other way; which is it? 8-} > > There's also a sample program to drive home some of the points, which > must be somewhat cryptic to fit on the same page. > > TIA, > > -Tim > > The Consultix "Perl Scoping Guidelines", v0.8 > > FOR SMALL OR SIMPLE PROGRAMS > Relax and enjoy the freedom of Perl ! > > FOR ALL NON-TRIVIAL PROGRAMS (including LARGE/COMPLEX ones) > * limit scope of variables > > use my for user variables, local for pre-defineds ($_, $/, etc.) > * pass data to subs via the argument list (i.e., avoid globals) > * enclose main program in { } > > so my vars won't have file scope, and leak into subs > defined below > > IN LARGE OR COMPLEX PROGRAMS > * avoid using $_ ; widespread use creates many problems! > * localize temporary changes to built-in vars with new block > { local $,=' '; print; } > * put "use strict" at top of program, to force use of my() > > if you need a global variable, qualify with package name; > $count becomes $main::count > > SPECIAL CASES > * $_ automatically localized to { } when provided as default > loop or function variable > * foreach (LIST) { }, grep { } LIST, map { } LIST, etc. > > EXAMPLE > (somewhat nonsensical, but fits on page with above!) > > { # these parens confine MAIN variables declared with my() > my @names=('Joe', 'Nancy'); > local $_='(303) 456-7890'; > foreach (@names) { print "$_\n"; } # different, local $_ > print "$_\n"; # print the phone number > my $result = compute(@names); > { $\='\cL'; print $result; } > } # end of MAIN > > sub compute { > local $_='Test Data'; # won't collide with main's $_ > foreach my $var (@_) { # $var unavailable to s2() > s2( ) and print $var ; } # $_ available to s2() > my $result=s2(); return $result; # not main's $result > } > > *========================================================================* > | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | > | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | > | UNIX/Linux & Perl Training http://www.consultix-inc.com | > | 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching | > *========================================================================* > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > > __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From billa at willapabay.org Fri Feb 18 13:04:44 2000 From: billa at willapabay.org (Bill Alford) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? In-Reply-To: <398918.3159858551@erdos.nwest.attws.com> Message-ID: This is similar to my technique too. When the program starts getting big, or I realize it's going to be longer lived and edited by others, I do the following: 1. Add: use package; # put all my packages in use strict; # declare globals with my ... main(); exit(); 2. wrap everything in sub main {...} 3. Proceed in development like it's a very picky language. Try to avoid code that only people that are very used to perl use (like the implicit variables and side effects). Always use 'my' instead of 'local'. If I do use something tricky, comment like a mad man (partly because I know I am lazy and avoid remembering things that are in manuals, and partly for when someone takes it over and I'm not around). I can imagine cases where you want to temorarily hid the current value of a global variable and call subroutines with the global value changed, but you can always get around that using other techniques that won't confuse someone not familiar with the behavior of dynamic scoping (Lisp like). Lexical scoping is a lot easier to understand for beginners (the draw a "fence" with the curly braces approach :) . IMHO, it also leads to more maintanable code. I don't know about you, but I don't want to be called six months after leaving a job with questions about how a program works. :) But as usual, techiques used are a question of style and the "company" culture where you are at. Bill On Fri, 18 Feb 2000, jimfl wrote: > --Quoth Phillip Neal On Friday, February 18, 2000 > 8:04 AM +0000: > > > My rules of thumb have always been: > > > > 1. Suspect everything is global > > My, my, my. > > At some point when a perl program gets to be a certain size I > > use strict; > use vars qw($foo $bar %baz); > > I also am generally in the habit of doing stuff like > > foreach my $thing in (@stuff) { > my $tmp = munge($thing); > } > > I generally only use 'local' when I have to, i.e.: > > sub spit_it_out { > local *FILEHANDLE = shift; > my @stuff = @_; > print FILEHANDLE join("\n", @stuff); > } > > or > > { > local $SIG{__DIE__} = \&dont_die; > do_something_deadly; > } > > My guideline would be use lexical scoping unless you understand why you > would need to use dynamic scoping, which boils down, for beginners, to > "Never, ever use 'local'." Don Knuth has a good philosophy: In the > earlier chapters I'm going to make statements which, by the time you get > to later chapters you will recognise as being blatantly false. > > -- > Jim Flanagan Collective Technologies > jimfl@colltech.com http://www.colltech.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jimfl at colltech.com Fri Feb 18 13:32:19 2000 From: jimfl at colltech.com (jimfl) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Scoping Guidelines; comments? In-Reply-To: Message-ID: <627697.3159862339@erdos.nwest.attws.com> --Quoth Bill Alford On Friday, February 18, 2000 11:04 AM -0800: > I can imagine cases where you want to temorarily hid the current > value of a global variable and call subroutines with the global > value changed, but you can always get around that using other > techniques that won't confuse someone not familiar with the behavior > of dynamic scoping (Lisp like). Not even Lisp is dynamically scoped anymore. Common Lisp and Scheme are lexically scoped. -- Jim Flanagan Collective Technologies jimfl@colltech.com http://www.colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From phillipneal at hotmail.com Fri Feb 18 13:37:40 2000 From: phillipneal at hotmail.com (Phillip Neal) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Just a reminder , a mod, and an attachment -- Non forking servers Message-ID: <20000218193740.61519.qmail@hotmail.com> Spugsters, Just a reminder, please fire off that client at noon today. Also, if you have a client.pl with a salt for the passwd of $$, please change it to 'j3' (in quotes). For some reason I am having problems with the $$ salt. If you need a client. One is attached to this email. Thanks, Phil ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: pub.pl Type: application/octet-stream Size: 2391 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20000218/8469e6df/pub.obj From matthew at lasarletter.com Mon Feb 21 21:02:55 2000 From: matthew at lasarletter.com (Matthew Lasar) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: a split question . . . Message-ID: <3.0.1.32.20000221190255.007d9b30@mail.transbay.net> Dear Spuggers: I have a question about a line of split script. I am a beginning Perl person. I work at the University of California Press in the IS department and I'm teaching myself Perl because it seems like it will be useful for all sorts of things. I'm working my way through a book called *SAMs Teach Yourself Perl in 24 Hours*. Let me assure you, 24 hours came and went quite a while ago. Anyway, so here's this sample database program which starts with the following lines of code: #!/usr/bin/perl -w open(PH, "database.txt") or die "Cannot open database.txt: $!\n"; while() { chomp; ($number, $email)=(split(/\s+/, $_)) [1,2]; The book doesn't adequately explain the last piece of this script, the "[1,2];" part. What is this for? Also, if I've got windows 95, what should I really put after "#!"? That stuff looks like a unix path to me. I am grateful for the existence of this list, and for any help you care to offer. cordially Matthew Lasar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From greg.mushen at gettyimages.com Mon Feb 21 22:05:04 2000 From: greg.mushen at gettyimages.com (Greg Mushen) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: a split question . . . Message-ID: <990EFA5D5CA7D311B44300A0C9D5E149DE1796@SEAEXCHG02> The [1,2] piece of the script tells the split function which values to put into the variables you've specified. For example, if you have a text file with these entries: [0] [1] [2] 02/21/00 1 greg.mushen@gettyimages.com 02/21/00 2 spug-list@pm.org 02/21/00 3 foo@bar.com ($number, $email) = (split(/\s+/, $_))[1,2]; would return: 1 greg.mushen@gettyimages.com 2 spug-list@pm.org 3 foo@bar.com Instead, if you entered [0,2], it would return: 02/21/00 greg.mushen@gettyimages.com 02/21/00 spug-list@pm.org 02/21/00 foo@bar.com On my Win NT machine, I can type #!c:\perl\bin\perl.exe into the beginning of the script and it will execute properly. If that doesn't work, invoke it explicity with perl (this assumes Perl is in your path). Hope this helps, Greg Mushen -----Original Message----- From: Matthew Lasar [mailto:matthew@lasarletter.com] Sent: Monday, February 21, 2000 7:03 PM To: spug-list@pm.org Subject: SPUG: a split question . . . Dear Spuggers: I have a question about a line of split script. I am a beginning Perl person. I work at the University of California Press in the IS department and I'm teaching myself Perl because it seems like it will be useful for all sorts of things. I'm working my way through a book called *SAMs Teach Yourself Perl in 24 Hours*. Let me assure you, 24 hours came and went quite a while ago. Anyway, so here's this sample database program which starts with the following lines of code: #!/usr/bin/perl -w open(PH, "database.txt") or die "Cannot open database.txt: $!\n"; while() { chomp; ($number, $email)=(split(/\s+/, $_)) [1,2]; The book doesn't adequately explain the last piece of this script, the "[1,2];" part. What is this for? Also, if I've got windows 95, what should I really put after "#!"? That stuff looks like a unix path to me. I am grateful for the existence of this list, and for any help you care to offer. cordially Matthew Lasar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mcglk at serv.net Mon Feb 21 22:43:03 2000 From: mcglk at serv.net (Ken McGlothlen) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: a split question . . . In-Reply-To: Matthew Lasar's message of "Mon, 21 Feb 2000 19:02:55 -0800" References: <3.0.1.32.20000221190255.007d9b30@mail.transbay.net> Message-ID: <87aekthmp4.fsf@ralf.serv.net> Matthew Lasar writes: | [...] I'm working my way through a book called *SAMs Teach Yourself Perl in | 24 Hours*. | | Let me assure you, 24 hours came and went quite a while ago. That's because it's not a very good book. :) There are better ones out there; if you need a list, let us know. I'm sure you'll get a dozen repeated suggestions that would make much better choices. | Anyway, so here's this sample database program which starts with the | following lines of code: | | #!/usr/bin/perl -w | open(PH, "database.txt") or die "Cannot open database.txt: $!\n"; | while() { | chomp; | ($number, $email)=(split(/\s+/, $_)) [1,2]; | | The book doesn't adequately explain the last piece of this script, the | "[1,2];" part. What is this for? Okay. Let's look at this a bit. $_, of course, is a line out of the filehandle PH, which is coming out of database.txt. We've already removed the newline at the end with chomp(), and now we have a set of fields separated with whitespace. The split() statement chops up the line based on the whitespace, and returns a list. The subscript here is used like an operator; it's a slice of an array. In this case, it returns the second and third elements of the list. Those, in turn, get assigned with the = operator to $number and $email, respectively. Got all that? | Also, if I've got windows 95, what should I really put after "#!"? That stuff | looks like a unix path to me. It is, of course. It's been a while since I've used ActiveState's version of Perl (which is what I'm guessing you're using), but it didn't used to matter what you put there under that implementation---but it's a useful line to keep around if you move the script to a Unix system. :) It's also useful in that I think ActiveState will recognize the options (in this case, -w, which provides more warnings). However, their documentation will give you much better answers than my rusty memory will provide. Best of luck, and welcome to the fold(). :) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From matthew at lasarletter.com Mon Feb 21 23:48:49 2000 From: matthew at lasarletter.com (Matthew Lasar) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: thank you on the split question Message-ID: <3.0.1.32.20000221214849.007d9780@mail.transbay.net> Dear Spuggists: Thank you all very much for your consistently great answers to my split question. I learned so much from your responses that I'm just spending the evening reading them. A couple of you said that there were better books than the one I mentioned (SAMS 24 hour). I also have *Learning Perl*. Any other suggestions would be gratefully appreciated. Matthew - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From davidpa at mosaix.com Tue Feb 22 10:40:03 2000 From: davidpa at mosaix.com (Patterson, David S (David)) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: a split question . . . Message-ID: [ Comment from the Peanut Gallery ] This is a really cool trick! I can't believe I've never seen it before now... I had to go back to the blue camel book (Programming Perl, Wall & Schwartz) and find it before I could believe it. It's actually documented on pg 48, but in a rather academic way--the example never mentions the beauty of using it in something like split. It just proves that you can never completely "learn" a language. People are always finding new ways to use the tools in any toolbox... "(A)bort (R)etry (T)ake down entire network?" > David Patterson > Software Engineer > Lucent Technologies * > 6464 185th Ave NE > Redmond, WA 98052-6736 > 425-558-8008 x 2172 888-501-4835 Pgr > davidpa@lucent.com > > > -----Original Message----- > From: Greg Mushen [SMTP:greg.mushen@gettyimages.com] > Sent: Monday, February 21, 2000 8:05 PM > To: 'Matthew Lasar'; spug-list@pm.org > Subject: RE: SPUG: a split question . . . > > The [1,2] piece of the script tells the split function which values to put > into the variables you've specified. For example, if you have a text file > with these entries: > > [0] [1] [2] > > 02/21/00 1 greg.mushen@gettyimages.com > 02/21/00 2 spug-list@pm.org > 02/21/00 3 foo@bar.com > > ($number, $email) = (split(/\s+/, $_))[1,2]; > > would return: > 1 greg.mushen@gettyimages.com > 2 spug-list@pm.org > 3 foo@bar.com > > Instead, if you entered [0,2], it would return: > 02/21/00 greg.mushen@gettyimages.com > 02/21/00 spug-list@pm.org > 02/21/00 foo@bar.com > > On my Win NT machine, I can type #!c:\perl\bin\perl.exe into the beginning > of the script and it will execute properly. If that doesn't work, invoke > it > explicity with perl (this assumes Perl is in your > path). > > Hope this helps, > Greg Mushen > > -----Original Message----- > From: Matthew Lasar [mailto:matthew@lasarletter.com] > Sent: Monday, February 21, 2000 7:03 PM > To: spug-list@pm.org > Subject: SPUG: a split question . . . > > > Dear Spuggers: > > I have a question about a line of split script. > > I am a beginning Perl person. I work at the University of California Press > in the IS department and I'm teaching myself Perl because it seems like it > will be useful for all sorts of things. I'm working my way through a book > called *SAMs Teach Yourself Perl in 24 Hours*. > > Let me assure you, 24 hours came and went quite a while ago. > > Anyway, so here's this sample database program which starts with the > following lines of code: > > #!/usr/bin/perl -w > open(PH, "database.txt") or die "Cannot open database.txt: $!\n"; > while() { > chomp; > ($number, $email)=(split(/\s+/, $_)) [1,2]; > > The book doesn't adequately explain the last piece of this script, the > "[1,2];" part. What is this for? Also, if I've got windows 95, what should > I really put after "#!"? That stuff looks like a unix path to me. > > I am grateful for the existence of this list, and for any help you care to > offer. > > cordially > > Matthew Lasar > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From asherr at cs.unm.edu Tue Feb 22 12:00:31 2000 From: asherr at cs.unm.edu (Aryeh "Cody" Sherr) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: The Perl Journal newstand location In-Reply-To: Message-ID: For those of you who havn't/don't want to zubscribe, I found TPJ at Broadway News this weekend. It's at the corner of Broadway and Olive, next to the Habitat coffee shop in Capital Hill. They had quite a few copies. Cody - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jimfl at colltech.com Tue Feb 22 12:55:46 2000 From: jimfl at colltech.com (jimfl) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: The Perl Journal newstand location In-Reply-To: Message-ID: <530012.3160205746@erdos.nwest.attws.com> --Quoth "Aryeh Sherr" On Tuesday, February 22, 2000 11:00 AM -0700: > For those of you who havn't/don't want to zubscribe, I found TPJ at > Broadway News this weekend. Also, I have reliably been able to find it at Fremot News. Most recently I have seen it at the Borders in Redmond Town Center as well. -- Jim Flanagan Collective Technologies jimfl@colltech.com http://www.colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From phillipneal at hotmail.com Tue Feb 22 19:10:12 2000 From: phillipneal at hotmail.com (Phillip Neal) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: The Perl Journal newstand location Message-ID: <20000223011012.69731.qmail@hotmail.com> Spugsters, You can also get it at the newstand in Fremont right down on Fremont Ave. across the street from Starbucks, about a block from the Fremont Bridge. Phil > >For those of you who havn't/don't want to zubscribe, I found TPJ at >Broadway News this weekend. It's at the corner of Broadway and Olive, next >to the Habitat coffee shop in Capital Hill. They had quite a few copies. > >Cody > ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Tue Feb 22 19:36:22 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: REI Perl Jobs, Kent WA Message-ID: <20000222173622.A1217@timji.consultix.wa.com> REI.com Internet Developer (multiple positions open) Permanent or possibly contract-to-perm Probably $50-70k (flexible) We're "One of America's 100 Best Companies to Work For" and the #1 online retailer in our category. We're looking for Internet Developers to help add functionality to the web site and develop applications for the online store. Our ideal candidate will have strong UNIX development skills in Perl, C/C++ or Java and a strong knowledge of SQL. Familiarity with IBM's Net.Commerce package is a plus. Strong communication, documentation, multi-tasking, and team skills are a must. If you'd like to work at a company that rewards initiative, effort and leadership, come join us. We offer an excellent compensation package plus an outstanding cash profit sharing and retirement plan, generous merchandise discount, flexible benefits, tuition reimbursement, alternate work schedules, and - most importantly - a work environment where respect for the individual and teamwork are our fundamental employee values. Please visit us at www.rei.com/jobs to learn more. This position is located at our Kent, Washington headquarters. Email, fax or mail resume & cover letter to: REI, Human Resources - Job #9946, P.O. Box 1938, Sumner, WA 98390. Email: reijobs@rei.com (no attachments) Fax: (253)395-4352 We are an Equal Opportunity/Affirmative Action Employer. Daniel Silverman REI Staffing Specialist dsilver@rei.com 253-395-4736 ========================================================== | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | | SPUG Founder & Leader Email: spug@halcyon.com | | Seattle Perl Users Group HTTP: www.halcyon.com/spug | ========================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at dbedge.com Wed Feb 23 11:06:08 2000 From: ryan at dbedge.com (Ryan Erwin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: ESPUG meeting tonight Message-ID: <002f01bf7e20$481433c0$520b91d8@dellbox> Our 2nd ever ESPUG meeting, "Object Oriented Perl" is tonight at 7:00 PM. The doors will open at Lucent at 6:30. Robert Abarbanel will be discussing interesting aspects of Object Oriented Perl from Damian Conway's book by the same title. Topics will include: * pseudo-hashes * automatic class and method construction * lexical protection * polymorphism * encapsulation and how to get there * aspects of persistence Bob is currently the lead instructor and developer of the Perl Certificate Program at the University of Washington Outreach. For more information about the meeting, and Robert Abarbanel, please visit -> http://espug.pm.org/#topic ESPUG meets at Lucent Technologies in Redmond. For directions, please visit -> http://espug.pm.org/#where And, if you haven't yet noticed, the ESPUG website is available at -> http://espug.pm.org Tonight, 7:00 pm. b->espug() || b*b -- Ryan Erwin / ryan@erwin.org / http://ryan.erwin.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Wed Feb 23 20:22:36 2000 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: thank you on the split question In-Reply-To: <3.0.1.32.20000221214849.007d9780@mail.transbay.net> References: <3.0.1.32.20000221214849.007d9780@mail.transbay.net> Message-ID: <14516.38380.167246.386609@maakie.uswc.uswest.com> Effective Perl (http://www.effectiveperl.com/). Not a very good learning book, but it touches on most of the commonly used idioms. >>>>> On Mon XXI Feb MM XXI:XLVIII:XLIX, Matthew Lasar writes: Matthew> Dear Spuggists: Thank you all very much for your consistently Matthew> great answers to my split question. I learned so much from Matthew> your responses that I'm just spending the evening reading Matthew> them. Matthew> A couple of you said that there were better books than the Matthew> one I mentioned (SAMS 24 hour). I also have *Learning Matthew> Perl*. Any other suggestions would be gratefully appreciated. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From lulu at windowware.com Thu Feb 24 12:58:35 2000 From: lulu at windowware.com (Laura Plaut) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: SPUG website? Message-ID: <38B57F5B.FE07D8E2@windowware.com> Is there a website where these postings are saved? Something like at ONELIST.COM? -- Laura Plaut WindowWare Tech Support Database: http://techsupt.windowware.com Tech BBS: http://webboard.windowware.com Web Site: http://www.windowware.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jope-spug at n2h2.com Thu Feb 24 13:39:05 2000 From: jope-spug at n2h2.com (El JoPe Magnifico) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: list archive? In-Reply-To: <38B57F5B.FE07D8E2@windowware.com> Message-ID: That's an excellent question. There doesn't appear to be an archive at OneList.com (or its flipsaide, eGroups.com), but there's no reason one couldn't be started. However, while eGroups can suffice for this purpose (I use it for linux-mac68k archive *plugplug* =), it isn't particularly well suited for archive-only purposes, where the list itself is run from a different service. One better-suited alternative is mail-archive.com (hosted by VA Linux). There are probably others. Of course, if PM.org itself plans on offering this functionality any time soon, that's the obvious choice. Perhaps our Fearless Leader has an idea whether this is planned or not. -jp On Thu, 24 Feb 2000, Laura Plaut wrote: > Is there a website where these postings are saved? Something like at > ONELIST.COM? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dean at ero.com Thu Feb 24 14:50:07 2000 From: dean at ero.com (Dean Hudson) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: a split question . . . In-Reply-To: Message-ID: On Tue, 22 Feb 2000, Patterson, David S (David) wrote: > This is a really cool trick! I can't believe I've never seen it before > now... I had to go back to the blue camel book (Programming Perl, Wall & > Schwartz) and find it before I could believe it. It's actually documented > on pg 48, but in a rather academic way--the example never mentions the > beauty of using it in something like split. It just proves that you can > never completely "learn" a language. People are always finding new ways to > use the tools in any toolbox... It's also really handy with stat() and any of the getpwyada() builtins; they often return a mess of data that you're not interested in. dean. -- my $email = qr{ dean(h)?@(?(1)verio\.net # work | ero\.com) }x; # other - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Thu Feb 24 16:09:05 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: SPUG website? In-Reply-To: <38B57F5B.FE07D8E2@windowware.com>; from lulu@windowware.com on Thu, Feb 24, 2000 at 10:58:35AM -0800 References: <38B57F5B.FE07D8E2@windowware.com> Message-ID: <20000224140905.A9140@timji.consultix.wa.com> On Thu, Feb 24, 2000 at 10:58:35AM -0800, Laura Plaut wrote: > Is there a website where these postings are saved? Something like at > ONELIST.COM? Used to be, but now sure about the current status. I'm looking into it, and will let the list-subscribers know. -Tim > -- > Laura Plaut > WindowWare Tech Support > > Database: http://techsupt.windowware.com > Tech BBS: http://webboard.windowware.com > Web Site: http://www.windowware.com *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | |Classes: 2/29: Int. Perl Programming 3/3: Adv. Pattern Matching w/Perl | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ajalis at beryllium.cobaltgroup.com Thu Feb 24 18:56:39 2000 From: ajalis at beryllium.cobaltgroup.com (Asim Jalis) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Bad Function Names Message-ID: <200002250056.QAA13391@beryllium.cobaltgroup.com> This question was triggered by Bob Abarbanel's excellent ESPUG presentation last night. Suppose I am accidentally calling a function that I have not defined. I have no desire to use AUTOLOAD. When I run the program it will keep running until it encounters the function call and then after not being able to handle it it will give me a run-time error. The question is: Can I catch this at compile-time? This would be nice to have because otherwise I keep worrying that I might have typos in my code waiting to explode in production. Is there a way to catch any of this at compile-time? Here is an example: --------------------cut here-------------------- #!/usr/bin/perl use strict; sub bad_hello { bad_function ("hi there from bad_hello\n"); } sub good_hello { print ("hi there from good_hello\n"); } my $date = localtime(); if ($date =~ /sun/i) { bad_hello (); } else { good_hello (); } --------------------cut here-------------------- This program will compile and run all week and then crash on Sunday because bad_function is not defined. Is there a way to have it crash at compile-time so that this bug can be caught before Sunday? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at dbedge.com Thu Feb 24 19:19:14 2000 From: ryan at dbedge.com (Ryan Erwin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: CGI Forms != Tedious ? Message-ID: <008a01bf7f2e$55b658a0$520b91d8@dellbox> I have to setup a whole bunch of web fill in forms for things like licenses, permit applications, job applications, inspection notices and the like. Of course it is the standard CGI -> Database that we all love so much 8-}. Before I get too far down this dull road, I just wondered if anybody has seen/used some kind of module or script that I could use that would make cookie cutter junk like CGI form to database less boring, or at least less time consuming... Any ideas? -- Ryan Erwin - ryan@erwin.org http://ryan.erwin.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ajalis at beryllium.cobaltgroup.com Thu Feb 24 20:22:18 2000 From: ajalis at beryllium.cobaltgroup.com (Asim Jalis) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: CGI Forms != Tedious ? Message-ID: <200002250222.SAA24720@beryllium.cobaltgroup.com> > I have to setup a whole bunch of web fill in forms for things > like licenses, permit applications, job applications, inspection > notices and the like. Of course it is the standard CGI -> > Database that we all love so much 8-}. > > Before I get too far down this dull road, I just wondered if > anybody has seen/used some kind of module or script that I could > use that would make cookie cutter junk like CGI form to database > less boring, or at least less time consuming... > > Any ideas? My next sentence will take us off-topic according to the rules of this list. Have you looked at PHP? (See http://www.php.net) Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at dbedge.com Thu Feb 24 20:55:42 2000 From: ryan at dbedge.com (Ryan Erwin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Perlien - We come in Peace... Message-ID: <01b601bf7f3b$ceb61260$520b91d8@dellbox> I saw this on the Perl Porters list over the fall, but keep forgetting to post it. http://www4.telge.kth.se/~d99_kme/ Hopefully you haven't all seen it... 8-} -- Ryan Erwin - ryan@erwin.org http://ryan.erwin.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Thu Feb 24 21:17:18 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Report on Last Night's Meeting? Message-ID: <20000224191718.A10515@timji.consultix.wa.com> For the benefit of those amongst us who couldn't attend, could somebody (or several somebodies) please give a summary of the key points presented by Dr. Abarbanel in his OOP talk? Thanks, *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | |Classes: 2/29: Int. Perl Programming 3/3: Adv. Pattern Matching w/Perl | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at dbedge.com Thu Feb 24 21:21:02 2000 From: ryan at dbedge.com (Ryan Erwin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Perlien - We come in Peace... == Alien made out of colored Perl Code References: <01b601bf7f3b$ceb61260$520b91d8@dellbox> <20000224191204.A10497@timji.consultix.wa.com> Message-ID: <01f401bf7f3f$58f85480$520b91d8@dellbox> The URL that I posted is a picture of an "Alien" made entirely out of Perl Code that has been made into colored HTML. If you don't have a minute to laugh, don't click on it! ;-} Sorry for being so haphazard but I'm really tired... I shall do no more tired posting to spug-list@... At least not for the rest of the week 8-} : > I saw this on the Perl Porters list over the fall, but keep : > forgetting to post it. : > http://www4.telge.kth.se/~d99_kme/ : > Hopefully you haven't all seen it... 8-} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at dbedge.com Thu Feb 24 21:23:38 2000 From: ryan at dbedge.com (Ryan Erwin) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: CGI Forms != Tedious ? References: <200002250222.SAA24720@beryllium.cobaltgroup.com> Message-ID: <01f601bf7f3f$b559ed60$520b91d8@dellbox> Maybe I should clarify a bit. (story of my day...) The tedious part is just writing the HTML for field after field after field that is just going to be submitted to a little database. I thought that maybe somebody had come up with a way to automatically generate a fill in form, with field sizes and maybe even check/option buttons based on the values of the database that we are inserting records into. For personal safety, thou shalt not speak of PHP on spug-list... 8-} ----- Original Message ----- From: Asim Jalis To: Sent: Thursday, February 24, 2000 6:22 PM Subject: Re: SPUG: CGI Forms != Tedious ? : > I have to setup a whole bunch of web fill in forms for things : > like licenses, permit applications, job applications, inspection : > notices and the like. Of course it is the standard CGI -> : > Database that we all love so much 8-}. : > : > Before I get too far down this dull road, I just wondered if : > anybody has seen/used some kind of module or script that I could : > use that would make cookie cutter junk like CGI form to database : > less boring, or at least less time consuming... : > : > Any ideas? : : My next sentence will take us off-topic according to the rules of this : list. Have you looked at PHP? (See http://www.php.net) : : Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andy at n2h2.com Fri Feb 25 01:39:47 2000 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:07:09 2004 Subject: SPUG: Bad Function Names In-Reply-To: <200002250056.QAA13391@beryllium.cobaltgroup.com> Message-ID: It can't be detected at compile time always because sometimes the function name isn't known until run-time. Witness Perl's OOP ability. The @ISA is searched for a class (package) that defines the function corresponding to the invoked method (message). There are scripts in the B modules that can compile a cross reference of function calls (that are known as subroutine names). That might allow one to analyze a simple script for such potential problems. One could also implement a UNIVERSAL::AUTOLOAD function to provide an ultimate trap for undefined functions. Wait, is UNIVERSAL correct? Does main inherit from UNIVERSAL? Ah well. Whatever. ZZzzzzzzzzzzzzz On Feb 24, 2000 @ 4:56pm, Asim Jalis wrote: > This question was triggered by Bob Abarbanel's excellent ESPUG > presentation last night. > > Suppose I am accidentally calling a function that I have not defined. > I have no desire to use AUTOLOAD. When I run the program it will keep > running until it encounters the function call and then after not being > able to handle it it will give me a run-time error. > > The question is: Can I catch this at compile-time? > > This would be nice to have because otherwise I keep worrying that I > might have typos in my code waiting to explode in production. Is there > a way to catch any of this at compile-time? > > Here is an example: > > --------------------cut here-------------------- > #!/usr/bin/perl > > use strict; > > sub bad_hello { > bad_function ("hi there from bad_hello\n"); > } > > sub good_hello { > print ("hi there from good_hello\n"); > } > > my $date = localtime(); > if ($date =~ /sun/i) { bad_hello (); } > else { good_hello (); } > --------------------cut here-------------------- > > This program will compile and run all week and then crash on Sunday > because bad_function is not defined. Is there a way to have it crash > at compile-time so that this bug can be caught before Sunday? > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > -- Andrew Sweger | N2H2, Incorporated v=206.336.2947 f=206.336.1541 | 900 Fourth Avenue, Suite 3400 Advanced Technologies | Seattle WA 98164-1059 Development | http://www.n2h2.com/ "Wuhaha~~~" -- Heechul - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From pdarley at serviceintelligence.com Fri Feb 25 10:19:58 2000 From: pdarley at serviceintelligence.com (Peter Darley) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: Apache mod_perl behaivior Message-ID: <000401bf7fac$28bde7e0$61ee6fd8@rc-701> Friends, I'm seeing some behaviors with Apache and mod_perl that I can't tell weather it's just the way it works or if I'm doing something wrong. The issues are thus: Perl doesn't seem to undefine or destroy any variables, even ones which are scoped under my() and which I undef when I'm done with them. I understand that mod_perl won't return the memory used, but this seems to be different. The most obvious example of this example is that it doesn't destroy database connections that it uses, so I will eventually get one mySQL process for every procedure I prepare() in each of my scripts, times the number of children I have. This isn't too big a deal, but it doesn't really seem right to me. The other thing I'm seeing is that every time a script is called I get the following error in my /var/log/httpd/error_log file: Database handle destroyed without explicit disconnect at /usr/lib/perl5/site_perl/5.005/Apache/DBI.pm line 119. This is really odd, since it doesn't close the connection to the database. It doesn't seem to cause me any problems, but also doesn't seem right. Thanks for your help! Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Feb 25 13:40:46 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: CGI Forms != Tedious Message-ID: <20000225114046.A12662@timji.consultix.wa.com> There are several higher level abstraction modules that sit on top of DBI/DBD. In the past, I have kludged together my own routines to read some sort of (Konfig =~ s/^K/c/) file and generate from it webforms, perl code to validate the form and [ list-owner note: Majordomo doesn't like to see "^\s*config " in message] sql to do the action (insert/modify/delete). Some CPAN modules that I am interested in, but have not had the time to explore are the DBIx::* stuff. Specifically, DBIx::{Recordset,Easy,AnyDBD} are appealing from their README content. -C. On Thu, Feb 24, 2000 at 05:19:14PM -0800, Ryan Erwin wrote: > I have to setup a whole bunch of web fill in forms for things > like licenses, permit applications, job applications, inspection > notices and the like. Of course it is the standard CGI -> > Database that we all love so much 8-}. > > Before I get too far down this dull road, I just wondered if > anybody has seen/used some kind of module or script that I could > use that would make cookie cutter junk like CGI form to database > less boring, or at least less time consuming... > > Any ideas? > -- > Ryan Erwin - ryan@erwin.org > http://ryan.erwin.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > ----- End forwarded message ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Mon Feb 28 16:36:44 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: Urgent Contract Jobs, telecommuting Message-ID: <20000228143644.A25397@timji.consultix.wa.com> SPUGsters, I spoke to this California guy on the phone this morning; he called my 800 number, and proceeded to speak at lightning speed about their desperate need for immediate help from good Perl programmers. I tried to brush him off, telling him that my company primarily does Perl training, and the only programmers we know live in Seattle, so they wouldn't be interested. His frantic retort was "not even if the money was astronomical?" So apparently they are in dire straits, and willing to pay big bucks for programmers who can start immediately, telecommuting style. I spoke to two different guys in this conversation, both exhibiting the same panicky vibes of acute desperation. Personally, if I were going to get involved with the likes of them, I'd be asking for a sizeable retainer up front - who knows, maybe they don't manage their cash-flow any better than their programming staff! -Tim From: "Vigil, Dan" To: "'spug@halcyon.com'" Subject: Contract Work For PERL Programmers Date: Mon, 28 Feb 2000 13:50:47 -0800 X-Mailer: Internet Mail Service (5.5.2650.21) Hi, My name is Dan Vigil. I spoke to you on the phone earlier today. We are in need of senior level PERL programmers for a multitude of projects we are working on. I cannot immediately provide the specs on the projects, but I wanted to drop you a line with my contact info in case you have anyone in mind that might help. Thanks Dan Vigil www.ivenue.com 562-777-0906 13115 Barton Rd Suite A Whittier, CA 90605 ----- End forwarded message ----- ========================================================== | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | | SPUG Founder & Leader Email: spug@halcyon.com | | Seattle Perl Users Group HTTP: www.halcyon.com/spug | ========================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From matthew at lasarletter.com Tue Feb 29 00:49:24 2000 From: matthew at lasarletter.com (Matthew Lasar) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: Control Z doesn't work either Message-ID: <3.0.1.32.20000228224924.007dfba0@mail.transbay.net> Hi folks: I've been sitting around this evening having a very frustrating time. This program, which I've beening running on Windows 95 via the DOS prompt, comes with instructions from "Leaning Perl" that I should enter my lines and then hit control-D. A friend explained that that's a unix command, and that for DOS I should use control-Z But that isn't actually working either. I enter some strings. I hit control Z, then return, and I get nothing, a blank line. Even "answer" doesn't print. What am I doing wrong? Any thoughts gratefully accepted. thanks, Matthew Lasar #c:\perl -w print "Enter the line number: "; chomp($a = ); print "Enter the lines, end with ^D:\n"; @b = ; print "Answer: $b[$a-1]"; *.* "The absent are always wrong." --French proverb Matthew Lasar 171 Andover Street San Francisco, CA 94110 matthew@lasarletter.com www.lasarletter.com 415-641-1152 415-826-6964 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andyj at microsoft.com Tue Feb 29 02:14:22 2000 From: andyj at microsoft.com (Andy Jacobs) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: Control Z doesn't work either Message-ID: <39ADCF833E74D111A2D700805F1951EF21BE5629@RED-MSG-06> It worked for me on NT (although I didn't enter the beginning "#perl" line nor the *.* line). Here's my transcript (anything not prompted for, I typed - although the "^Z" is where I pressed Ctrl-Z): C:\>perl print "Enter the line number: "; chomp($a = ); print "Enter the lines, end with ^D:\n"; @b = ; print "Answer: $b[$a-1]"; ^Z Enter the line number: 2 Enter the lines, end with ^D: 111 222 333 ^Z Answer: 222 The trick is to enter the Ctrl-Z's on their own line, and press enter just after them. This may not be a requirement in Unix (it's been a while for me). - Andy Jacobs -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Matthew Lasar Sent: Monday, February 28, 2000 10:49 PM To: spug-list@pm.org Subject: SPUG: Control Z doesn't work either Hi folks: I've been sitting around this evening having a very frustrating time. This program, which I've beening running on Windows 95 via the DOS prompt, comes with instructions from "Leaning Perl" that I should enter my lines and then hit control-D. A friend explained that that's a unix command, and that for DOS I should use control-Z But that isn't actually working either. I enter some strings. I hit control Z, then return, and I get nothing, a blank line. Even "answer" doesn't print. What am I doing wrong? Any thoughts gratefully accepted. thanks, Matthew Lasar #c:\perl -w print "Enter the line number: "; chomp($a = ); print "Enter the lines, end with ^D:\n"; @b = ; print "Answer: $b[$a-1]"; *.* "The absent are always wrong." --French proverb Matthew Lasar 171 Andover Street San Francisco, CA 94110 matthew@lasarletter.com www.lasarletter.com 415-641-1152 415-826-6964 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tgy at chocobo.org Tue Feb 29 11:50:33 2000 From: tgy at chocobo.org (Neko) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: Control Z doesn't work either In-Reply-To: <3.0.1.32.20000228224924.007dfba0@mail.transbay.net> Message-ID: On Mon, 28 Feb 2000, Matthew Lasar wrote: > I've been sitting around this evening having a very frustrating time. This > program, which I've beening running on Windows 95 via the DOS prompt, comes > with instructions from "Leaning Perl" that I should enter my lines and then > hit control-D. A friend explained that that's a unix command, and that for > DOS I should use control-Z But that isn't actually working either. I enter > some strings. I hit control Z, then return, and I get nothing, a blank > line. Even "answer" doesn't print. The problem may be that Win/Dos thinks control-Z means "discard the first line" among other things: C:\>perl -e "print <>" a b c d ^Z b c d You can get around this by outputting an extraneous initial newline: C:\>perl -e "print qq/\n/, <>" a b c d ^Z a b c d -- Neko - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mmertel at ix.netcom.com Tue Feb 29 12:20:27 2000 From: mmertel at ix.netcom.com (Mark Mertel) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl built with static or dynamic loading Message-ID: <00022910211702.00293@mmertel3> all, is there an easy command-line option to determine hether perl has been built with static or dynamic loading ? thanks mertel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jeremy at weezel.com Tue Feb 29 13:00:10 2000 From: jeremy at weezel.com (Jeremy Devenport) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl built with static or dynamic loading References: <00022910211702.00293@mmertel3> Message-ID: <38BC1739.340963C2@weezel.com> You may want to investigate the output of perl -V Jeremy Mark Mertel wrote: > > all, > > is there an easy command-line option to determine hether perl has been built > with static or dynamic loading ? > > thanks > > mertel > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jimfl at colltech.com Tue Feb 29 13:11:18 2000 From: jimfl at colltech.com (jimfl) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl built with static or dynamic loading In-Reply-To: <00022910211702.00293@mmertel3> Message-ID: <568294.3160811478@erdos.nwest.attws.com> --Quoth Mark Mertel On Tuesday, February 29, 2000 10:20 AM -0800: > is there an easy command-line option to determine hether perl has > been built with static or dynamic loading ? If you should be able to find evidence of this in the Config variable lddlflags. From the command line, you can: perl -V:lddlflags and from inside a perl program use Config; if ($Config{lddlflags} =~ /shared/) {} In general, you should be able to look for a '-shared' or a '-static' flag, but this might not be foolproof dependinf upon what compiler/loader was used to build perl. -- Jim Flanagan Collective Technologies jimfl@colltech.com http://www.colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mmertel at ix.netcom.com Tue Feb 29 14:49:49 2000 From: mmertel at ix.netcom.com (Mark Mertel) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl -V help - and tn3270 Message-ID: <00022912512003.00293@mmertel3> thanks all for educating me on the merits of perl -V. now, just curious, but has anyone had some experience with tn3270 emulation via PERL ? can it be done ? mertel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Tue Feb 29 19:20:39 2000 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: Job Opening Message-ID: <20000229172039.A977@timji.consultix.wa.com> Seeking two (2) senior level Perl programmers for permanent positions with an e-commerce company, with offices located in Bellevue. You will be part of a smaller team working with a 3rd party package (Interwoven) to do Perl scripting to be embedded within Interwoven. The company has several lines of business, this group will be developing information/media websites for internal clients. Experience in Oracle, Solaris and/or Linux environments is a plus. The company offers stock options and ESOP. Salary is dependant upon experience. The work will be conducted on-site, not a telecommuting position. Initial travel to the Bay area to work with Interwoven personnel is likely. This travel will be periodic for the first month or two. After that travel is expected to be very minimal. Please email your resume, in word format, and to: David Clark declark@kforce.com Sincerely, David E. Clark Technical Recruiter kforce.com, powered by Romac International <<...>> Toll Free: (800) 347-5356 Office: (425) 454-6400 x3319 Fax: (425) 688-0154 Cellular: (425) 985-0114 500 - 108th Avenue NE, Suite 1780 Bellevue, WA 98004 declark@kforce.com We are changing our name from Romac International to kforce.com. This change better reflects our new value added service. By combining the power of the internet with our 37 years in the specialty staffing industry and 2,300 full time professionals, we will better serve your interests. Our 109 offices are not going away, just being enhanced by the kforce.com internet presence. Whether seeking for qualified individuals or a better job, we at kforce.com can help you achieve your goals. For general information about Romac/kforce.com including our history, values, and what we do, go to the Romac link below: www.romac.com To register on kforce.com, go to the kforce.com link below: www.kforce.com When registering please list me, David Clark, as your representative. ----- End forwarded message ----- -- *========================================================================* | Tim Maher, PhD Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc Email: tim@consultix-inc.com | | UNIX/Linux & Perl Training http://www.consultix-inc.com | |Classes: 2/29: Int. Perl Programming 3/3: Adv. Pattern Matching w/Perl | *========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From darren at u.washington.edu Tue Feb 29 19:40:51 2000 From: darren at u.washington.edu (Darren Stalder) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl built with static or dynamic loading In-Reply-To: Mark Mertel's message of "Tue, 29 Feb 2000 10:20:27 -0800" References: <00022910211702.00293@mmertel3> Message-ID: <8iaekjo4bg.fsf@broca.biostr.washington.edu> Mark Mertel, in an immanent manifestation of deity, wrote: >is there an easy command-line option to determine hether perl has been built >with static or dynamic loading ? Something that I would expect would work: $ perl -MDynaLoader -e 1 If DynaLoader isn't available as a module, then Perl is statically bound. Something else that might work but might give you false positives on the dynamic side: $ perl -V:d_dlopen This will tell you (under Unix and friends at least) if it is possible to dynamically load a shared object. This would generally mean that Perl has been built dynamically, but it wouldn't be required; it would just be weird not to. Darren -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ced at carios2.ca.boeing.com Tue Feb 29 21:14:37 2000 From: ced at carios2.ca.boeing.com (Charles DeRykus) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl built with static or dynamic loading Message-ID: <200003010314.TAA17144@carios2.ca.boeing.com> > Something that I would expect would work: > $ perl -MDynaLoader -e 1 > If DynaLoader isn't available as a module, then Perl is statically > bound. > Something else that might work but might give you false positives on the > dynamic side: > $ perl -V:d_dlopen > This will tell you (under Unix and friends at least) if it is possible > to dynamically load a shared object. This would generally mean that > Perl has been built dynamically, but it wouldn't be required; it would > just be weird not to. Wouldn't this be definitive... ? (I'm presuming perl will undef usedl if test loading fails) perl -MConfig -e 'print $Config{usedl} ? "yes\n" : "no\n"' -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From torin at daft.com Tue Feb 29 22:18:02 2000 From: torin at daft.com (Darren/Torin/Who Ever...) Date: Wed Aug 4 00:07:10 2004 Subject: SPUG: perl built with static or dynamic loading In-Reply-To: Charles DeRykus's message of "Tue, 29 Feb 2000 19:14:37 -0800 (PST)" References: <200003010314.TAA17144@carios2.ca.boeing.com> Message-ID: <87hfertjb9.fsf@perv.daft.com> Charles DeRykus, in an immanent manifestation of deity, wrote: >Wouldn't this be definitive... ? (I'm presuming perl >will undef usedl if test loading fails) > >perl -MConfig -e 'print $Config{usedl} ? "yes\n" : "no\n"' Uhm. Yes. I even specifically looked for that and didn't see it. Thanks... Darren -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address