RE: Can't locate loadable object for module ...
Margit Brunder wrote .. I've written a cgi script and when Apache (version 1.3.6) tries to call it, I get the error message can't locate loadable object for module HTML::Parser in @INC at ./HTML/entities.pm line 79 although the module Parser.pm IS in the same directory as entities.pm The path where Parser.pm is located is included in @INC !! because the module name is HTML::Parser then the Parser.pm module has to be in the HTML subdirectory of one of the @INC directories so if you're 'use'ing the HTML::Parser module from within '/some/directory/HTML/entities.pm' then the directory '/some/directory' would have to be in @INC you say that '/some/directory/HTML' is in @INC .. in that case when you type use HTML::Parser; then Perl is looking for '/some/directory/HTML/HTML/Parser.pm' and will obviously not find it hope that's clear - it can be a little confusing at first references: perldoc perlmod perldoc -f require perldoc -f use -- jason king In Spearfish, South Dakota, if three or more Indians are walking down the street together, they can be considered a war party and fired upon. - http://dumblaws.com/
RE: doubt about do/until
[EMAIL PROTECTED] wrote .. In http://www.cpan.org/doc/FMTEYEWTK/is_numeric.html, ( Is it a number? ), Tom Christiansen writes: --- If you do care about getting 0's, then do this: do { print Number, please: ; $answer = STDIN; if ($answer == 0 $answer ne '0') { print Bad number\n; } } until $answer; --- I tried this with ActiveState perl version 5.005_03. I entered 0 and got a bad number. After thinking awhile, I chomped the $answer. This works for 0, ( i.e. No Bad number message and the loop repeats ). I think we need a chomp there ( so instead of '0\n' ne '0', it is '0' ne '0' ). Is it so or am I missing something? you haven't missed anything .. the code should definitely have a chomp in there I notice that the copyright notice is 1996 .. so perhaps my memory is failing me and that there was a version of Perl where STDIN did NOT grab the line-ending character as well .. otherwise Tom really is human and has made a mistake :) basically any of the samples where a string comparison is done should be chomping STDIN before the comparison because while the numeric comparison will ditch the trailing garbage (which in this case is LF) the string comparison obviously will not -- jason king In Spearfish, South Dakota, if three or more Indians are walking down the street together, they can be considered a war party and fired upon. - http://dumblaws.com/
RE: Perl script not running
David Olbersen wrote .. On Thu, 31 May 2001, Henk Klos wrote: I have just downloaded and installed the latest version of Perl for WinNT. Followed all the instructions, associated .pl with perl.exe, etc etc. However, not one sample htm file from the eg directory is working. What did I forget??? Did you forget that .htm files are HTML and not Perl files? there are a number of HTML examples included with Perl perl/eg/IEExamples client-side PerlScript examples perl/eg/aspSamples server-side Perl/ASP examples perl/eg/Core/cgi server-side standard CGI examples the two server-side sets of examples require a web server to be running on the machine and for the user to run them via a http:// URL .. the client-side samples can be run straight from Windows Explorer -- jason king In Spearfish, South Dakota, if three or more Indians are walking down the street together, they can be considered a war party and fired upon. - http://dumblaws.com/
RE: Perl Certifications and some help
Elaine -HFB- Ashton wrote .. King, Jason [[EMAIL PROTECTED]] quoth: *Sanchit Bhatnagar writes .. * * Is there something like a Perl Certified Professional or *does there exists some other credible certification you can *get for perl. * *competency Yes, well, how does one judge who is competent when one is not competent in what one is judging? Unfortunately, in most Perl circles, mentioning the C-word is almost as enjoyable and as worthwhile as an emacs v. vi war. because Perl people understand that 'certification' ne 'competency' Much of the arguments against certification stem from the seeming uselessness of the MS* certifications and the like. However, there are a few linux certification programs that have cropped up recently that, after taking the on-line test quiz, may have merit and be a model for others such as Perl to emulate. my argument against certification stems from the fact that any monkey can learn how to pass a test .. but that is not necessarily an indication of their competency in a field third parties reliance on certification as an indication of competency is often mislaid I suggested a while back that there should be a few on-line tests for people to take, especially students, that would help judge their own progress with learning Perl or for pointing out weaknesses...but it would seem the popular misconception and ill will towards the C-word still prevails. self-tests are usually very valuable .. and I don't think anyone would argue that testing yourself is a worthwhile exercise that can improve learning .. because there's no motivation to cheat the test but when another party relies on your results then there will always be people who learn how to pass the test - rather than how to program the language -- jason king In Nevada, it is still legal for a person to hang another for killing their dog on their own property. - http://dumblaws.com/
RE: Fileposting
Bernhard writes .. Hi! I'm using a html form, where you can enter a file (a picture) and upload it, but when i send the form the Perl script only gets the local Adress of the file, but not the Data (so the picture) of the file. How can i save the picture in a new file on my Disk? I have programmed it so that the new file will be saved in a new Folder. if you use the standard CGI module that's shipped with the later versions of Perl then that parameter is both the filename and a filehandle to the file contents as well since version 2.47 of CGI.pm there's an additional method called 'upload' which explicitly retrieves the filehandle see the CGI documentation for an example of the file-upload mechanism references: perldoc CGI -- jason king In Denmark, if a horse carriage is trying to pass a car and the horse gets uneasy, the car is required to pull over and stop. If necessary to ease the horse down, you are required to cover the car up. - http://dumblaws.com/
RE: Perl Certifications and some help
Sanchit Bhatnagar writes .. Is there something like a Perl Certified Professional or does there exists some other credible certification you can get for perl. competency Also can someone please provide me help and/or links which have tutorials (maybe a single para) on the perl's function map and grep. a single para we can do - Perl has that itself .. perldoc is installed when you install Perl on most operating systems .. type the following at a command prompt to see the help perldoc -f map perldoc -f grep -- jason king In Denmark, if a horse carriage is trying to pass a car and the horse gets uneasy, the car is required to pull over and stop. If necessary to ease the horse down, you are required to cover the car up. - http://dumblaws.com/
RE: Connecting to NT Servers
Steven Riley writes .. I'm new to the list and usually like to lurk for a while before asking questions but I've been faced with a problem which I'm struggling to find an answer. Can someone supply help or a URL to help me connecting to an NT server? Basically I want to connect to several servers over the internal LAN and find a file... if the file exists then I want to delete it. Not sure about the best way to do this... any help would be greatly appreciated. Perl understands UNC paths and will invisibly open directories on remote machines if you use the path .. so to find a file I'd recommend using the File::Find module in conjunction with the an array of UNC paths that you want searched .. eg. #!perl -w use strict; use File::Find; find( \wanted, $_) for ( '\\\server1\share1', '\\\server2\share2'); sub wanted { lc $_ eq 'some_file_name' # case insensitive for Windoze print(Deleting: $File::Find::name\n) unlink $File::Find::name; } __END__ references: perldoc File::Find perldoc -f unlink -- jason king In Spearfish, South Dakota, if three or more Indians are walking down the street together, they can be considered a war party and fired upon. - http://dumblaws.com/
RE: cgi-bin
justin todd writes .. Can anyone tell me if with IIS on NT4.0 you need to create a cgi-bin or if you set the file permissions through the IIS Manager? there are two things that you need to do 1. in the IIS admin the directory that you're using as your scripting directory needs to have 'Script' access (on the properties sheet for that directory) .. the common wisdom is to have it as a separate virtual directory 2. the directory itself needs to have RX (Read, Execute) permissions for the account that IIS is using to access the files (usually something beginning with IUSR_) -- jason king In Norway, you may not spay your female dog or cat. However, you may neuter the males of the species. - http://dumblaws.com/
RE: Broken Argument passing after downgrade
Murray Webster writes .. --- ok --- C:\PERL561perl systest2.pl a123 b432 @ARGV contains: a123 b432 Received a123, b432 --- ok - haven't created association yet 8-( --- C:\PERL561systest2.pl a321 g554 The system cannot execute the specified program. --- create association for .pl -- c:\perl561\bin\perl.exe --- NOT ok, arguments don't get into script! C:\PERL561systest2.pl a998 b009 @ARGV contains: Use of uninitialized value in concatenation (.) or string at C:\PERL561\SYSTEST2 .PL line 6. Use of uninitialized value in concatenation (.) or string at C:\PERL561\SYSTEST2 .PL line 6. Received , the association should be like this c:\perl561\bin\perl.exe %1 %* %1 maps to the first argument .. ie. the filename .. so it's in quotes to enable the execution of perl programs with spaces in the filename then %* maps to all the remaining arguments .. without the %* the arguments are not passed to perl.exe check your file association to see if it has the above format .. the earlier versions of Perl (earlier than about 5.005_01) didn't do the mapping properly I'm guessing that the reason the install broke it is because 5.004 will have written its own file association in there .. then 5.6.1 more politely will check to see if there's an association and only put one in if one doesn't already exist in case you don't know .. the file associations are got to in Windows from Windows Explorer .. the Tools menu - select Options or Folder Options .. then click on the File Types tab -- jason king By South Carolina state law, if a man promises to marry an unmarried woman, the marriage must take place. - http://dumblaws.com/
RE: autonumbered data fields in ODBC database.
Kris Cook wrote .. I'm writing a form that inserts into a database table (a header record) with an autonumbered field (system assigned). Ordinarily, the value of the serial field assignment in an SQL database is stored in sqlca.sqlerrd[2], but I can't find any way to reference this in the documentation I have for Win32::ODBC. Does anyone have any ideas how I can get at this value? I need it as part of the foreign key relationship for detail records. different databases have different ways of getting the last inserted autonumber .. if you're using MSSQL it should be stored in the built-in variable @@IDENTITY (that's an SQL variable - not a Perl array) .. so once you've done your insert you should be able to immediately do a SELECT @@IDENTITY AS 'Id' and then grab it from the rowset of that command -- jason king By South Carolina state law, if a man promises to marry an unmarried woman, the marriage must take place. - http://dumblaws.com/
RE: useful scripts
Richard KHOO Guan Chen wrote .. Just wondering if there is a site which have useful simple perl scripts for totally clueless people like me to look at? I am actually interested in trimming mail headers (save subject, from etc) for storage http://www.cpan.org/ -- jason king In Georgia, you have the right to commit simple battery if provoked by fighting words. - http://dumblaws.com/
RE: Upgrading perl problems ?
Anshu Anshu writes .. I have one small doubts and I want to share with you to make sure. I was using old version of perl5 and couple of scripts were using DBD, DBI, Time modules. Recently I did upgrade the perl5 version 5.005_03 (with Sun package ). Will upgarding the perl version will break something ? Because I found that the scripts are not running properly. Its not able to pull data from Oracle server. I did also try upgrating DBD and DBI with latest version, It didn't help. Have you come with such issues ? Any guess ? better than a guess .. packages that rely on binary or compiled components (like DBI) must be compiled specifically for the version of Perl that they're to work with so .. once you've upgraded your version of Perl you will need to reinstall your binary packages .. you can see the Perl packages that are installed with the perllocal file references: perldoc perllocal -- jason king It is illegal to annoy a bird in any city park of Honolulu, Hawaii. - http://dumblaws.com/
RE: passing part of an array to a function
Gary writes .. The whole point of using references was so that I didn't want to keep copying array slices. This script will be handling nearly 1500 program source files totalling almost 750k lines of code. Any further help would be appreciated. so here's the thing .. Perl doesn't have pointers .. only references .. so you can't have a 1500 element array and grab a reference to the 700th element .. because references don't work that way .. pointers work that way - but there aint no pointers in Perl so .. you have two choices 1. copy the elements that you want into a new memory location and send a reference to that memory location into your subroutine (clearly non-ideal) 2. send the reference to the entire array into your subroutine and just work with it .. you would also probably want to pass in the start index and end index (or length if that's more helpful) .. eg. sub file_control { my( $line, $start, $end) = @_; for my $index ( $start..$end) # process each line in array section { # assign line to a localised $_ for convenience local $_ = $line-[$index]; next if (/^ [\/\*]/); # ... etc. } } -- jason king It is illegal to annoy a bird in any city park of Honolulu, Hawaii. - http://dumblaws.com/
RE: passing part of an array to a function
Peter Scott writes .. At 10:44 AM 5/17/01 +1000, King, Jason wrote: so here's the thing .. Perl doesn't have pointers .. only references .. so you can't have a 1500 element array and grab a reference to the 700th element Oh yes you can: my @foo = qw(three blind mice); my $elemref = \$foo[2]; yes .. sorry - I phrased that badly .. I meant that you couldn't grab a reference to an array starting at the 700th element -- jason king It is illegal to annoy a bird in any city park of Honolulu, Hawaii. - http://dumblaws.com/
RE: :Cookie not setting cookie with Internet Explorer
Fernando Munoz writes .. You are probably right, but it works!.. the fact of the problem however, is that the cookie is not set on Internet Explorer, and I can not figure it out. so .. you say that I'm probably right .. so it's probably correct that Netscape is executing a different program to IE .. then how is it a mystery that one program works in Netscape and another different program does not work in IE ?? not sure what was lost here in the communication .. but you MUST change the line of code that I indicated previously .. that code you had will not retrieve the value of the cookie -- jason king It is illegal to annoy a bird in any city park of Honolulu, Hawaii. - http://dumblaws.com/
RE: Using SSL and Perl to Gather Process Information
Ken Hammer writes .. I need to write a perl script that will gather system information from remote machines. I must communicate to the remote machines using SSL. I'm thinking I can use the Socket method to accomplish this, but I have had little luck in figuring it out. Can anyone point me in the right direction? CPAN has a number of SSL modules .. you should just search for SSL on the seach page http://search.cpan.org/ -- jason king It is illegal to annoy a bird in any city park of Honolulu, Hawaii. - http://dumblaws.com/
RE: Beginners Database Question
Eric B. Leslie wrote .. I'm experimenting with putting a db backend on everything. What I've learned I am able to make a perl script that can access it and manipulate data for it but there's one key item I'm stumped on. What I'm trying to do is have the main content of the website be pulled off my database because there are tables with links leading to other pages that are visible on every page. See http://www.bentonsystems.com/repetios/. It would be a drag to have to update the links on every single page in my website. Without making a script that generates every single page, is there a way to call a script from inside an html document to place the content there. This may be way out of my league, but I can't find any documentations about this. Is there some other route I must take, like using PHP or javascript? Thanks everyone else seems to be overlooking the obvious and/or getting ahead of themselves .. from what you're saying you're looking for a way to include the output of a Perl program inside a web page what I think you're after are called Server Side Includes (or SSIs for short) .. they're available for most web servers .. and the syntax is generally the same (or similar) for all web servers at least under IIS and Apache the following will embed the output of the Perl program main_table.pl from the /cgi-bin directory in the body of the web page htmlheadtitleSSI Example/title/head body !--#include virtual=/cgi-bin/main_table.pl -- /body/html -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/
RE: CR LF with UNIX and Windows (DOSish?)
David Falck writes .. I tested something similar to your suggestion. I created the customer record on my laptop's Windows98 OS, and also on my web site's UNIX OS. Then I read one record and without chomp-ing (removing the input record separator), got the length for the record. On both operating systems, the length was 304. (No idea!) But I had to assign 2 to the $newline variable when on Windows for the seek to work -- seeking the record with an offset from the beginning of the file. I still haven't figured that one out. My record is 303 and length of record returns 304. Why... I just don't know. on Win32 - when you read the file in using a text filehandle (ie. you have not 'binmode'd it by using the binmode function) then Perl converts the OS's native line-ending sequence to \n internally in Perl for everyone's convenience so .. once you've read it in - all the CRLFs have been converted to LFs .. hence the match between UNIX and Win32 byte counts HOWEVER .. within the file itself - there are still CRLFs in Win32 and plain LFs in UNIX .. so the seek needs to take this into account .. because it's acting directly on the file buffer references: perldoc -f binmode perldoc -f seek -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/
RE: DBI and MS Access????
Mark Martin writes .. I'm looking for the quick and painless (idiots guide) instructions to connect to an MS Access database running on NT from a Digital UNIX machine. Need to knows: What DBD:: ?? needs installing How should the database handle look seeing as how there is no instance for an Access DB : $dbh1 = DBI-connect( dbi:??:??, username, password ) . Do I need some software for this? you must need some other software .. MS Access is not a database server .. so you can't connect to it remotely like you can to other databases .. it requires an engine on the local machine to be running so that the data can be served on Microsoft OSs this will be the JET engine or ADO or something like that .. on UNIX you will need an engine to basically act as the database server with the MS Access database file as it's data store I don't know whether such a thing exists - but hopefully you can find it now if it does exist -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/
RE: flock
Jeff Pinyan writes .. On May 14, Brian Shoemaker said: The Perl 5 book I have says flock function doesn't work in Windows systems. I don't want to create a lock file each time someone accesses a file and then have to delete that lock. A rather clever way to emulate locking is to use mkdir() and rmdir(). Although it requires you to create a lock file, it's atomic and safe. are you sure ? .. just because it constitutes one Perl statement doesn't mean that it's atomic .. I suspect mkdir has several steps internally if you're sure then can you please provide references to the atomicity of mkdir .. because it's a great find if it's truly atomic - many peopl believe there to be no atomic file locking operation on Win9x machines -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/
RE: flock
Jeff .. you wrote .. On May 15, King, Jason said: A rather clever way to emulate locking is to use mkdir() and rmdir(). Although it requires you to create a lock file, it's atomic and safe. are you sure ? .. just because it constitutes one Perl statement doesn't mean that it's atomic .. I suspect mkdir has several steps internally if you're sure then can you please provide references to the atomicity of mkdir .. because it's a great find if it's truly atomic - many peopl believe there to be no atomic file locking operation on Win9x machines Here are some references: http://www.davin.ottawa.on.ca/archive/modperl/2000-09/msg00683.phtml http://mail-index.netbsd.org/tech-security/1997/03/24/0010.html http://mail.gnu.org/pipermail/info-cvs/2000-December/011597.html none of those references deal with whether mkdir on Win32 is atomic or not .. certainly I agree that it's atomic under BSD and GNU based systems .. but the only mention of Win32 in those references leaves the hanging question Of course, then the question is... is mkdir() atomic on Win32 Perl.. They say that mkdir() is atomic ON A SERVER -- if you're on an NFS, all bets are off. The Perl Cookbook mentions the mkdir+rmdir locking scheme. I think that's a pretty safe bet. actually .. the references (and specifically the Cookbook example) are talking specifically about locking over NFS (where flock often does not work) .. hence the name of the Cookbook section Program: netlock but nothing conclusively answers the question about Win32 mkdir .. and even more damning .. nothing mentions the Win(Me|98|95) flavours of Win32 where flock is not atomic and therefore I would hazard a guess that mkdir is non atomic (especially with the whole long-filename issue) on Win32 the mkdir() function is implemented with a call to _wmkdir .. you'd have to show me some references to this function and whether it was an atomic operation before I'd trust it on Win32 -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/
RE: Can you print directly to the default printer?
Amarnath Honnavalli Anantharamaiah writes .. It is quite interesting. I am curious to know how do you print to a network printer ? Please excuse me if I am asking a dumb question. never had to .. if I had to I'd probably want to format the printed output a little better than ASCII can do .. so I'd probably use OLE to setup a Word document and print from Word (I'm assuming - of course - that we're still talking Win32 as per the original query) there's a Net::Printer module available on CPAN for UNIX line printers .. talks to port 515 on the network printer .. this might work for Win32 printers .. but I doubt it .. and even if it did - then it's unlikely to be pretty if I were you - I'd use Word (or some other printer enabled program) to print .. notepad for example has a /p option .. so you can write a temporary file and print it using notepad (which will use the default printer) none of the solutions are very tidy -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/
RE: CR LF with UNIX and Windows (DOSish?)
David Falck writes .. Is there a programmatic way to tell if I'm on Windows or UNIX? I know that $^0 returns the name of the operating system, but can I count on matching /MS/i or /Win/i to determine if it's Windows? If Windows, I'll assign 2 to $newline below, else I'll assign 1. it completely depends on the build process of that version of Perl .. I think that Cygwin has a different string than the standard (ActiveState) build for ActiveState's Perl build it is guranteed to literally match 'MSWin32' on all Microsoft Win32 platforms .. these are currently Windows95 Windows98 WindowsMe WindowsNT 3.51 WindowsNT 4.0 Windows2000 and will soon include WindowsXP hence your code (assuming ActiveState Perl) would be my $newline = ( $^O eq 'MSWin32' ? 2 : 1 ); but check to see what the Cygwin build produces (using perl -V and looking at the osname value) references: perldoc perlvar | grep -A10 $OSNAME perl -V | grep osname -- jason king By South Carolina state law, if a man promises to marry an unmarried woman, the marriage must take place. - http://dumblaws.com/
RE: how to stamp the date onto a log file name.
Peter Lemus writes .. Please provide an example on how I can create the log file of a perl script, something like MMDD.log. I'll like to use the current Month, Day, and Year. well .. assuming that your program is only run once (ie. two copies can't be running at the same time - so there are no locking issues) .. the following will open a log file my($day,$month,$year) = (localtime)[3..5]; open LOG, ''. sprintf( '%02d%02d%4d' = $month+1, $day, $year+1900) or die Bad open: $!; # then you would just print to the LOG filehandle print LOG Here's a log message\n; -- jason king In Fort Madison, Iowa, the fire department is required to practice fire fighting for fifteen minutes before attending a fire. - http://dumblaws.com/
RE: newbie: CPAN module usage.
SS HK writes .. I would like to install some of the CPAN modules. How can I do that. I am using ActivePerl on Windows. Any pointers would be greatly helpful. while others have mentioned 'ppm' which should be your first port of call .. there are only a limited number of modules (albeit the commonly used ones) that have been made available via ppm so .. if you need to grab a module from CPAN then you will need nmake.exe for building the modules .. in some instances you will also need a C compiler nmake comes with Microsoft Visual C++ .. which also has nmake .. so if you have access to that then install it otherwise .. you can get a free version of nmake from Microsoft .. which will mean that you will not be able to install any modules that require compilation .. but you can install pure Perl modules (which accounts for a fairly high proportion) I'm not going to tell you where the free nmake is because you'll learn a lot more than I'm telling you here by reading the ActivePerl documentation - which also tells you where to find nmake get to the ActivePerl documentation on your Start Programs menu .. read the section of the ActivePerl FAQ entitled Modules Samples .. and then read all the rest of the FAQ .. it has all the information you need (one hint: where it talks about gzip and tar - you can use WinZip for both untarring and ungzipping the archives) -- jason king In Denmark, if a horse carriage is trying to pass a car and the horse gets uneasy, the car is required to pull over and stop. If necessary to ease the horse down, you are required to cover the car up. - http://dumblaws.com/
RE: Very beginner question
[EMAIL PROTECTED] writes .. (name = john) - if I am trying to just extract john for the value $b, why would the following script not work. I thought it would take bothIt returns the full (name=john) #!user/local/bin/perl -w open TRY , try.txt; while (TRY) { (my $b=$_) =~ s/^(\() (\w+)/$2/; print $b; } in the name of TMTOWTDI while(TRY) { chop( my $name = substr $_, rindex( $_, ' ')+1); print $name, \n; } but I suspect (from the statement about the output being '(name=john)') that those spaces might not always be there .. in which case while(TRY) { /=\s*(.*)\)/ print $1, \n; } -- jason king In Denmark, if a horse carriage is trying to pass a car and the horse gets uneasy, the car is required to pull over and stop. If necessary to ease the horse down, you are required to cover the car up. - http://dumblaws.com/
RE: @INC
Stephen E. Hargrove writes .. On Thu, 10 May 2001, King, Jason wrote: Stephen E. Hargrove writes .. how do i add new directories to @INC? i've managed to bungle one of my debian systems, and apt-get relies pretty heavily on some .pm's that aren't in the stock @INC locations. there's a hand module called 'lib' that's part of the CORE distribution .. it basically just unshifts your list onto the @INC array in a BEGIN block use lib qw'/dirs/for /inclusion /in/INC'; doesn't this just make the adjustment at compile time? what i'm really needing is something that will modify @INC for all time. can that be done? you need to recompile Perl then .. the directories included in the @INC array are stored in the perl binary when Perl was originally built .. you can't change them without rebuilding Perl if you wanted to avoid hardcoding the @INC directories in every script you write you could put your own module into one of the @INC directories to be called by all your programs - and it would - in turn - load the other @INC directories .. ie. your module might be as follows package my_lib; use lib qw'/dirs/for /inclusion /in/INC'; 1; then in all your programs you'd have #!perl -w use strict; use my_lib; # .. code .. __END__ -- jason king In Denmark, if a horse carriage is trying to pass a car and the horse gets uneasy, the car is required to pull over and stop. If necessary to ease the horse down, you are required to cover the car up. - http://dumblaws.com/
RE: Refresh Button
Helio S. Junior writes .. I would like to know if it's possible to do the following: When the user clicks on the Refresh Button of Internet Explorer and my WebPage refreshes, i also have to 'insert' some information on the TABLES inside the Page. Is it possible to do it? If so, how? Any Sample code? everytime someone refreshes your page your script will be executed again - so you can insert whatever you want .. here's an example that outputs the time on the server in a table... #!perl -w use strict; use CGI; $CGI::POST_MAX = 0; my $q = new CGI; print $q-header, $q-start_html('My test table page'), $q-start_table( { -border = 0 } ), $q-Tr( $q-td( scalar localtime )), $q-end_table, $q-end_html; __END__ -- jason king In Nevada, it is still legal for a person to hang another for killing their dog on their own property. - http://dumblaws.com/
RE: what's wrong in systax
either that or the if (/$TYPETAG/i) is not matching - so the block isn't even being entered .. this would be most likely because even if the match on line 29 doesn't match .. line 30 should still initialise $jobtype to (at the very least) '::' so my guess is that $TYPETAG doesn't appear on the line .. taking a look at its contents - and using my Psi::ESP module .. I'm guessing that it's because its value is !--ategory-- where it should be !--category-- but that's just a guess -- jason king In Hibbing, Minnesota, it shall be the duty of all policemen to kill all cats running at large. - http://dumblaws.com/ -Original Message- From: Jos I Boumans [mailto:[EMAIL PROTECTED]] Sent: Wed 9 May 2001 09:05 To: Anshu Anshu; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: what's wrong in systax from the error msg i conclude that line 29 is not producing a match. You might want to add some print statements to see whats going on there. if it holds meta chars like japhy said, you might also want to try quotemeta $_; so you can be sure all 'special characters' are escaped for the regex. Regards, Jos Bouamns - Original Message - From: Anshu Anshu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, May 08, 2001 11:36 PM Subject: Re: what's wrong in systax Thanks for reply. below is the varibales as defined - $LOCTAG = !--location--; $TYPETAG = !-ategory--; and error message was Name main::JOBDATA used only once: possible typo at gen_job.pl line 14. Name main::CP used only once: possible typo at gen_job.pl line 13. Use of uninitialized value in substitution (s///) at gen_job.pl line 35. Thanks AS - Original Message - From: Jeff Pinyan [EMAIL PROTECTED] To: Anshu Anshu [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, May 08, 2001 5:28 PM Subject: Re: what's wrong in systax On May 8, Anshu Anshu said: 22 while (IF) { 23 if (/$LOCTAG/i) { 24 ($curloc) = /VALUE=([^]+)\s*\w*/i; 25 $location .= ${curloc}::; 26 } 27 28 if (/$TYPETAG/i) { 29 ($curtype) = /VALUE=([^]+)/i; 30 $jobtype .= ${curtype}::; 31 } 32 } 33 close(IF); 34 $location =~ s/::$//; 35 $jobtype =~ s/::$//; It would be much appreciated if you gave us an error message. My guess is that there are characters in $LOCTAG and $TYPETAG that Perl is using as regex characters. Try: if (/\Q$LOCTAG\E/i) { ... } if (/\Q$TYPETAG\E/i) { ... } instead. Or, consider using index() instead: if (index(lc, lc($LOCTAG)) -1) { ... } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734
RE: Perl and WindowsNT
Carl Rogers writes .. I used the opendir() function in my Perl script to point to a folder with 200+ text files for the purpose of extracting data from each file. If I run the script with opendir/readdir pointing to a directory on a shared drive, I'll get to a point where Perl tells me Can't open file- no such file or directory possibly - this is because of network instability .. ie. the network is not available for that file .. you could try putting the open attempt in a loop so that it tries a few times before giving up my $attempts = 100; until( open FILE, $filename) { die qq(Could not open $filename: $!) unless $attempts--; } If I copy the bad file to my home directory, run the same script with opendir/readdir pointing to my home directory now- it can be opened and read. smells of something caused by the share The weird part: If I go back and opendir/readdir to the shared directory, the bad file is all of a sudden working and another file later in the directory becomes the bad file. As the steps are repeated, more files in the shared directory are able to be read. can't explain that other than by saying Windows is weird Question: Is there a feature in WindowsNT that would cause Perl to behave this way? I've tried by changing the properties on the files, and that doesn't seem to help. (BTW: I'm using Perl 5.001running on NT 4.0 SP 6) have you tried upgrading your Perl .. 5.001 - are you sure ??? .. the above code snippet might not work in 5.001 - I don't know when they introduced the post-conditional syntax in any case you should not be running such an old version of Perl .. it is a possible cause of this weird problem you should upgrade to at least 5.005_03 .. but why not 5.6.0 or 5.6.1 .. get the latest version from ActiveState http://www.activestate.com/ -- jason king In Hibbing, Minnesota, it shall be the duty of all policemen to kill all cats running at large. - http://dumblaws.com/
RE: Regex ([^]*)
Clinton writes .. I'm tring to extract some values delimited by quotes I can extract the first set using ([^]*) but not the second set using ([^]*),([^]*). Could I have a clue please? a) you're forgetting the closing quote /([^]*),([^]*)/ b) the while(STUFF) processes one line at a time .. and so assuming that your TEST.TXT is split over a number of lines as you have shown it below - even the first match shouldn't work but I suspect that your data representation below is not accurate .. in which case you really need to provide it accurately for this sort of question CODE use strict; my $file = test.txt; #extract from file my $stuff=e:/$file; open STUFF, $stuff or die Cannot open $stuff for read :$!; while (STUFF) { if (/new Array\\\(\\\);\\nkeyComp\[.+\] = ([^]*)/g){ print $1 \n; } } print END OF FILE; you should probably slurp the whole file into one scalar to do the regex on .. so after the open you'd have something like this my $file_contents = do { local $/; STUFF }; then you'd process $file_contents something like this $file_contents =~ /([^]*),([^]*)/; print [$1] [$2]\n; -- jason king You must pay a fine of $600 in Thailand if you're caught throwing away chewed bubblegum on the sidewalk. If you do not pay the fine, you are jailed. - http://dumblaws.com/
RE: Simple HTML Page
Helio S. Junior writes .. I have a HTML Page in our Intranet. This page contains some tables which i have to update from time to time. The information i have to add to the tables on this page comes from OutLook e-mails. I would like to add a button on this Page in order to read OutLook e-mails and update this page. Is it possible to do it with Perl? Any sample code? I've never done it personally and can't point you to any samples of what you want to do specifically .. but it's certainly possible using the OLE interface available to Perl there's a bit of doco on it in the ActivePerl FAQ which is installed by default along with ActiveState's Perl on Win32 .. open the HTML documentation from the Windows Start Programs menu read about how to talk to OLE .. and for a specific Outlook example - in the menu on the left hand side choose Using OLE with Perl and then click the link to the section called How do I create a new folder in Outlook? that will at least get you talking to Outlook .. from there it ceases to be a Perl issue - and becomes an Outlook object model one .. and here I can't help you :) .. I'm not familiar with the object model for Outlook - sorry -- jason king In Norway, you may not spay your female dog or cat. However, you may neuter the males of the species. - http://dumblaws.com/
RE: I am a real begginer to perl......
David Monarres writes .. I am alos fairly new with perl and completely new with perl one liners. I see how you can use regex's on the cmd line to edit a file (sort of sed ish). I tried this $ perl -pe 's/hello/reverse($1)/' -i test all it print's is reverse. I was wondering if you knew of a way to read in a word and reverse it's contents. Not critical but it has intrigued me. perl -pe 's/hello/reverse $/e' -i test perldoc references (type any of the following on the command line): perldoc perlre perldoc perlvar perldoc perlrun -- jason king In Norway, you may not spay your female dog or cat. However, you may neuter the males of the species. - http://dumblaws.com/
RE: Can't figure out find()
Ask Bjoern Hansen writes .. On Mon, 30 Apr 2001, Meije Oppenhuizen wrote: I am probably doing something very wrong here, but can someone tell me why #!/usr/bin/perl -w use File::Find; print $arg; open(LISTFILE, /home/meyeo/testfile) or die Can't open the ffin thingy!; print LISTFILE \n; close(LISTFILE); find (\wanted, $arg); sub wanted { # this should print all the files in the serving directory (including subdirs)! open(LISTFILE, /home/meyeo/testfile) or die Can't open the ffin thingy!; print LISTFILE $_\n; close(LISTFILE); } I can't see why it works differently in different places, but something like this would be MUCH more efficient: #!/usr/bin/perl -w use strict; use File::Find; my $arg = shift @ARGV; my @files; find (sub { push @files, $_ }, $arg); open LISTFILE, outputfile or die Could not open outputfile: $!; print LISTFILE join \n, @files; close LISTFILE; of course, that will have to keep a list in memory of all the files it has read so far. If that's a problem, then you can change it so it will call a flush_list function every 5000 file or something and clear the @files array. or you could just open the filehandle before the call to find - then print to it within the find .. eg. #!/usr/bin/perl -w use strict; use File::Find 'find'; my $arg = shift;# shifts @ARGV by default open LISTFILE, 'outputfile' or die Bad open: $!; find( sub { print LISTFILE $_\n }, $arg); close LISTFILE or die Bad close: $!; # check closes on write handles __END__ NB: I didn't test the above code .. so excuse any typo syntax errors -- jason king In Norway, you may not spay your female dog or cat. However, you may neuter the males of the species. - http://dumblaws.com/
RE: execute at win2k system command with options.
Casey West writes .. On Wed, May 02, 2001 at 05:37:27PM -0400, Casey West wrote: : On Wed, May 02, 2001 at 03:16:41PM -0700, Peter Lemus wrote: : : Hi, : : I'm having some trouble trying to execute the followin : : command from a perl script. : : rmdir /s /q username #this works from the command line : : in win2k. : : I tried: : : system 'rmdir /s /q $user' # no luck. Any : : suggestions? : : My first suggestion is to look at the '$?' variable, it holds the : error code for system() calls. : : system( romdir /s /q $user ) || dir $?; dir??? Casey, that's supposed to be die(), dummy. and 'romdir' is surely meant to be 'rmdir' .. someone needs some sleep ;) still the question remains - why call out to the system when the same thing can be done in Perl perldoc File::Path -- jason king In Norway, you may not spay your female dog or cat. However, you may neuter the males of the species. - http://dumblaws.com/
RE: Question on optimizing this sub (help!)
Shawn writes .. Can someone look at a subroutine for me? Specifically, after this (at bottom of email) subroutine runs, it increases my RSS by 6 megs, and shouldn't do that. (here it has indexed 133798 files) this is normal Perl behaviour - welcome to an interpreted language .. check out the Perl FAQ .. it will have been installed on your system with perl .. type the following at the command prompt perldoc -q free.*array -- jason king In New York, a fine of $25 can be levied for flirting. This old law specifically prohibits men from turning around on any city street and looking at a woman in that way. A second conviction for a crime of this magnitude calls for the violating male to be forced to wear a pair of horse-blinders wherever and whenever he goes outside for a stroll. - http://dumblaws.com/
RE: finding common records between two files
Mike Stussie writes .. I'm a newbie to perl and trying to solve a problem.. Here is what I'm trying to do: read thru flat file 'A' that looks something like this:(fields delimited by '::') BCSNDTJN::Joe User::1 N. Main::Anytown::MO::None::None::None::Unknown::[EMAIL PROTECTED] and find any duplicates based on the email address that might be in flat file 'B'. I want to take the duplicates and output it to another file so that I can administer it later. I found something in the camel book relating to hashes that might do the trick but how do I get the flat file into a hash. excuse me if I've misunderstood - but you seem to be having fun working through things yourself and seem to be just looking for a solution to the how do I read a file into a hash question .. rather than a solution to the whole thing so I'll just provide that - in case solving it all will be wrecking your fun (let me know if I've guessed wrong .. because it's a very simple program to show you) also .. your description is unclear .. but I'm assuming that flat file 'B' contains just email addresses .. eg. [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] so .. here's the trick .. you use the map function to create a new list where the lines from 'B' are the keys and you just give them a true value (we're using 1 here) open IN, 'B' or die Bad open: $!; my %check = map { chomp; $_ = 1 } IN; so .. if the above example email addresses were in 'B' then now you'd have the following hash $check = ( '[EMAIL PROTECTED]' = 1, '[EMAIL PROTECTED]' = 1, '[EMAIL PROTECTED]' = 1 ); so hopefully your camel example will now enable you to look through 'A' checking whether the email address is a duplicate -- jason king In New York, a fine of $25 can be levied for flirting. This old law specifically prohibits men from turning around on any city street and looking at a woman in that way. A second conviction for a crime of this magnitude calls for the violating male to be forced to wear a pair of horse-blinders wherever and whenever he goes outside for a stroll. - http://dumblaws.com/
RE: Perl and NT
Matt Blatchley writes .. Does anyone know of a way to use perl and CGI to have the following: html page w/ form to get stdin from the user for username and password.(basic), pass the variables to the perl script which then modifies permissions for a specific folder on NT and allows the user to then have access to a particular folder after having the password emailed to the user... yes you can do it .. but the CGI program (be it Perl or ASP/vbscript) will only have the security privileges of whatever account the web server is configured to access the CGI directory as this is usually a builtin account called something like IUSR_machinename and it's usually only a Guest .. because Guests can't change permissions on directories then you'll run into problems once you've changed that account then you have to be REALLY careful with the programs that you write and the web server in general (especially with WebDAV now in IIS5) because users will have higher privileges on your system to actually change the permissions you can use a Perl module called Win32::FileSecurity which ships with the standard distribution of Win32 Perl .. or you can just call cacls.exe with the system command .. it's a WinNT utility for change the ACL (permissions) -- jason king In New York, a fine of $25 can be levied for flirting. This old law specifically prohibits men from turning around on any city street and looking at a woman in that way. A second conviction for a crime of this magnitude calls for the violating male to be forced to wear a pair of horse-blinders wherever and whenever he goes outside for a stroll. - http://dumblaws.com/
RE: cookies and web
Jeff K.V. Bhavnanie writes .. How do i go about accepting a cookie from a web login site? in a cookie jar I use LWP to do a POST, but i can't login as the server sends a cookie. Is there a generic Login perl script lines? Login to a web site, send username password, accept cookie then the rest of the POST forms send that cookie back? nope .. no generic one .. but it's pretty simple .. if you're not already - then you'll need to start using LWP::UserAgent (rather than LWP::Simple) then check out the documentation perldoc LWP::UserAgent search for cookie and you'll see the cookie_jar method .. and a reference to HTTP::Cookies .. check the documentation for that too perldoc HTTP::Cookies it's pretty simple Hint: test cookie scripts first on the command line - it's MUCH easier to see and debug the output -- jason king In New York, a fine of $25 can be levied for flirting. This old law specifically prohibits men from turning around on any city street and looking at a woman in that way. A second conviction for a crime of this magnitude calls for the violating male to be forced to wear a pair of horse-blinders wherever and whenever he goes outside for a stroll. - http://dumblaws.com/
RE: running gzip with the system function
lance turner writes .. I'm trying to use the system function to run the gzip program with the following line of code: $status = system(gzip $filename); where $filename is the file that is to be compressed It isn't working and a status of 65280 is being returned. return codes from system are left shifted by 8 (so that other codes can be included in the mask) .. so to get the real return code you have to shift right perldoc -f system 65280 8 is 255 .. depending on your system - this return code could mean anything my guess is that it means that the system couldn't find the 'gzip' program .. try putting an explicit path to gzip in your program .. get the explicit path in what I guess is a *nix system with which gzip on the command line alternatively there's an Archive::Zip module on CPAN that will allow you to do the zipping in Perl http://search.cpan.org/search?dist=Archive-Zip -- jason king A Canadian law states that citizens may not publicly remove bandages. - http://dumblaws.com/
RE: Win32 Configuration - Basic Question
Helio S. Junior writes .. Does anyone know how to configure a Win2k Web Server? What do i have to do in the Web Server and on my machine in order to be able to write CGI Applications? I have got the Win32 port of Perl from ActivePerl. when you install ActiveState's Perl .. if there's a Default Web Site in IIS (which there is unless you've deleted it) then the installation will do everything you need so that any file with extension .pl in the /scripts directory will run as a CGI for more information - see the ActiveState HTML documentation (there'll be a link to it on your Programs menu) .. assuming that you're installing the latest release from ActiveState there's an excellent section on configuring an IIS 4.0 server .. the same holds true for IIS5 on Win2k here's a test CGI application for you (it just prints out all the HTTP variables) #!perl -w use strict; print Content-type: text/html\n\n; print $_ = $ENV{$_}br\n for sort keys %ENV; __END__ -- jason king A Canadian law states that citizens may not publicly remove bandages. - http://dumblaws.com/
RE: Subroutine and Functions
Phillip Bruce writes .. I like to know if subroutines and Function should be placed in any particular order in perl. What is commonly practiced? Can anyone give me some examples. generally subroutines are placed after the main body of code being run .. I usually put them in the order that I wrote them (for what I hope are obvious reasons) there are examples in all the standard libraries included with perl .. check out the two directories /path/to/perl/lib and /path/to/perl/site/lib -- jason king A Canadian law states that citizens may not publicly remove bandages. - http://dumblaws.com/
RE: Maps and Perl
Alex Stanciu writes .. I`ve got a question for you all. I`m trying to make an online map using Perl and PerlMagick, but as I found, it`s too slow for my machine, so I`m looking for another solution. Anyone here tried this? I saw a nice online map at www.nj.com , and I`d really like to know how to make the centering and the zooming faster then this one, with PerlMagick. allow me to suggest that this is not a 'beginners' question and that you will find better and more numerous responses to your question in the comp.lang.perl.misc newsgroup -- jason king A Canadian law states that citizens may not publicly remove bandages. - http://dumblaws.com/
RE: Error.pm
Alberto Manuel Brandao Simoes writes .. I've donwloaded a module from CPAN (CORBA::ORBit) but it requires Error ('require Error') and there is any Error.pm in the system. Can anybody explain what can I do to put it working? I think removing the line will do the trick, but I would like to know what's this require Error purpose. the best idea in situations like this is to read the file that comes with the module distribution called README that file is called README to encourage people to read it because it often contains important or vital information about using or installing the module in this case - your question is answered in that README file .. check it out -- jason king In Georgia, you have the right to commit simple battery if provoked by fighting words. - http://dumblaws.com/
RE: CPAN Question
Phillip Bruce writes .. Sometime back some one gave me the path to a config file in which told cpan where and what compilers that my systems uses. Does anyone have any ideas to this. /path/to/perl/lib/Config.pm -- jason king A Canadian law states that citizens may not publicly remove bandages. - http://dumblaws.com/
RE: Error opening file?
Billy Joedono writes .. Below is a piece of code central to my problem. I've used this a lot of time without problem, but on this occasion, it fails me. Whenever I run the script, it ends with the error bash: ./test.pl: No such file or directory. The funny thing is, if I activate the debug option (use #!/usr/bin/perl -d) and step through the code, it does what I want, no errors given there. can you run it manually by passing it to the interpreter perl test.pl ? the permissions should be (at least) 755 .. ie. chmod 755 test.pl but you're right .. the fact that it works in the debugger should mean that's not the problem I assume that you aren't doing anything crazy like having a blank line before the shebang line .. because obviously that'll also create problems (but you'd have to be really crazy to delete the blank line when adding the '-d' option) other than ensuring that the shebang line is correct (again - you'd have to be crazy to be changing it without realising when you add the '-d' option) there doesn't seem to be anything obvious -- jason king A Canadian law states that citizens may not publicly remove bandages. - http://dumblaws.com/
RE: Another regular expression question?
Part 1 the [] are just enclosing paired delimiters .. the substitution operator is commonly used like this s/foo/bar/ but those '/' delimiters are just convention .. it can also be s#foo#bar# or in fact any matching characters (that don't appear unescaped within the regex or substitution) s qfooqbarq bracketing constructs are treated a little differently .. in that instead of matching the same character - they match the enclosing pair .. eg. s(foo)(bar) and those can be nested .. eg. s(foo(foo)foo)(bar) this will turn this string blah foo(foo)foo blah into this string blah bar blah you usually use the same brackets for the regex part of the substitution as for the replacement part .. but you don't have to .. you can mix brackets s(foo){bar} or as bbking wrote s{foo}[bar] Part 2 perl parses the operator s/// whenever it sees it in context .. so the following will make a substitution $_ = 'blah foo blah'; s qfooqbarq; but the following will not $_ = 'blah foo blah'; @x = qw/s qfooqbarq/; as with any piece of Perl code - it depends on the context as to what perl does with it -- jason king In Hibbing, Minnesota, it shall be the duty of all policemen to kill all cats running at large. - http://dumblaws.com/ -Original Message- From: Amarnath Honnavalli Anantharamaiah [mailto:[EMAIL PROTECTED]] Sent: Tue 24 Apr 2001 21:06 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Another regular expression question? I still have two question about the regexp used 1. What is [] at the end of the regexp 2. As you said perl lets us to chose any other thing other than slashes in s///. But do we have to specify in particular what is the delimiter Or does it take by default any charecter next to =~ s as delimiter Regards, Amar -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, April 20, 2001 5:39 PM To:[EMAIL PROTECTED] Subject: RE: Another regular expression question? [EMAIL PROTECTED] said... I don't know how this works, But I have seen this regexp comparison it in perlop man pages. It has been very good regexp. Can anyone explain this for me. I'll add some comments that may help explain some of what was left out: #! /usr/bin/perl # open the file open(fileHandle, Cfile) || die can't open the file ; # read the file in scalar while(fileHandle) { # This is the Perl idiom for while there # are still lines left in the file... $program .= $_; # This adds the current line (including # the newline at the end) to the variable # called $program. At the end of this loop, # $program contains the entire file living # named 'Cfile'. } # Delete (most) C comments. $program =~ s { /\* # Match the opening delimiter. .*? # Match a minimal number of characters. \*/ # Match the closing delimiter. } []gsx; # This is a variation on the s///; operator, which replaces # the thing between the first two slashes with the thing between # the last two slashes. Perl lets you choose something other than # a slash, if you want. This regex matches C comments, by looking # for /* (the '*' is a wildcard, so you have to 'escape' it by # putting a backslash in front of it) -- followed by as few characters # as possible (.* means anything, zero or more times, '?' means # do this only until the next thing comes up). The next thing in # this regex is */ - the closing delimiter of C comments. Again, you # have to escape the splat, so that Perl doesn't treat it specially. # # after the [], the 'g' means match globally, that is, look # for as many matches as you can. # the 's' means treat the input as a single line. That is, don't # stop looking for a match when you hit a newline. # the 'x' means let me have comments in my regex. print $program
RE: Perl documentation
Amarnath Honnavalli Anantharamaiah asks .. How do I get help on some modules like what are services available in particular module say NET::FTP etc etc all command-line distributions of Perl ship with a utility called perldoc .. for modules like Net::FTP you should be able to type the following at a command prompt
RE: Perl documentation
Amarnath Honnavalli Anantharamaiah asks .. How do I get help on some modules like what are services available in particular module say NET::FTP etc etc all command-line distributions of Perl ship with a utility called perldoc .. for modules like Net::FTP you should be able to type the following at a command prompt -oops- .. damn send button you should be able to type the following perldoc Net::FTP for more information on perldoc type perldoc perldoc -- jason king No children may attend school with their breath smelling of wild onions in West Virginia. - http://dumblaws.com/
RE: Header files dilemma!
from my experience in c.l.p.misc some people take those bibliographies as a disguised RTFMs .. I'd love to see it for all posts - but am afraid at how some beginners might interpret it -- jason king No children may attend school with their breath smelling of wild onions in West Virginia. - http://dumblaws.com/ -Original Message- From: Nutter, Mark [mailto:[EMAIL PROTECTED]] Sent: Mon 23 Apr 2001 22:51 To: '[EMAIL PROTECTED]' Subject: RE: Header files dilemma! I hope this helps, and don't forget to read: perldoc perlmod perldoc perlmodlib perldoc constant perldoc Exporter Ooo, a bibliography at the end of the specific advice -- that's a *great* idea for a beginners list. We should make that a convention :)
RE: print with = ??
David Gilden writes .. Sorry to ask this, as I am quite new at this. And the online class that I am just now finishing has lots of bad code for examples! From this list: print '$file' = '$newfile'\n; ^ What does this line mean, this a renaming convention? there's no renaming happening .. it's a print statement .. basically it's of the form print some text; see the double-quotes in the original statement .. they tell Perl to print everything in between the quotes and perform variable interpolation on the way .. so both $file and $newfile will have their values substituted for them in the string the single quotes are within the double quotes - so they're just part of the print output and the = is just a sequence of two characters that will also be printed (although it means other things in other contexts) this is all because there are double-quotes around everything .. so as far as Perl is concerned - it's just a string to be printed -- jason king No children may attend school with their breath smelling of wild onions in West Virginia. - http://dumblaws.com/
RE: quick PERL question
M.W. Koskamp writes .. The special variable $| sets the autoflush. See PERLVAR documentation. Whats this person does is a dirty way of setting $| to a true value (not 0 or undef). Default = 0. why do you say 'dirty' ? .. do you just mean 'less readable' ? .. or are you implying some other problem with $|++ ? -- jason king No children may attend school with their breath smelling of wild onions in West Virginia. - http://dumblaws.com/
RE: print statment
David Gilden writes .. Original from the class: print input type=\checkbox\ name=\delete\ value=\yes\ checked\n; Is this bad style? yep .. avoid backwhacks at all costs - that's my opinion print 'input type=checkbox name=delete value=yes checked',\n; better? yep .. much better print 'input type=checkbox name=delete value=yes checked'. \n; also good - but generally accepted as inferior to the second snippet I do believe that these 3 statements are all equivalent. nope .. but the differences are subtle .. the first one is essentially equivalent to the last one .. but the one with the comma is different in that it passes two parameters as a list to the print function and can be affected by the built-in variable $, to see the difference try this code snippet $, = '_wow_'; print 'foo', 'bar', \n; print 'foo'. 'bar'. \n; but - use of $, is pretty rare and usually discouraged and the second snippet that you showed is the best of the three even better is to realise that double-quotes are operators .. specifically they're shorthand for the qq// operator .. in other words the following two are EXACTLY equivalent to Perl print foobar\n; print qq/foobar\n/; so .. when you want to include double-quotes AND have the string interpolated you can do this print qq/input type=checkbox name=delete value=yes checked\n/; also note that the '/' character is not the only delimiter that you can use .. you can use anything .. so the following are all equivalent to the above print qq#input type=checkbox name=delete value=yes checked\n#; print qq*input type=checkbox name=delete value=yes checked\n*; print qq|input type=checkbox name=delete value=yes checked\n|; even the rather obfuscated print qq qinput type=checkbox name=delete value=yes checked\nq; you can even use bracketing constructs and Perl will pair them up .. so the following works a treat print qq(some more parens () in here - perl isn't fooled\n); Manual Refereces: Quote and Quote-like Operators section of perlop manual -- jason king No children may attend school with their breath smelling of wild onions in West Virginia. - http://dumblaws.com/
RE: BerkeleyDB
Jeffrey wrote .. new to the list and will likely see plenty that will help; but here's something specific to my explorations now. I'm doing some development and testing for production and have pretty well decided Perl-Perl/Tk and Berkeley DB will best serve my purpose. This after exploring the DBI with DB2 (DBI is fine, but DB2 is overkill for many reasons), and other 'SQL'-like DBs/interfaces. Here's the difficulty: finding Perl-specific info/guide (ie more than Perl's BerkeleyDB mod papers) to help me under- stand the techniques and functions I'll need to write (or crib from CPAN) for the several kinds of record updates I need to perform. Sleepycat docs repeatedly mention BDB's ability to handle 'insert, delete, update recs' but I can't find a darn thing that explicitly and broadly says anything about updating recs, which is my main concern. The Perl/DBI book touches on using Berkeley DB to a minor degree but with using DB_File for 1.85. It's a start but I'm running out of places to look to find more info. Anybody know of anything? I've been through all the links at the Perl sites I know about. I'd be grateful for any steerage. Thank I think you're underestimating your abilities :) I mean this in the nicest way - I wouldn't consider what you're talking about to be a beginner's topic .. so you might not find that you'll receive the best answer here (I certainly have no idea) it seems like a perfect question for the comp.lang.perl.misc newsgroup .. I'm sure you'll find people there who can steer you correctly take a look at the sorts of topics that this list deals with .. it's much more basic than how to deal with the Perl/BDB interface -- jason king In Spearfish, South Dakota, if three or more Indians are walking down the street together, they can be considered a war party and fired upon. - http://dumblaws.com/
RE: cat a file
Frank .. my answer has nothing to do with Perl .. but you can also use the standard Windows copy command to do this copy foo.txt + bar.txt c:\temp\baz.txt that having been said - I don't think that you can combine two PST files by just concatenating them .. I suspect that they have headers and such - being a binary file you will probably have to use Outlook to combine them -- jason king In Norway, you may not spay your female dog or cat. However, you may neuter the males of the species. - http://dumblaws.com/ -Original Message- From: blowther [mailto:[EMAIL PROTECTED]] Sent: Fri 20 Apr 2001 09:12 To: 'Peter Scott'; Drain, Frank; Beginners (E-mail) Subject: RE: cat a file Something like this will work. perl -pe "" foo.txt bar.txt c:\temp\baz.txt It's disappointing that perl -p foo.txt bar.txt c:\temp\baz.txt doesn't work. It thinks foo.txt is the perl script to execute. -Original Message- From: Peter Scott [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 2:34 PM To: Drain, Frank; Beginners (E-mail) Subject: Re: cat a file At 04:27 PM 4/19/01 -0400, Drain, Frank wrote: Hello, I am very new to perl. I have two pst (personal folder files) that I want to combine into one. I know how to use cat in Linux. How do do this same operation in perl under windows? # cat. Usage, e.g. perl cat .pl file1 file2 file3 while () { print } -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com