Re: scheduling
man cron Cheers, Kevin On Tue, Jan 08, 2002 at 08:07:04AM -0600, Camilo Gonzalez ([EMAIL PROTECTED]) said something similar to: Unix IRIX -Original Message- From: Matthew Keen [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 7:28 PM To: 'Camilo Gonzalez'; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: scheduling Camilo, What operating System are you ftp'ing from ??? -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 8 January 2002 9:46 AM To: '[EMAIL PROTECTED]'; Camilo Gonzalez Cc: [EMAIL PROTECTED] Subject: RE: scheduling How can I find out about cron? -Original Message- From: fliptop [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 4:30 PM To: Camilo Gonzalez Cc: [EMAIL PROTECTED] Subject: Re: scheduling Camilo Gonzalez wrote: Anyone know of a module or method that will run a Perl script on a given time each day? I need to FTP a file from one site to another daily and I was hoping to automate it. can you write a cron job to do it? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- [Writing CGI Applications with Perl - http://perlcgi-book.com] I mean, there needs to be a wholesale effort against racial profiling, which is illiterate children. -- G.W. Bush, 2nd Presidential Debate 10/11/2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 Q's, Google and Me - can you spell it out?
Dear Poec or others, I followed the instructions, but the *.cgi fails to generate an output. What did I do wrong? Try www.voelspriet.nl/spriet.cgi to see the error. This is the content of the script: #!/usr/bin/perl -wT use strict; use CGI qw/:standard/; use URI::Escape; # if we came from the form, grab the values and create the URL if ( param ) { # get the form data # see perldoc CGI my $_prefix = param( 'prefix' ) || ''; my $_search = param( 'search' ) || ''; # untaint it # see perldoc perlsec my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create appropriate regex my ( $search ) = ( $_search =~ /^([a-zA-Z\d\s_:]+)$/ ); #create appropriate regex # escape characters with special meaning in URIs # see perldoc URI::Escape $prefix = uri_escape( $prefix ); $search = uri_escape( $search ); print redirect( http://www.google.com/search?q=$prefix%20$search; ); } # otherwise, print the Web page else { print header; print END_HTML; !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head titleTest page/title /head body form action=spriet.cgi method=get input type=checkbox name=prefix value=allintitle: / All in titlebr / input type=text name=search / input type=submit name=Submit / /form /body /html END_HTML } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBI
Robert, I tried doing exactly what you told and got the following error: LoadLibrary(C:\Perl\site\lib\auto\dbd\oracle\oracle.dll) failed. GetLastError returns 0x0485 What does it mean? Thanks, Yegi --- Robert Howard [EMAIL PROTECTED] wrote: The .dll file may need to be re-registered. Try doing the following, and adapt for your particular flavor of Windows: Win9x/NT: 1) Go to Start, Find, Files or Folders. 2) In the Named field, type: regsvr32.exe, Oracle.dll. 3) In the Look In field, make sure it is set to root C: 4) Click Find Now. 5) 2 files should be found (more than one regsvr32 may be found, but we will be interested in the one in the Windows\System Directory. 6) Drag the Oracle.dll icon on top of the regsvr32.exe icon. You should get a message saying that the register succeeded. 7) To ensure that everything is loaded properly, reboot the computer, and then see if you still get the same error message again. Let me know if that helps, R.A. Howard -Original Message- From: Yegneshwar Virupakshan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 12:14 PM To: [EMAIL PROTECTED] Subject: DBI Hi Guys, I have problem in connecting to Oracle using the DBD::Oracle module. I have installed the following components in my PC. 1. Oracle 8i client 2. ActivePerl 5.6.1.630 3. DBI using ppm3 4. DBD-Oracle using ppm3 I can do tnsping to the Oracle Server and also connect to it using sqlplus session. But when I connect to Oracle Server using a small perl program, it gives the following error. -- install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Orac le.dll' for module DBD::Oracle: load_file:One of the library files needed to run this application cannot be found at C:/Perl/lib/DynaLoader.pm line 206. at (eval 1) line 3 Compilation failed in require at (eval 1) line 3. Perhaps a required shared library or dll isn't installed where expected at a1.pl line 5 -- The Oracle.dll which the error mentions is present in the required directory. Any help would be appreciated. Thanks, Yegi __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I just wanna dump a file to the browser as plain text
--- Jeremy Vinding [EMAIL PROTECTED] wrote: I fell incredibly stupid that I can't get such a simple thing to work. I'm trying to display the source of XML files without allowing IE to parse them, but it still is parsing it:( Jeremy, Welcome to the wonderful world Violating Standards! Microsoft, in their less-than-infinite wisdom, decided that their browsers will ignore the Content-type header and instead examine the beginning of the document sent over to determine the type. There is nothing you can do about this. However, you can cheat. Translate the characters that might cause HTML trouble (e.g., all of the tags in XML :) and use an HTML document. Here's one way (untested, but it should put you on the right path): #!/usr/bin/perl -wT use strict; use CGI qw/:standard/; use HTML::Entities; my $xml; open XML, somedoc.xml or die $!; { local $/; $xml = XML; } close XML; $xml = encode_entities( $xml ); print header, start_html( -title = An XML Document ), pre( tt( $xml ) ), end_html; Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
perldoc formatting issues
When I use perldoc (e.g. perldoc -f open), I see stuff like this: You may use C after CEgt, CEgtEgt, CElt, C+ Egt, C+EgtEgt, and C+Elt. How can I make it display those formatting codes properly? Also, is there a way to make it color code things, so that e.g. C and L are colored differently? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Filehandle problem
Hi, I have been trying to run a piece of perl code in NT that I usually run in UNIX. I am showing the part of code where I am facing the problem. open (CPP, $cmd |); while (CPP) { chomp(); # Remove CR's from the input s/\r//g; when the code attempts to go in the while loop it throws off an error: Too many files specified It exits the program after this. I am running this piece of script in cygwin window. Can anyone point as to why this problem seem to be coming. K.srinivas _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file
Hi, how is possible know if a file is open in read/write by another process ??? Thanks Walter _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A tk question
I think thath is a problem of implementation of TK on Win/DOS. On Linux with Gnome Desktop i'm tries something script with TK, opening new window by a button, without problem. if you post all the code is best... Walter I have a TK issue. This code creates the initial TK box. use vars qw/$TOP/; $TOP = Tk::MainWindow-new; $TOP-title('blah blah'); $TOP-configure(-background = lc('PeachPuff1')); etc.(a lot more code) When the user clicks the button of his choice, the TK box disappears into the task bar. When the user clicks the task bar on the program's name, a window of a DOS screen pops up and asks the user Enter Perl Script to execute. The code is below. $TOP-iconify; $TOP-withdraw; print \nEnter Perl Script to execute: ; $pgm = STDIN; chomp($pgm); etc. The question we are having. Why do it in 2 steps. 1: Click the TK button. 2: Clikc the Task bar. Why not do it one step if possible? Can the Dos screen pop up right away after the button is clicked? If you need more of the code let me know. Thank you. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Filehandle problem
well, i'm guessing, from the error msg that you got that you have: Too many files specified what is in $cmd? are you sure it's a command NT or Cygwin understand? what happens if you just run the $cmd on a prompt? why don't you check the return value of open? if it fails, what's in $! ? in short, we'll need a bit more information to help you out, but try the above things first... hth, jos - Original Message - From: K.Srinivas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 9:50 AM Subject: Filehandle problem Hi, I have been trying to run a piece of perl code in NT that I usually run in UNIX. I am showing the part of code where I am facing the problem. -- -- open (CPP, $cmd |); while (CPP) { chomp(); # Remove CR's from the input s/\r//g; -- -- when the code attempts to go in the while loop it throws off an error: Too many files specified It exits the program after this. I am running this piece of script in cygwin window. Can anyone point as to why this problem seem to be coming. K.srinivas _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Password ---- cgi-perl-html
The way that I have done this in the past is to set a cookie after the initial authentication. On all pages that require authentication you check for the cookie and validate that it hasn't been tampered with. If this check fails you redirect the user to the login page. To prevent tampering you can 'sign' the cookie with a hash value (You might want to use the MD5 module for this) and then verify the data with the signature. Peter C. Two bits is exactly one fourth of eight bits -Krang -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
PGPLOT module compile problem
Hi, there is a nice perl package, called PDL, which uses PGPLOT.pm I have PDL running, but I only get the Trio output. The PGPLOT output isn't working. Has anyone installed the PGPLOT perl module, and sucessfully run the tests? I can compile it fine but it chokes when I run the tests. I have communicated with the author, and he has come to the conclusion that my library somehow was compiled improperly. BUT the pgplot (c program) demos all run fine, with the same compiler and library. I recently upgraded to gcc 3.0.3 from the 2.95 that came with suse7.2, it compiled the c pgplot fine, but the perl PGPLOT fails to run. ## The author has done some tests with me on this, and the fundamental problem stems from these results: On his working machine, when he does nm /usr/lib/libcpgplot.a | grep -i cpgdraw he gets cpgdraw.o: 0004 T cpgdraw when I do it I only get cpgdraw.o ## Below is the author's requested debugging info. The only error was during the make, where it asks to provide a prototyping behavior for PGPLOT.s perl Makefile.pl # Loaded ExtUtils::F77 version 1.14 Found compiler g77 ExtUtils::F77: Using system=Linux compiler=G77 Checking for gcc in disguise: Compiler is gcc version 2.95.3 20010315 (SuSE) Runtime: -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3 -L/usr/lib -lg2c -lm -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3 -lgcc ExtUtils::F77: Validating -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3 -L/usr/lib -lg2c -lm -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3 -lgcc [ok] ExtUtils::F77: Compiler: g77 ExtUtils::F77: Cflags: -O Checking if your kit is complete... Looks good Writing Makefile for PGPLOT # make ### mkdir blib mkdir blib/lib mkdir blib/arch mkdir blib/arch/auto mkdir blib/arch/auto/PGPLOT mkdir blib/lib/auto mkdir blib/lib/auto/PGPLOT mkdir blib/man3 cp PGPLOT.pm blib/lib/PGPLOT.pm /usr/bin/perl -I/usr/lib/perl5/5.6.0/i586-linux -I/usr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.0/ExtUtils/typemap -typemap typemap PGPLOT.xs PGPLOT.xsc mv PGPLOT.xsc PGPLOT.c Please specify prototyping behavior for PGPLOT.xs (see perlxs manual) cc -c -I/home/aaossm/kgb/soft/pgplot/bld -I/usr/local/pgplot -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -pipe -DVERSION=\2.18\ -DXS_VERSION=\2.18\ -fpic -I/usr/lib/perl5/5.6.0/i586-linux/CORE PGPLOT.c Running Mkbootstrap for PGPLOT () chmod 644 PGPLOT.bs LD_RUN_PATH=/usr/local/pgplot:/usr/X11/lib:/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3:/usr/lib cc -o blib/arch/auto/PGPLOT/PGPLOT.so -shared -L/usr/local/lib PGPLOT.o -L/usr/local/pgplot -L/usr/local/lib -lcpgplot -lpgplot -L/usr/openwin/lib -L/usr/X11/lib -L/usr/X11R6/lib -lX11 -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3 -L/usr/lib -lg2c -lm -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3 -lgcc chmod 755 blib/arch/auto/PGPLOT/PGPLOT.so cp PGPLOT.bs blib/arch/auto/PGPLOT/PGPLOT.bs chmod 644 blib/arch/auto/PGPLOT/PGPLOT.bs Manifying blib/man3/PGPLOT.3pm ### # perl -Mblib test.pl # Using /home/zentara/perlmodules/PGPLOT-2.18/blib == Running test1.p == Can't load '/home/zentara/perlmodules/PGPLOT-2.18/blib/arch/auto/PGPLOT/PGPLOT.so' for module PGPLOT: /home/zentara/perlmodules/PGPLOT-2.18/blib/arch/auto/PGPLOT/PGPLOT.so: undefined symbol: cpgdraw at /usr/lib/perl5/5.6.0/i586-linux/DynaLoader.pm line 200. at test1.p line 3 Compilation failed in require at test1.p line 3. BEGIN failed--compilation aborted at test1.p line 3. == Running test2.p == Testing advanced point and line plot routines... PGPLOT module version 2.18 Can't locate auto/PGPLOT/pgqinf.al in @INC (@INC contains: /home/zentara/perlmodules/PGPLOT-2.18/blib/arch /home/zentara/perlmodules/PGPLOT-2.18/blib/lib /home/zentara/perllib /usr/lib/perl5/5.6.0/i586-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i586-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at test2.p line 9 == Running test3.p == ... .. these tests go on about 10 times all with the same error (deleted for brevity) They all complain about Can't locate auto/PGPLOT/pgqinf.al in @INC -- $|=1;while(1){print pack(h*,'75861647f302d4560275f6272797f3');sleep(1); for(1..16){for(8,32,8,7){print chr($_);}select(undef,undef,undef,.05);}} -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
'my' for each loop or no ?
Hi, Was wondering which of these 2 pieces of code is more efficient : code1 my $file ; foreach $file (@tarred) { #do something ; } foreach $file (@gzipped) { #do something else ; } /code1 OR code2 foreach my $file (@tarred) { #do something ; } foreach my $file (@gzipped) { #do something else ; } /code2 pv. -- Prahlad Vaidyanathan [EMAIL PROTECTED] drug, n: A substance that, injected into a rat, produces a scientific paper. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Web host interactivity question
Please respond to me directly as well as I have limited list access. I need to know if the following scenario is possible before I put forth the effort. I am running on a Sun server. 1. Read a database for packages which need tracking/delivery information. 2. format an HTML URL request based on carrier specifics. 3. Send the URL request to the carrier's online servers (UPS, fedex for example) 4. Receive back the page with package tracking information 5. Parse the page contents for the tags which will give me the tracking information I need. 6. Update the database with the tracking information 7. Go to step 1 and process the next package. I know I can do steps 1,2,6,7, and probably step 5, but am unsure about steps 3 and 4. Can anyone provide me feedback or examples? Thanks Carlin Anderson Sr. Software Engineer APL Direct Logistics 1301 Riverplace Blvd, Suite 530 Jacksonville, FL 32207 904-858-4754 direct 904-616-6542 cell phone, pager [EMAIL PROTECTED] [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 'my' for each loop or no ?
Hi, could be more efficient the first code, because you allocate, the memory space one single time. In the second code you allocate the memory space every time. Walter Hi, Was wondering which of these 2 pieces of code is more efficient : code1 my $file ; foreach $file (@tarred) { #do something ; } foreach $file (@gzipped) { #do something else ; } /code1 OR code2 foreach my $file (@tarred) { #do something ; } foreach my $file (@gzipped) { #do something else ; } /code2 pv. -- Prahlad Vaidyanathan [EMAIL PROTECTED] drug, n: A substance that, injected into a rat, produces a scientific paper. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PGPLOT module compile problem
On Mon, 07 Jan 2002 20:34:18 -0500, [EMAIL PROTECTED] (Zentara) wrote: Hi, there is a nice perl package, called PDL, which uses PGPLOT.pm I have PDL running, but I only get the Trio output. The PGPLOT output isn't working. Has anyone installed the PGPLOT perl module, and sucessfully run the tests? I can compile it fine but it chokes when I run the tests. I have gotten it to run. It seems my new c compiler, didn't make the g77 compiler properly. Had to redo it all. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 'my' for each loop or no ?
Prahlad Vaidyanathan wrote: Was wondering which of these 2 pieces of code is more efficient : code1 my $file ; foreach $file (@tarred) { #do something ; } foreach $file (@gzipped) { #do something else ; } /code1 OR code2 foreach my $file (@tarred) { #do something ; } foreach my $file (@gzipped) { #do something else ; } /code2 Just try it for your own. Use the Benchmark module from CPAN. But never forget, speed is not so important. (Otherwise you would have used C) Readability comes first. And then of course it's important to avoid useless statements like my $file; which does really nothing more as a declaration. That's why I would prefer: foreach my $file (@tarred) { #do something ; } foreach my $file (@gzipped) { #do something else ; } Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Inline file edit
Folks, looking for a clean way to change a value in a file on the fly before it is processed (ran). I have a perl script that kicks off several resource scripts (.scr) that are NOT a valid shell script and can not be ran from the command line alone. I need a way to modify these .scr scripts on the fly to change 2 values in the script based on user supplied input to the .pl script. IE: user enters a SID of _QAP2, but all the .scr files have a SID of _VALUTEST I need to be able to change the SID in the .scr on the fly before it is ran. Regards, Ron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Stripping records
On Mon, 7 Jan 2002, Wagner-David wrote: If straight text, then could just read the first line and start on the second: my $MyHdrLine = FILEIN; # get first line WHILE ( FILEIN ) { } You have bypassed first line(has carriage return still with it. Now you start your processing. It works, but I want to understand it as well. So, it is taking the first line and storing it in $MyHdrLine, why then does perl start at the second line after that? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to change directory in AIX in Perl ?
Families Laws wrote: I tried to do a change directory and then do a tar of the directory: My program: system(cd /usr/apps); Like Jeff told, use the chdir function (perldoc -f chdir) You should always check the return value of the system command. Note that return 0 is O.K., and every other value is an error: system(tar -cf tarfile.tar DDA/*) and print Error occurred: $! But the best is to use an existent module: Look for the CPAN module Archive::Tar or Archive::Any Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
If...Statement
I am trying to start on a specific line of code and read a sub string of that code and also read the next line in the sequence and a sub string of that line. If either of the values are false then do something. I am using the following code: for(my $i=0; $i22; $i++){WORKFLOW}; #This will put you at row 23. $_=WORKFLOW; my $line=$_; my $nextline=$line++; if ((substr($line, 42, 7) eq Running) || (substr($nextline, 42, 7)eq Running)) Can anyone see what I am doing in correct? Thanks Lance Prais -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: If...Statement
On Jan 8, Lance Prais said: for(my $i=0; $i22; $i++){WORKFLOW}; #This will put you at row 23. $_=WORKFLOW; my $line=$_; my $nextline=$line++; $line is a line of text from the file. Adding 1 to it will not make it the next line of the file. Also, $this = $that++ doesn't do what you might think: $that = 10; $this = $that++; print this=$this, that=$that\n; # this=10, that=11 To get the next line, just say: $nextline = WORKFLOW; And why are you using $_ at all? -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
Does it matter what version of perl is currently running (I am on 5.61), and are there any concerns on using the automatic installation process against a production environment? Does the automatic process pick the right version of the module based on what is already installed? Thanks Carlin Original Message Follows From: [EMAIL PROTECTED] To: TS [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: modules Date: Fri, 5 Oct 2001 12:27:27 +0200 (CEST) On Fri, 5 Oct 2001, TS wrote: I use perl 5.005_03. how do I find out what modules are installed ? $perl -MCPAN -e autobundle This will first search for all installed module. Then it will search the cpan archive for updates... Perhaps you need answere a few question if this is the very first time you connect to CPAN. But it's easy. Just do it:-) and how do I add new modules ?(where are they available?). $perl -e MCPAN -e 'install MODUL_NAME::xxx' this will search the archive after module namedd MODUL_NAME::xxx and install it. If this module need other modules to work ok. The installation prossess will automatic fix this. Karl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: who is the method cop?
-Original Message- From: Gary Hawkins [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 10:35 PM To: [EMAIL PROTECTED] Subject: RE: who is the method cop? Unbelievably, I'm actually walking around not fully understanding one or more of these: Blessed variables Class methods Class variables Classes Fubars Functions Global variables Instance methods Methods Objects Package variables Packages Properties Subroutines Zebras Is there a simple yet comprehensive explanation out there with an example of each? Yeah, it's called the Camel book. Buy it. Read it. Cover to cover. If you don't even know what that is, search Google for The Camel Book. Didn't think so. Well, you thought wrong. See above. Anyone want to take the time to explain it? The list helps those who help themselves... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: who is the method cop?
Better yet.. to ease the search and aid in proper development of a future perl user http://www.oreilly.com/catalog/lperl3/ more Perl books can be found here http://perl.oreilly.com/ Regards, Ron -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 10:05 To: 'Gary Hawkins'; [EMAIL PROTECTED] Subject: RE: who is the method cop? -Original Message- From: Gary Hawkins [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 10:35 PM To: [EMAIL PROTECTED] Subject: RE: who is the method cop? Unbelievably, I'm actually walking around not fully understanding one or more of these: Blessed variables Class methods Class variables Classes Fubars Functions Global variables Instance methods Methods Objects Package variables Packages Properties Subroutines Zebras Is there a simple yet comprehensive explanation out there with an example of each? Yeah, it's called the Camel book. Buy it. Read it. Cover to cover. If you don't even know what that is, search Google for The Camel Book. Didn't think so. Well, you thought wrong. See above. Anyone want to take the time to explain it? The list helps those who help themselves... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[ADMIN] CLOSED. Re: who is the method cop?
On Tue, Jan 08, 2002 at 10:05:23AM -0500, Bob Showalter wrote: : : -Original Message- : From: Gary Hawkins [mailto:[EMAIL PROTECTED]] : Sent: Monday, January 07, 2002 10:35 PM : To: [EMAIL PROTECTED] : Subject: RE: who is the method cop? : : : Is there a simple yet comprehensive explanation out there : with an example of : each? : :Yeah, it's called the Camel book. Buy it. Read it. Cover to cover. : :If you don't even know what that is, search Google for The Camel Book. Please watch your tone. : Didn't think so. : :Well, you thought wrong. See above. Please watch your tone, *both* of you. :Anyone want to take the time to explain it? : :The list helps those who help themselves... That is so far removed from the values of this list that I can't even bear to read it. This list is here for people who aren't sure how to help themselves as well. Please read the list FAQ for more information about why that is. This thread is closed. Casey West -- Those parts of the system that you can hit with a hammer (not advised) are called hardware; those program instructions that you can only curse at are called software. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
We choose to manually install our modules for all of our environments. The CPAN module has a tendency to grab the latest and greatest of everything. One nice thing is to use the CPAN.pm to make a 'snapshot' of your modules and make a bundle out of them. Then just install your custom bundle. You'll need to edit the list it makes, as it will bundle all of your standard shipped modules as well. HTH Matt --- Carlin Anderson [EMAIL PROTECTED] wrote: Does it matter what version of perl is currently running (I am on 5.61), and are there any concerns on using the automatic installation process against a production environment? Does the automatic process pick the right version of the module based on what is already installed? Thanks Carlin Original Message Follows From: [EMAIL PROTECTED] To: TS [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: modules Date: Fri, 5 Oct 2001 12:27:27 +0200 (CEST) On Fri, 5 Oct 2001, TS wrote: I use perl 5.005_03. how do I find out what modules are installed ? $perl -MCPAN -e autobundle This will first search for all installed module. Then it will search the cpan archive for updates... Perhaps you need answere a few question if this is the very first time you connect to CPAN. But it's easy. Just do it:-) and how do I add new modules ?(where are they available?). $perl -e MCPAN -e 'install MODUL_NAME::xxx' this will search the archive after module namedd MODUL_NAME::xxx and install it. If this module need other modules to work ok. The installation prossess will automatic fix this. Karl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Import Appointments into Outlook using Perl and vCalendar
Hello all, At our lab we constantly have emails sent out in the form: 7-15 JanTesting of Product X (POC: Joe Smith) Room 265 2 Jan Leaders Meeting (POC: John Doe)Room 121 8 Jan Review (POC: Tom) Room 30 I am trying to take these word documents and create some time of vCalendar file so I can automatically import all of these dates into a personal information manager (such as Outlook or Palm). As it is everyone is laboriously adding these things to their respective calendars or manually inputting this information into Outlook. Does anyone know of a module that takes inputs and generates vCalendar files. Is there a better way to do this? Any thoughts? tim
Re: pull line #1 from a file
On Tue, 8 Jan 2002, Yacketta, Ronald wrote: need some minor help here.. been looking in the Cookbook for an example to pull the first line from a file.. First line? Just read from the file once and then close: open FILE, $filename or die Can't open $filename: $!\n; my $line = FILE; close FILE; Of course, you should make sure $line actually has something in it before trying to use it (testing for definedness). -- Brett http://www.chapelperilous.net/ Waste not, get your budget cut next year. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pull line #1 from a file
open(IN, test) or die $!; $line=IN; close(IN); print $line; Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: Yacketta, Ronald [EMAIL PROTECTED] To: Beginners (E-mail) [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 7:50 AM Subject: pull line #1 from a file Folks, need some minor help here.. been looking in the Cookbook for an example to pull the first line from a file.. Regards, Ron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pull line #1 from a file
so so close... I had this OPEN(FILE, $g_all_sleepy); @lines = FILE; CLOSE(FILE); $lines[0]; # think this is right, its an array.. all arrays start at 0 not 1.. unless # perl is funky and dont ;) -Original Message- From: Casey West [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 10:56 To: Yacketta, Ronald Cc: Beginners (E-mail) Subject: Re: pull line #1 from a file On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote: : :Folks, : :need some minor help here.. been looking in the Cookbook for an example :to pull the first line from a file.. open FILE, filename or die $!; my $line = FILE; close FILE; Remember, FILEHANDLE is something you can iterate over. In scalar context it returns just one line (for all intents and purposes) at a time. Casey West -- Usenet is like Tetris for people who still remember how to read. -- Button from the Computer Museum, Boston, MA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
passing a hash using cgi.pm
Hi. I'm having trouble passing a hash from one program to another through a link using cgi.pm. My first program passes the hash like this (it's actually a hash that is one element of an array of hashes): print pre a ( { -href = http://140.247.111.176/cgi-bin/redundancies.pl?request=%{$clusArrayHash[1]} }, Redundant sequences); The code from my program that receives the hash looks like this: %myHash = param(request); print header, start_html(Results), hr(), h1(Results); for $key (keys %myHash) { print ($key, $myHash{$key}); } print end_html(); And the web page ends up displaying data that looks like this: %{HASH(0x1bc2a60)}, Is there some sort of simple dereferencing that I'm missing? Thanks for any help you can give me, Josiah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pull line #1 from a file
OPEN(FILE, $g_all_sleepy) or die Couldn't open the file; @lines = FILE; CLOSE(FILE); Chomp @lines; $variable = $lines[0]; Scott Ryan OneTel.Net ISP Engineer [EMAIL PROTECTED] 02073319370 -Original Message- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]] Sent: 08 January 2002 16:06 To: [EMAIL PROTECTED]; Yacketta, Ronald Cc: Beginners (E-mail) Subject: RE: pull line #1 from a file so so close... I had this OPEN(FILE, $g_all_sleepy); @lines = FILE; CLOSE(FILE); $lines[0]; # think this is right, its an array.. all arrays start at 0 not 1.. unless # perl is funky and dont ;) -Original Message- From: Casey West [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 10:56 To: Yacketta, Ronald Cc: Beginners (E-mail) Subject: Re: pull line #1 from a file On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote: : :Folks, : :need some minor help here.. been looking in the Cookbook for an example :to pull the first line from a file.. open FILE, filename or die $!; my $line = FILE; close FILE; Remember, FILEHANDLE is something you can iterate over. In scalar context it returns just one line (for all intents and purposes) at a time. Casey West -- Usenet is like Tetris for people who still remember how to read. -- Button from the Computer Museum, Boston, MA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pull line #1 from a file
would this be valid? or should I seek out a cleaner way? system(sed -e 's/'chomp($lines[0])'/'$db_name'/g' ../input/tmp.scr $g_logpass); just looking to replace line one in the file with a user supplied value. I have like 23 files to parse and change per run based on user input. -Original Message- From: Yacketta, Ronald Sent: Tuesday, January 08, 2002 11:06 To: [EMAIL PROTECTED]; Yacketta, Ronald Cc: Beginners (E-mail) Subject: RE: pull line #1 from a file so so close... I had this OPEN(FILE, $g_all_sleepy); @lines = FILE; CLOSE(FILE); $lines[0]; # think this is right, its an array.. all arrays start at 0 not 1.. unless # perl is funky and dont ;) -Original Message- From: Casey West [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 10:56 To: Yacketta, Ronald Cc: Beginners (E-mail) Subject: Re: pull line #1 from a file On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote: : :Folks, : :need some minor help here.. been looking in the Cookbook for an example :to pull the first line from a file.. open FILE, filename or die $!; my $line = FILE; close FILE; Remember, FILEHANDLE is something you can iterate over. In scalar context it returns just one line (for all intents and purposes) at a time. Casey West -- Usenet is like Tetris for people who still remember how to read. -- Button from the Computer Museum, Boston, MA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pull line #1 from a file
That should work. The big problem with it is you are creating an array which contains the contents of the whole file. Then using only the first element of that array and ignoring the rest. Depending on the size of your file you could be wasting huge chunks of memory. -Original Message- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]] Sent: 08 January 2002 16:06 To: [EMAIL PROTECTED]; Yacketta, Ronald Cc: Beginners (E-mail) Subject: RE: pull line #1 from a file so so close... I had this OPEN(FILE, $g_all_sleepy); @lines = FILE; CLOSE(FILE); $lines[0]; # think this is right, its an array.. all arrays start at 0 not 1.. unless # perl is funky and dont ;) -Original Message- From: Casey West [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 10:56 To: Yacketta, Ronald Cc: Beginners (E-mail) Subject: Re: pull line #1 from a file On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote: : :Folks, : :need some minor help here.. been looking in the Cookbook for an example :to pull the first line from a file.. open FILE, filename or die $!; my $line = FILE; close FILE; Remember, FILEHANDLE is something you can iterate over. In scalar context it returns just one line (for all intents and purposes) at a time. Casey West -- Usenet is like Tetris for people who still remember how to read. -- Button from the Computer Museum, Boston, MA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: If...Statement
I am not sure, but I think it has to do with $nextline=$line++; It sounds like $line is a text string and you are autoincrementing it here? Maybe what you really want is $nextline++; to count the number of lines? -Original Message- From: Lance Prais [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 11:49 AM To: [EMAIL PROTECTED] Subject: If...Statement I am trying to start on a specific line of code and read a sub string of that code and also read the next line in the sequence and a sub string of that line. If either of the values are false then do something. I am using the following code: for(my $i=0; $i22; $i++){WORKFLOW}; #This will put you at row 23. $_=WORKFLOW; my $line=$_; my $nextline=$line++; if ((substr($line, 42, 7) eq Running) || (substr($nextline, 42, 7)eq Running)) Can anyone see what I am doing in correct? Thanks Lance Prais -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing a hash using cgi.pm
-Original Message- From: Josiah Altschuler [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 11:05 AM To: '[EMAIL PROTECTED]' Subject: passing a hash using cgi.pm Hi. I'm having trouble passing a hash from one program to another through a link using cgi.pm. My first program passes the hash like this (it's actually a hash that is one element of an array of hashes): print pre a ( { -href = http://140.247.111.176/cgi-bin/redundancies.pl?request=%{$clu sArrayHash[1]} }, Redundant sequences); The code from my program that receives the hash looks like this: %myHash = param(request); print header, start_html(Results), hr(), h1(Results); for $key (keys %myHash) { print ($key, $myHash{$key}); } print end_html(); And the web page ends up displaying data that looks like this: %{HASH(0x1bc2a60)}, Writing %{$clusArrayHash[1]} doesn't expand the hash inside the double quotes. You would need to use something like: @{[%{$clusArrayHash[1]}]} But even that won't work, because param() will just read that in as a single string. Something like this should work, letting CGI.pm do the work for you: my $query = CGI-new({request = [%clusArrayHash[1]]})-query_string; Now you can use $query after the ? in your href, and you can read the param back in as a hash. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing a hash using cgi.pm
-Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 11:32 AM To: 'Josiah Altschuler'; '[EMAIL PROTECTED]' Subject: RE: passing a hash using cgi.pm Something like this should work, letting CGI.pm do the work for you: my $query = CGI-new({request = [%clusArrayHash[1]]})-query_string; Rats, that should be: my $query = CGI-new({request = [%{$clusArrayHash[1]}]})-query_string; Which means: $clusArrayHash[1] is a hashref %{$clusArrayHash[1]}is the hash [%{$clusArrayHash[1]}] is a ref to an anonymous array containing the hash unrolled to a list The arg to CGI-new() is a hashref to a set of parameter key/value pairs. When you use a listref as a parameter value, the query string will be constructed to properly return the parameter as a list from the param() call, so you can assign it back to a hash. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
add text to a file.....Help
Hi, I have a file 1st file) that reads... one two three four five Anotherone 2nd filethat reads: day weeks months quarter year century I need to read the 2nd file and add the text from it to every word of the first 1st file. So it will look something like: oneday oneweek onemonth onequarter oneyear onecentury twoday twoweek etc..etc. Pleas give me an example on how I can accomplish this. thanks in advanced. = Peter Lemus UNIX/NT Networks Engineer [EMAIL PROTECTED] --The universe is way too big for us to be alone; the real question is; who is out-there, besides us humans? --A wise man will be master of his mind, a fool will be its slave. Dr.David Schwartz. --Enjoy every moment of the day; Live like as if today was your last day alive, and perhaps, it might be. __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add text to a file.....Help
Forgive me if my secret homework sensors are too sensitive but this sounds like a homework assignment. Because it sounds like a homework assignment, I'll give you pointers to the documentation which should be very useful. On Tue, Jan 08, 2002 at 08:47:33AM -0800, Peter Lemus wrote: : :Hi, :I have a file 1st file) that reads... :one :two :three :four :five : :Anotherone 2nd filethat reads: :day :weeks :months :quarter :year :century : :I need to read the 2nd file and add the text from it :to every word of the first 1st file. So it will look :something like: : :oneday :oneweek :onemonth :onequarter :oneyear :onecentury :twoday :twoweek etc..etc. : :Pleas give me an example on how I can accomplish this. You need to read perlfaq4. There is an entire section on arrays and, in particular, a few sections on permutations of lists and other data structures. So be sure to read 'perldoc perlfaq4'. Casey West -- Shooting yourself in the foot with Ada The Department of Defense shoots you in the foot after offering you a blindfold and a last cigarette. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add text to a file.....Help
open(FIRST, $firstfile) or die $!; open(SECOND, $secondfile) or die $!; @first=FIRST; @second=SECOND; foreach $first_line(@first) { foreach $second_line(@second) { chomp($first_line); chomp($second_line); print $first_line$second_line\n; } } Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: Peter Lemus [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 8:47 AM Subject: add text to a file.Help Hi, I have a file 1st file) that reads... one two three four five Anotherone 2nd filethat reads: day weeks months quarter year century I need to read the 2nd file and add the text from it to every word of the first 1st file. So it will look something like: oneday oneweek onemonth onequarter oneyear onecentury twoday twoweek etc..etc. Pleas give me an example on how I can accomplish this. thanks in advanced. = Peter Lemus UNIX/NT Networks Engineer [EMAIL PROTECTED] --The universe is way too big for us to be alone; the real question is; who is out-there, besides us humans? --A wise man will be master of his mind, a fool will be its slave. Dr.David Schwartz. --Enjoy every moment of the day; Live like as if today was your last day alive, and perhaps, it might be. __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file name matching
Morning: I need to scan a directory for files, they will be in pairs, a .tag file and a .txt file. I need to first make sure the .tag file(s) is there. If it is I need to check for the same prefix .txt file. Here is what I do to check for the file: ($scantag) = *.tag; @files = glob(*.tag); Is there a way to determine the prefix to the file? x.tag and x.txt? Thanks, -Scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Stripping records
When you do the read, the pointer(best I can think of) is set at the next record. Unless you close the file and re-open the file, the next time you do a read it will start where you left off. In a loop, which has the following setup: while ( FILEIN ) { } Within the loop, you may find a particular type of record or text which requires you to read say three more records. You could do this by: chomp(my $MyRcd2 =FILEIN); chomp(my $MyRcd3 =FILEIN); chomp(my $MyRcd4 =FILEIN); You may put this in another loop with checks, but the next read would be at the fifth record. Wags ;) -Original Message-- --- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 06:12 To: Wagner-David Cc: [EMAIL PROTECTED] Subject: RE: Stripping records On Mon, 7 Jan 2002, Wagner-David wrote: If straight text, then could just read the first line and start on the second: my $MyHdrLine = FILEIN; # get first line WHILE ( FILEIN ) { } You have bypassed first line(has carriage return still with it. Now you start your processing. It works, but I want to understand it as well. So, it is taking the first line and storing it in $MyHdrLine, why then does perl start at the second line after that? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Stripping records
Thank you David for taking the time to explain it. -Scott On Tue, 8 Jan 2002, Wagner-David wrote: When you do the read, the pointer(best I can think of) is set at the next record. Unless you close the file and re-open the file, the next time you do a read it will start where you left off. In a loop, which has the following setup: while ( FILEIN ) { } Within the loop, you may find a particular type of record or text which requires you to read say three more records. You could do this by: chomp(my $MyRcd2 =FILEIN); chomp(my $MyRcd3 =FILEIN); chomp(my $MyRcd4 =FILEIN); You may put this in another loop with checks, but the next read would be at the fifth record. Wags ;) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add text to a file.....Help
Homework Perl assignments? Where can I sign-up for that? :D Personally, I learn far better by example than documentation. That's why I signed up for this group. Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: Casey West [EMAIL PROTECTED] To: Peter Lemus [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 8:46 AM Subject: Re: add text to a file.Help Forgive me if my secret homework sensors are too sensitive but this sounds like a homework assignment. Because it sounds like a homework assignment, I'll give you pointers to the documentation which should be very useful. On Tue, Jan 08, 2002 at 08:47:33AM -0800, Peter Lemus wrote: : :Hi, :I have a file 1st file) that reads... :one :two :three :four :five : :Anotherone 2nd filethat reads: :day :weeks :months :quarter :year :century : :I need to read the 2nd file and add the text from it :to every word of the first 1st file. So it will look :something like: : :oneday :oneweek :onemonth :onequarter :oneyear :onecentury :twoday :twoweek etc..etc. : :Pleas give me an example on how I can accomplish this. You need to read perlfaq4. There is an entire section on arrays and, in particular, a few sections on permutations of lists and other data structures. So be sure to read 'perldoc perlfaq4'. Casey West -- Shooting yourself in the foot with Ada The Department of Defense shoots you in the foot after offering you a blindfold and a last cigarette. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add text to a file.....Help
ohmygod lol - Original Message - Homework Perl assignments? Where can I sign-up for that? :D -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: If...Statement
The question is a bit fuzzy, but try this at the command line, just for fun: perl -e 'my $line = abrabracadabra;print $line++, , $line, \n;' then consider this: #!D:/cygwin/bin/perl my ($i, $line, $nextline); open (TEXTF, c:/temp/somelines.txt) or die Evil forces keep me for doing what you want:$!\n; while(TEXTF) { # while construct automatically use $_ $i++; next if ($i 23); # fast forward to line 23 if (/Running/ and not $line) { # this is a regex but your substr function should work here if you need to pick # up Running at a specific location in the line $line = $_; # saves the first line with Running in it that occurs after line 22 printTarget found on line $i\n; next; # because we cannot allow next if to execute now } if (/Running/ and $line) { # running is found AND $line is not null $nextline = $_; last; # I am assuming you want the first line with target string Running in it and the very next } # line (and only the next line) if it has running in it } close TEXTF; print $line\n$nextline\n; HTH Frank McCollum [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am not sure, but I think it has to do with $nextline=$line++; It sounds like $line is a text string and you are autoincrementing it here? Maybe what you really want is $nextline++; to count the number of lines? -Original Message- From: Lance Prais [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 11:49 AM To: [EMAIL PROTECTED] Subject: If...Statement I am trying to start on a specific line of code and read a sub string of that code and also read the next line in the sequence and a sub string of that line. If either of the values are false then do something. I am using the following code: for(my $i=0; $i22; $i++){WORKFLOW}; #This will put you at row 23. $_=WORKFLOW; my $line=$_; my $nextline=$line++; if ((substr($line, 42, 7) eq Running) || (substr($nextline, 42, 7)eq Running)) Can anyone see what I am doing in correct? Thanks Lance Prais -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file name matching
I'm new to Perl, so take this with a grain of salt, but I did it like this: use strict; use File::Basename; my $basename; my $filename = 'yourfile.tag'; ($basename) = fileparse($filename, '\.tag'); print basename = $basename\n; # see perldoc File::Basename for more info. fileparse() can give you the path and file extension also. Hope this helps, Rick -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 8:44 AM To: [EMAIL PROTECTED] Subject: file name matching Morning: I need to scan a directory for files, they will be in pairs, a .tag file and a .txt file. I need to first make sure the .tag file(s) is there. If it is I need to check for the same prefix .txt file. Here is what I do to check for the file: ($scantag) = *.tag; @files = glob(*.tag); Is there a way to determine the prefix to the file? x.tag and x.txt? Thanks, -Scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
why am I getting syntax errors ?
Hi, I have the following code to parse a config file: my @section_headers = (general, database, preprocessing, postprocessing, queries); while() { /^[\t ]*$/ { print blank\n }; /^[\t ]*#/ { print comment\n }; /\[.*\]/ { $config_section = (split (/[\[\]]/,$_))[1], print $config_section . \n, #foreach $i (@section_headers) # { # $config_current_section = (lc($config_section) eq $i) ? $i:$config_current_section # }, #die config error - no valid section header\n if ($config_current_section ne $config_section $config_current_section ne queries), #for(my $x;$x10;++$x) print gg, print in section $config_current_section - $config_section\n }; } Now why am I getting syntax errors as soon as I uncomment either the foreach stuff, the die line, or the for loop. I came accross the while loop and the /(matches)/ (commands) when looking for a select ... case equivalent in perl, but I don't want to push every additional processing of $_ to subroutines and call them from the while loop... Any help on how I can fix this ? TIA, Filip -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why am I getting syntax errors ?
To simulate a case construct use someting like: /^[\t ]*$/ do { print blank\n }; You just left out the do. Also check out Config::IniFiles http://search.cpan.org/search?dist=Config-IniFiles for text-based config files. Haven't used it, but will as it looks very cool. Matt --- Filip Sneppe [EMAIL PROTECTED] wrote: Hi, I have the following code to parse a config file: my @section_headers = (general, database, preprocessing, postprocessing, queries); while() { /^[\t ]*$/ { print blank\n }; /^[\t ]*#/ { print comment\n }; /\[.*\]/ { $config_section = (split (/[\[\]]/,$_))[1], print $config_section . \n, #foreach $i (@section_headers) # { # $config_current_section = (lc($config_section) eq $i) ? $i:$config_current_section # }, #die config error - no valid section header\n if ($config_current_section ne $config_section $config_current_section ne queries), #for(my $x;$x10;++$x) print gg, print in section $config_current_section - $config_section\n }; } Now why am I getting syntax errors as soon as I uncomment either the foreach stuff, the die line, or the for loop. I came accross the while loop and the /(matches)/ (commands) when looking for a select ... case equivalent in perl, but I don't want to push every additional processing of $_ to subroutines and call them from the while loop... Any help on how I can fix this ? TIA, Filip -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
About DBD-ODBC Module
I can't install the module because I get some errors, when I read README file i find this: BUILDING: set-up these environment variables: DBI_DSN The dbi data source, e.g. 'dbi:ODBC:YOUR_DSN_HERE' DBI_USER The username to use to connect to the database DBI_PASS The username to use to connect to the database ODBCHOME (Unix only) The dir your driver manager is installed in But I don't understand what does it means? Please if Somebody has installed this module, tell how can I do. Where can I find this enviroment variables. Thanks in advance.
RE: If...Statement
for(my $i=0; $i22; $i++){WORKFLOW}; #This will put you at row 23. $_=WORKFLOW; my $line=$_; my $nextline=$line++; if ((substr($line, 42, 7) eq Running) || (substr($nextline, 42, 7)eq Running)) while (WORKFLOW) { # Skip lines upto line 23 next if $.22; # Process for line 23 24 if (substr ($line, 42, 7) eq Running) { ... } } # Make sure we definately got enough lines unless ($.=24) { die We were sold short! } __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perl module to operate on MS Excel files
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:03 PM To: [EMAIL PROTECTED] Subject: Perl module to operate on MS Excel files Hello, I need to automate the extraction and insertion of cells from and into an Excel spreadsheet. Has anyone done something along this line? Currently, this is achieved via {save as}/{parse into} using a text or a ..csv file. Thank you. PS: I am running Perl in UNIX and Excel in WinNt. UNIX and NT talk via Hummingbird's Exceed (which uses supports standard TCP/IP protocol) Thanks, William I have had good results with the Spreadsheet::ParseExcel and Spreadsheet::WriteExcel modules available on CPAN. These work fine on UNIX. Note that Spreadsheet::WriteExcel can create new workbooks, but cannot update existing workbooks, AFAIK. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: why am I getting syntax errors ?
This sort of question is a lot easier if we could see the syntax errors. Here's my guess though. #foreach $i (@section_headers) Has $i been declared? Try 'foreach my $i (@section_headers)' #die config error - no valid section header\n if ($config_current_section ne $config_section $config_current_section ne queries), I'd have to double check, but I think splitting the 'if' from it's condition with a new line will give a syntax error. I can't tell if this is just the e-mail format or in the original code. #for(my $x;$x10;++$x) print gg, A comma is not correct here. But you also need braces around the for block. #for(my $x;$x10;++$x) { print gg } you can also get away with print gg for (my $x;$x10;++$x); If this doesn't help, and no one else posts a helpful response you might include the syntax errors in your next post. Or at least the first few if there are too many. Good Luck, Peter C. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
timestamp without the time
How do I get the mm dd a file was created WITHOUT the time? _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perl module to operate on MS Excel files
I currently use the snip below, but I have had problems with it running out on a server that I have not been able to determine the cause of. Sometimes no Excel file is produced, and other times, voila. It works everytime locally. if ( $outputXls ) { $filename = $outputFilename . .txt; if ( -f $filename ) { use Win32::OLE; use Cwd; eval {$ex = Win32::OLE-GetActiveObject('Excel.Application')}; die Excel not installed if $@; unless (defined $ex) { $ex = Win32::OLE-new('Excel.Application', sub {$_[0]-Quit;}) or die Cannot start Excel; } $ex-Workbooks-OpenText($filename); $book = $ex-Workbooks($outputBasename . .txt); $sheet = $book-Worksheets(1); $sheet-Columns(B:BZ)-Autofit; $xlsFilename = $outputFilename . .xls; $book-SaveAs($xlsFilename, 1); $book-Close(0); undef $sheet; undef $book; undef $ex; } } -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:12 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: Perl module to operate on MS Excel files -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:03 PM To: [EMAIL PROTECTED] Subject: Perl module to operate on MS Excel files Hello, I need to automate the extraction and insertion of cells from and into an Excel spreadsheet. Has anyone done something along this line? Currently, this is achieved via {save as}/{parse into} using a text or a ..csv file. Thank you. PS: I am running Perl in UNIX and Excel in WinNt. UNIX and NT talk via Hummingbird's Exceed (which uses supports standard TCP/IP protocol) Thanks, William I have had good results with the Spreadsheet::ParseExcel and Spreadsheet::WriteExcel modules available on CPAN. These work fine on UNIX. Note that Spreadsheet::WriteExcel can create new workbooks, but cannot update existing workbooks, AFAIK. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: timestamp without the time
I don't know what your timeStamp string looks like, but if it looked like: 1/8/2001 18:00 ( $date, $time ) = split; would separate the two. The default split here is on any whitespace. To specify some other split you would do it as follows: split/:/; (where it would split on ':'). -Original Message- From: Alex Harris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:17 PM To: [EMAIL PROTECTED] Subject: timestamp without the time How do I get the mm dd a file was created WITHOUT the time? _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: EXCEL automation
From: Billie [EMAIL PROTECTED] What's wrong with the following code? use Win32::OLE; $book = Win32::OLE-GetObject(Book1.xls); $book-Saveas(Book2.xls); Book1 and the script are in the same directory. When I open Book2.xls, I cannot see any worksheet. Why? 1) Use full paths 2) Add $book-{Visible} = 1; above the SaveAs(). Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CGI scripts in Perl
I have Microsoft Personal Web Server on my local machine. My perl scripts run fine from the command line. When I try to run them from cgi-bin within INetpub/wwwroot, they fail raising the HTTP/1.1 500 Server Error. Any ideas? - NP _ Join the worldÂ’s largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI scripts in Perl
Visit this URL and configure your machine accordingly. http://support.microsoft.com/default.aspx?scid=kb;EN-US;q150629 -- Rex -Original Message- From: Naveen Parmar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:39 PM To: [EMAIL PROTECTED] Subject: CGI scripts in Perl I have Microsoft Personal Web Server on my local machine. My perl scripts run fine from the command line. When I try to run them from cgi-bin within INetpub/wwwroot, they fail raising the HTTP/1.1 500 Server Error. Any ideas? - NP _ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file name matching
Rick: Thank you! I modified it to do a scan of all files in the directory using: my $basename; my ($filename) = *.tag; ($basename) = fileparse($filename, '\.tag'); print basename = $basename\n; On Tue, 8 Jan 2002, Mahon, Rick wrote: I'm new to Perl, so take this with a grain of salt, but I did it like this: use strict; use File::Basename; my $basename; my $filename = 'yourfile.tag'; ($basename) = fileparse($filename, '\.tag'); print basename = $basename\n; # see perldoc File::Basename for more info. fileparse() can give you the path and file extension also. Hope this helps, Rick -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 8:44 AM To: [EMAIL PROTECTED] Subject: file name matching Morning: I need to scan a directory for files, they will be in pairs, a .tag file and a .txt file. I need to first make sure the .tag file(s) is there. If it is I need to check for the same prefix .txt file. Here is what I do to check for the file: ($scantag) = *.tag; @files = glob(*.tag); Is there a way to determine the prefix to the file? x.tag and x.txt? Thanks, -Scott -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: out vs my for efficiency Was: 'my' for each loop or no ?
--- Eric Beaudoin [EMAIL PROTECTED] wrote: I was wondering if someone could explain why a variable define with a global scope was slower that one define within the local lexical scope when used in a loop? If I recall correctly, you should usually get better performance from lexically scoped variables than from global ones. Lexically scoped variables are stored in a private scratchpad array and can be accessed directly by Perl. Globals, on the other hand, are stored in a public symbol table in a typeglob. Perl has to do a hash lookup in the symbol table and then get the corresponding entry in the typeglob for the variable you need. No such lookup in necessary for lexicals, hence the better performance. Any internals people around? I'd love to hear some more knowledgeable people /(?:correct|expand upon)/ this. Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: If...Statement
| for(my $i=0; $i22; $i++){WORKFLOW}; | $_=WORKFLOW; | my $line=$_; | my $nextline=$line++; | if ((substr($line, 42, 7) eq Running) || | (substr($nextline, 42, 7)eq | Running)) while (WORKFLOW) { # Skip lines upto line 23 next if $.22; # Process for line 23 24 if (substr ($line, 42, 7) eq Running) { ... } } # Make sure we definately got enough lines unless ($.=24) { die We were sold short! } If I use you command it will only check line 23 and not 24, right? In the original code you had ||, suggesting you didn't care which line the match occured on since you undertook the same action regardless. I don't have enough information to verify that my code will do EXACTLY what you want... I missed out a test to terminate the loop for line 25, which you definately don't want to look at. Change the loop to: while (WORKFLOW) { # Skip lines upto line 23 next if $.22; # Process for line 23 24 if (substr ($line, 42, 7) eq Running) { ... } # Terminate loop once line 24 is processed last if $.==24; } This code is REALLY SQUEAKY CLEAN(TM), hence it should be quite clear what it does (and is perhaps free from further errors). $. is the current line number of the file you're working with - beyond that it should be extremely familiar looking. Incidentally, you MAY use English; to make $. into the more readable variable of $INPUT_LINE_NUMBER. Be warned, this english module will slow down most scripts! (Because of forcing the $ variable to be created and updated when regex's are run). Besides, if you were writing scripts for me I'd prefer the shorter version :) Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file name matching
Works fine on the Linux box, no go on the Windows box. Anyone have another idea? Thanks, -Scott On Tue, 8 Jan 2002, Scott wrote: I'm new to Perl, so take this with a grain of salt, but I did it like this: use strict; use File::Basename; my $basename; my $filename = 'yourfile.tag'; ($basename) = fileparse($filename, '\.tag'); print basename = $basename\n; # see perldoc File::Basename for more info. fileparse() can give you the path and file extension also. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pull line #1 from a file
Can someone help me fix this? I know I am on the right track (I hope) but not sure where I am going south open FILE, $g_logpass; $line = FILE; close (FILE); chomp($line); system(cp ../input/$g_logpass ../input/tmp.scr); system(sed -e 's/'$line'/'$db_name'/g' ../input/tmp.scr $g_logpass); -Original Message- From: Yacketta, Ronald Sent: Tuesday, January 08, 2002 11:11 To: Yacketta, Ronald; '[EMAIL PROTECTED]'; Yacketta, Ronald Cc: 'Beginners (E-mail)' Subject: RE: pull line #1 from a file would this be valid? or should I seek out a cleaner way? system(sed -e 's/'chomp($lines[0])'/'$db_name'/g' ../input/tmp.scr $g_logpass); just looking to replace line one in the file with a user supplied value. I have like 23 files to parse and change per run based on user input. -Original Message- From: Yacketta, Ronald Sent: Tuesday, January 08, 2002 11:06 To: [EMAIL PROTECTED]; Yacketta, Ronald Cc: Beginners (E-mail) Subject: RE: pull line #1 from a file so so close... I had this OPEN(FILE, $g_all_sleepy); @lines = FILE; CLOSE(FILE); $lines[0]; # think this is right, its an array.. all arrays start at 0 not 1.. unless # perl is funky and dont ;) -Original Message- From: Casey West [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 10:56 To: Yacketta, Ronald Cc: Beginners (E-mail) Subject: Re: pull line #1 from a file On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote: : :Folks, : :need some minor help here.. been looking in the Cookbook for an example :to pull the first line from a file.. open FILE, filename or die $!; my $line = FILE; close FILE; Remember, FILEHANDLE is something you can iterate over. In scalar context it returns just one line (for all intents and purposes) at a time. Casey West -- Usenet is like Tetris for people who still remember how to read. -- Button from the Computer Museum, Boston, MA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File::Copy limitation? on Win32
I suspect the answer to this is you can't abuse perl that way on WinNT, but I'll post anyhow. I'm distributing files across several machines on an NT network; for various reasons I need the status that the File::Copy module returns but can't rely on mapped drives. UNCs and IP paths (\\10.98.76.543\d$\usr\exe) don't seem to work with this module however; only local or mapped drives (which appear local to the machine) seem to work. Try Win32::FileOp ppm install --location=http://www24.brinkster.com/Jenda/perl/ Win32-FileOp Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CGI vs. Servlet technologies
What are the key differences between CGI and Servlets? - NP _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: timestamp without the time
-Original Message- From: Alex Harris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:17 PM To: [EMAIL PROTECTED] Subject: timestamp without the time How do I get the mm dd a file was created WITHOUT the time? Note that you cannot strictly get a creation date; the closest is the file's last modification date (mtime). The stat() function will give you (among other things) the mtime in epoch seconds. Use localtime() (or gmtime()) to convert that into separatate date/time elements. You can use the returns from localtime or gmtime directly or you can run them through something like POSIX::strftime to get a formatted string with month, day, and year. perldoc -f stat perldoc -f localtime perldoc POSIX (search for strftime) n.b. be sure to read the docs for localtime carefully, especially if you won't be using strftime. HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI vs. Servlet technologies
On Tue, 8 Jan 2002, Naveen Parmar wrote: What are the key differences between CGI and Servlets? I think Servlets also use the CGI protocol, they accept POST and GET strings the same way as any CGI program. They are just special server side components written in Java that are run as a server process via a 'servlet' container, like Tomcat. Some servlet containers can run standalone as a web server (Tomcat can), others, need to be run as a process invoked by a web server like Apache via an intermediary module, like mod_jk. Actually, Tomcat can be used as either of these. :-) Of course, Servlets are specifically Java, CGI is a broader category that can be implemented in any language. Servlets are closer in principle to things like mod_perl, which embeds a Perl interpreter into the web server. JSP, Java Server Pages, get converted and then compiled into servlets in a manner very similar to the way Mason converts components into compilable Perl code. -- Brett http://www.chapelperilous.net/ Kramer's Law: You can never tell which way the train went by looking at the tracks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI vs. Servlet technologies
Servlets are more scalable than CGIs and that is what is one of the biggest advantages! A Servlet is instantiated for the first request and any subsequent requests to the same servlet spawns a separate thread, whereas CGIs are costly and had to be instantiated afresh for every fresh request. This way CGIs are more prone to bottlenecks and timeouts than Servlets. -- Rex -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 4:51 PM To: Naveen Parmar Cc: [EMAIL PROTECTED] Subject: Re: CGI vs. Servlet technologies On Tue, 8 Jan 2002, Naveen Parmar wrote: What are the key differences between CGI and Servlets? I think Servlets also use the CGI protocol, they accept POST and GET strings the same way as any CGI program. They are just special server side components written in Java that are run as a server process via a 'servlet' container, like Tomcat. Some servlet containers can run standalone as a web server (Tomcat can), others, need to be run as a process invoked by a web server like Apache via an intermediary module, like mod_jk. Actually, Tomcat can be used as either of these. :-) Of course, Servlets are specifically Java, CGI is a broader category that can be implemented in any language. Servlets are closer in principle to things like mod_perl, which embeds a Perl interpreter into the web server. JSP, Java Server Pages, get converted and then compiled into servlets in a manner very similar to the way Mason converts components into compilable Perl code. -- Brett http://www.chapelperilous.net/ -- -- Kramer's Law: You can never tell which way the train went by looking at the tracks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI vs. Servlet technologies
But don't forget that there are other technologies other than servlets that cache code so that they don't need to be recompiled for each hit. ...And this being a Perl list there is mod_perl a plugin for Apache (free) and PerlEx for IIS (from ActiveState). Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 4:50 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: CGI vs. Servlet technologies Servlets are more scalable than CGIs and that is what is one of the biggest advantages! A Servlet is instantiated for the first request and any subsequent requests to the same servlet spawns a separate thread, whereas CGIs are costly and had to be instantiated afresh for every fresh request. This way CGIs are more prone to bottlenecks and timeouts than Servlets. -- Rex -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 4:51 PM To: Naveen Parmar Cc: [EMAIL PROTECTED] Subject: Re: CGI vs. Servlet technologies On Tue, 8 Jan 2002, Naveen Parmar wrote: What are the key differences between CGI and Servlets? I think Servlets also use the CGI protocol, they accept POST and GET strings the same way as any CGI program. They are just special server side components written in Java that are run as a server process via a 'servlet' container, like Tomcat. Some servlet containers can run standalone as a web server (Tomcat can), others, need to be run as a process invoked by a web server like Apache via an intermediary module, like mod_jk. Actually, Tomcat can be used as either of these. :-) Of course, Servlets are specifically Java, CGI is a broader category that can be implemented in any language. Servlets are closer in principle to things like mod_perl, which embeds a Perl interpreter into the web server. JSP, Java Server Pages, get converted and then compiled into servlets in a manner very similar to the way Mason converts components into compilable Perl code. -- Brett http://www.chapelperilous.net/ -- -- Kramer's Law: You can never tell which way the train went by looking at the tracks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI vs. Servlet technologies
--- Hanson, Robert [EMAIL PROTECTED] wrote: But don't forget that there are other technologies other than servlets that cache code so that they don't need to be recompiled for each hit. ...And this being a Perl list there is mod_perl a plugin for Apache (free) and PerlEx for IIS (from ActiveState). Rob Off-topic side note: I don't like to let people know that PerlEx even exists. You can't use taint checking with it. That's a big security boo-boo. For that reason alone (we weren't worried about the cost), the owner of our company was convinced that there was no reason to ever consider this product. In some email I exchanged with ActiveState a while ago, I was told they were considering adding taint checking, but nothing appears to have changed. I was probably communicating with a marketroid. Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pull line #1 from a file
Ronald Yacketta wrote: Can someone help me fix this? I know I am on the right track (I hope) but not sure where I am going south open FILE, $g_logpass; $line = FILE; close (FILE); chomp($line); system(cp ../input/$g_logpass ../input/tmp.scr); system(sed -e 's/'$line'/'$db_name'/g' ../input/tmp.scr $g_logpass); use Fatal qw(open close); { local $^I = ''; local @ARGV = ../input/$g_logpass; while ( ) { s/\Q$line\E/$db_name/g; print; } } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add text to a file.....Help
Peter Lemus wrote: I have a file 1st file) that reads... one two three four five Anotherone 2nd filethat reads: day weeks months quarter year century I need to read the 2nd file and add the text from it to every word of the first 1st file. So it will look something like: oneday oneweek onemonth onequarter oneyear onecentury twoday twoweek etc..etc. Pleas give me an example on how I can accomplish this. Here is one way to do it: #!/usr/bin/perl -w use strict; open FILE, 'file1.txt' or die Cannot open 'file1.txt': $!; chomp( my @data1 = FILE ); close FILE; open FILE, 'file2.txt' or die Cannot open 'file2.txt': $!; my $data2 = do { local $/; FILE }; close FILE; my $regex = join( '|', sort { length $b = length $a } split( ' ', $data2 ) ); open FILE, ' file2.txt' or die Cannot open 'file2.txt': $!; for ( @data1 ) { $data2 =~ s/^(.*)($regex)$/$_$2/mg; print FILE $data2; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add text to a file.....Help
--- John W. Krahn [EMAIL PROTECTED] wrote: Peter Lemus wrote: I have a file 1st file) that reads... one two three four five Anotherone 2nd filethat reads: day weeks months quarter year century I need to read the 2nd file and add the text from it to every word of the first 1st file. So it will look something like: oneday oneweek onemonth onequarter oneyear onecentury twoday twoweek etc..etc. Pleas give me an example on how I can accomplish this. Here is one way to do it: #!/usr/bin/perl -w use strict; open FILE, 'file1.txt' or die Cannot open 'file1.txt': $!; chomp( my @data1 = FILE ); close FILE; open FILE, 'file2.txt' or die Cannot open 'file2.txt': $!; my $data2 = do { local $/; FILE }; close FILE; my $regex = join( '|', sort { length $b = length $a } split( ' ', $data2 ) ); open FILE, ' file2.txt' or die Cannot open 'file2.txt': $!; for ( @data1 ) { $data2 =~ s/^(.*)($regex)$/$_$2/mg; print FILE $data2; } John, That's an interesting solution, but I think the following is a bit cleaner (unless I am just completely missing something here). #!/usr/bin/perl -w use strict; open FIRST, first.txt or die Cannot open first.txt: $!; open SECOND, second.txt or die Cannot open second.txt: $!; chomp( my @first = FIRST ); chomp( my @second = SECOND ); close SECOND; close FIRST; open THIRD, third.txt or die Cannot open third.txt: $!; foreach ( @second ) { foreach my $word ( @first ) { print THIRD $word$_\n; } } close THIRD; Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pull line #1 from a file
-Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 2:28 PM To: [EMAIL PROTECTED] Subject: Re: pull line #1 from a file Ronald Yacketta wrote: Can someone help me fix this? I know I am on the right track (I hope) but not sure where I am going south open FILE, $g_logpass; $line = FILE; close (FILE); chomp($line); system(cp ../input/$g_logpass ../input/tmp.scr); system(sed -e 's/'$line'/'$db_name'/g' ../input/tmp.scr $g_logpass); open FILE, logpass.txt; # first line, testing $line = FILE; close (FILE); chomp($line); $line =~ s/testing/tested/; open FILE, logpass.txt; print FILE $line; # first line is now tested close (FILE); Should be able to open for read/write with + instead of but the following apparently has something wrong with it. open FILE, + logpass.txt; $line = FILE; chomp($line); $line =~ s/testing/tested/; print FILE $line; close (FILE); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file name matching
Scott wrote: I need to scan a directory for files, they will be in pairs, a .tag file and a .txt file. I need to first make sure the .tag file(s) is there. If it is I need to check for the same prefix .txt file. Here is what I do to check for the file: ($scantag) = *.tag; @files = glob(*.tag); Is there a way to determine the prefix to the file? x.tag and x.txt? my @tagandtxt; while ( *.tag ) { ( my $file = $_ ) =~ s/\.tag$//; push @tagandtxt, $file if -e $file.txt; # or if you want all the file names in the array # push @tagandtxt, $file.tag, $file.txt if -e $file.txt; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
hiding file data
Hi All, I have a few perl files that I need to send out to a client. However, we do not want them seeing what are in the files for obvious reason. Is there any way that I can hide the info in the files, or should I creat an executable. Thanks in advance for any help. Totalise - the Users ISP -- To become a member and a shareholder visit http://www.totalise.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
command line args in Windows 2000
Hi, I have no idea how much traffic is on this list, and I have searched all day for an answer to this question. How do I pass command line arguments to Perl under Windows 2000? I have the following code snippet: GetOptions(size=s); print \nsize is $opt_size\n; exit; $opt_size never appears to get assigned to anything. I have also tried to use the @ARGV array, with no luck. I have been using Perl on Unix for years, and this is my first (and maybe last) attempt at using Perl on Windows 2000. Thanks in advance! -Rich -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perplexed
Hello: I created a Perl logon script for use on an NT TSE machine which sets environment variables and maps drives. It runs as expected when it's run from the path specified in User Manager for Domains-Profile-Logon Script Name. Since I don't want the user to be able to see it when he logs on, I use runh.exe with the script. Unfortunately, when I use runh.exe, the user's program, which launches at startup, can't find the drive that the logon script is supposed to map. I've also noticed this kind of behavior when calling the logon script from Usrlogon.cmd. I'm using both $ENV as well as Win32::AdminMisc to set the environment variables. It seems to me that the environment variables and drive mappings don't take effect fast enough (if at all) before the startup program launches. Does anyone have a clue as to why this is and if there is a work around? Thanks. Dean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perplexed: Part 2
Hello: I forgot to mention that when I don't use Runh.exe (or if I don't call the logon script from Usrlogon.cmd), then the logon script works as expected. Once again, thanks. Dean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: WWW:Robot speed..
Hi there.. I am using the WWW:Robot module to iterate over some internal sites, so complying with the guidelines for robots is not really an issue. Anyone have any experience modifying the module so that the delay between requests is less? Regards, Lorne -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI vs. Servlet technologies
[EMAIL PROTECTED] wrote: Servlets are more scalable than CGIs and that is what is one of the biggest advantages! A Servlet is instantiated for the first request and any subsequent requests to the same servlet spawns a separate thread, whereas CGIs are costly and had to be instantiated afresh for every fresh request. This way CGIs are more prone to bottlenecks and timeouts than Servlets. You'll find mod_perl will give you as much bang for your buck, if not more. Basically servlets and mod_perl are different ways of implementing persistence in web applications. A CGI application is an application stored on disk that is called by the web server every time a client hits the URI associated with it. A Servlet and a mod_perl handler are loaded from disk once (in most cases) and sit in memory waiting for each request. You can write a CGI app in anything, provided it prints out 'Content-type: text/html\n\n' before it prints anything else. Persistent technologies each have their own API and way of doing things. Visit http://perl.apache.org/guide for an intro to persistence/performance for Perl. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hiding file data
Stuart == Stuart Alexander [EMAIL PROTECTED] writes: Stuart I have a few perl files that I need to send out to a Stuart client. However, we do not want them seeing what are in the Stuart files for obvious reason. What obvious reason? Stuart Is there any way that I can hide the info in the files, or Stuart should I creat an executable. Please don't ask the very community that brought you Perl by making Perl open source and all the contributions to Perl also open source, to help you lock up something that you are making money with. You can do it in the privacy of your own cube, but you are on your own. Please for the sake of the community rethink your strategy though. See www.gnu.org and www.opensource.org for the philosophy. What you're doing is a bit like walking in to a free potluck, grabbing some of the food, and then selling it as your own secret recipe in the restaurant next door. Feh. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pull line #1 from a file
- Original Message - From: Casey West [EMAIL PROTECTED] To: Yacketta, Ronald [EMAIL PROTECTED] Cc: Beginners (E-mail) [EMAIL PROTECTED] open FILE, filename or die $!; my $line = FILE; close FILE; Remember, FILEHANDLE is something you can iterate over. In scalar context it returns just one line (for all intents and purposes) at a time. Am I right to say that although $line reads the first line, the whole file is still being read till the end of file. If I am sitting for a test, I failed because I would probably think that $line = FILE would read the last line, I say so because of the following reasons:- my @line =FILEHANDLE; reads every line into @line, therefore I see the 'read FILEHANDLE' just like an array of lines like this :- FILEHANDLE equivalent to ('line 1\n' , 'line2\n' . and so on.. ) and if this is so, therefore $line should read the last line like this example :- my $line = ( 'line1', 'line2' , 'line3' ); print $line; # print line3 Thanks. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bash 'trap' equivalent ?
Hi, Is there a perl equivalent of the 'trap' command in bash ? The reason I ask is, I create a temporary file at the start of a script, and I want to ensure that that temporary file gets removed in case the user hits C-c before the script finishes running. pv. -- Prahlad Vaidyanathan [EMAIL PROTECTED] Experiments must be reproducible; they should all fail in the same way. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
why does open()ing happen only at the FD line ?
Hi, Noticed this today : script open(FD,'sudo grep -h Connect time /var/log/message* | grep -v COMMAND |') or die $! ; # Do some stuff ... while ( FD ) { # do more stuff } /script In the above script (an attempt to check my ppp usage), the script actually runs 'sudo' only when reading from the file (line #3) and not when open() is run (line #1). Why is that ? I am new to programming, so I don't know how other languages would do this, but it seems counter-intuitive to me. I presumed 'sudo' would be run when open() is run. pv. ps. Is it inadvisable to open the said file like this (see the script above) ? If so, why ? -- Prahlad Vaidyanathan [EMAIL PROTECTED] I love ROCK 'N ROLL! I memorized the all WORDS to WIPE-OUT in 1965!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: command line args in Windows 2000
What shell are you using? Std Dos Commmand or something else? Within definition or assignment of pl to perl, it should look something like: File types should have Open: D:\Perl\bin\Perl.exe %1 %* Under one build of ActiveState, there were a number of problems in this area concerning file type setups. W/o the setup above, @ARGV ( Std way under w2k to params/arguments) from the command line will not work. Wags ;) -Original Message- From: Rich Rochelle [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 18:04 To: [EMAIL PROTECTED] Subject: command line args in Windows 2000 Hi, I have no idea how much traffic is on this list, and I have searched all day for an answer to this question. How do I pass command line arguments to Perl under Windows 2000? I have the following code snippet: GetOptions(size=s); print \nsize is $opt_size\n; exit; $opt_size never appears to get assigned to anything. I have also tried to use the @ARGV array, with no luck. I have been using Perl on Unix for years, and this is my first (and maybe last) attempt at using Perl on Windows 2000. Thanks in advance! -Rich -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
email word attachment from html form input
hello, I am trying to take input email addresses from an html web form and email and attachment to that email address. I am using the MIME::Lite module and have no problems when shortening the script to just the mail portion and executing via command line. The problem appears to be with the input of variables. I'm guessing my speculation of the problem wont help as much as the actual code (otherwise it would be fixed, right?) so here it is... :) In error_log receive premature end of script headers Here are the errors received if doing a -w: Name main::tsr_addy used only once: possible typo at ipjustify.pl line 18. Use of uninitialized value in read at ipjustify.pl line 5. here is line 5: read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); here is line 18: $tsr_addy = $form{'tsr_addy'}; Here is the entire script...(I apologize for the length...) #!/usr/bin/perl use MIME::Lite; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs=split(//, $buffer); foreach $pair (@pairs) { ($name, $value)=split(/=/,$pair); $value=~tr/+/ /; $value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $form{$name}=$value; } # Assign variables to arguments $eu_addy = $form{'eu_addy'}; $tsr_addy = $form{'tsr_addy'}; $msg = MIME::Lite-new( From ='[EMAIL PROTECTED]', To ='$eu_addy', Bcc ='$tsr_addy', Subject ='test message', Type ='TEXT', Data ='This is a test, i repeat only a test', ); $msg-attach(Type ='application/octet-stream', Encoding ='base64', Path ='test.doc', ); $msg-send; # Print HTML Out print Content-type: text/html\n\n; print END; html head titleWord Doc Sent!!/title /head br center brbrThe document has been successfully sent to END print $eu_addy; print **END**; To send another form click back. /center /body /html **END** Here is just emailing using MIME::Lite (works... trying to dissect the problem) #!/usr/bin/perl use MIME::Lite; $msg = MIME::Lite-new( From ='[EMAIL PROTECTED]', To ='[EMAIL PROTECTED]', Subject ='test message', Type ='TEXT', Data ='This is a test, i repeat only a test', ); $msg-attach(Type ='application/octet-stream', Encoding ='base64', Path ='test.doc', ); $msg-send; Any help or insight you can provide is greatly appreciated. I don't know if this doesn't make sense cuz i've been staring at it for a while, or because i'm not feeling well. Either way thank you for the insight or links to information that can help.. Thank you -katia -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bash 'trap' equivalent ?
At 09:33 PM 1/8/02 +0530, Prahlad Vaidyanathan wrote: Hi, Is there a perl equivalent of the 'trap' command in bash ? The reason I ask is, I create a temporary file at the start of a script, and I want to ensure that that temporary file gets removed in case the user hits C-c before the script finishes running. $SIG{INT} = sub { unlink $tempfile }; perldoc perlvar and scroll down to the section on %SIG. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: email word attachment from html form input
Recommend replacing the parsing routine, mainly because it is said to have a bunch of security holes: read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs=split(//, $buffer); foreach $pair (@pairs) { ($name, $value)=split(/=/,$pair); $value=~tr/+/ /; $value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $form{$name}=$value; } # Assign variables to arguments $eu_addy = $form{'eu_addy'}; $tsr_addy = $form{'tsr_addy'}; with this: use CGI 'param'; $eu_addy = param{'eu_addy'}; $tsr_addy = param{'tsr_addy'}; That's all there is to it. Also, this method allows for multiple choice form elements (where the user can hold down the control key to select more than one item), in which case the script variable would be an array rather than a scalar. Don't worry, this CGI approach is blistering fast. If it does not work then check for mismatch between script and form element names. Gary -Original Message- From: katia goforth [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 9:16 PM To: [EMAIL PROTECTED] Subject: email word attachment from html form input hello, I am trying to take input email addresses from an html web form and -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
piping versus backticks
Hello all: I'm working my way through Learning Perl (3rd ed) and got stuck in ch 14 (Process Management, pages 201-202 actually, to be specific) where the date command is is opened through a filehandle with a piped open. Just toying around to see how it worked, I put it in a loop and was surprised to see that it worked perfectly for the first iteration but then I got an error on every subsequent iteration: Use of uninitialized value in concatenation (.) at line 11, DATE line 1. Line 11 is the print line, but if I swap the filehandle with $now = `date` everything works great. #!/usr/bin/perl -w use strict; my $now; open DATE, date| or die Darth Vader prevents me from piping from date: $!; foreach (1..4) { $now = DATE; print It's now $now\n; sleep (1 + rand 10); } close DATE; I'm sure this is probably a simple, commonsensical thing but I got swamped in 'perldoc perlopentut' and 'man perlipc' and wasn't quite sure what keywords might help me find an answer. By the way, I'm using Perl 5.6.0 on Mac OS 10.0.3. And this is a great list, too, I should add. I've learned a lot by lurking even though I haven't posted before. Harvey Quamen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: email word attachment from html form input
Gary, Thanks for the reply. Even after changing it to use the CGI module i still had a problem but i finally figured that out. I had to hard code using libraries { use lib /usr/local/lib/perl5/site_perl/5.6.1; use lib /usr/local/lib/perl5/site_perl/5.6.1/i686-linux; } (sounds like i have a config issue in linux...) Anyway, thanks for the info on the CGI Module, that appears to be quicker, and easier. have a good night -katia Gary Hawkins wrote: Recommend replacing the parsing routine, mainly because it is said to have a bunch of security holes: read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs=split(//, $buffer); foreach $pair (@pairs) { ($name, $value)=split(/=/,$pair); $value=~tr/+/ /; $value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $form{$name}=$value; } # Assign variables to arguments $eu_addy = $form{'eu_addy'}; $tsr_addy = $form{'tsr_addy'}; with this: use CGI 'param'; $eu_addy = param{'eu_addy'}; $tsr_addy = param{'tsr_addy'}; That's all there is to it. Also, this method allows for multiple choice form elements (where the user can hold down the control key to select more than one item), in which case the script variable would be an array rather than a scalar. Don't worry, this CGI approach is blistering fast. If it does not work then check for mismatch between script and form element names. Gary -Original Message- From: katia goforth [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 9:16 PM To: [EMAIL PROTECTED] Subject: email word attachment from html form input hello, I am trying to take input email addresses from an html web form and -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: hiding file data
Stuart I have a few perl files that I need to send out to a Stuart client. However, we do not want them seeing what are in the Stuart files for obvious reason. What obvious reason? That would be so the client doesn't walk away from the guys who do the work once they have the goods. Stuart Is there any way that I can hide the info in the files, or Stuart should I creat an executable. Please don't ask the very community that brought you Perl by making Perl open source and all the contributions to Perl also open source, to help you lock up something that you are making money with. Ah, you wish all the code in the world were viewable, me too. But it seems to me like a custom script for a client rather than something the whole world could use. At work, I would compile specific-task perl scripts for several reasons: 1) So my coworkers would not edit them and mess something up. 2) To make them wonder how I did it. 3) Because, if they could see the code they would tend to try to find some reason to criticize it (human nature). 4) For their ease of use, no perl.exe or perl56.dll required. 5) So that if they dump me and want an upgrade they have to start all over. ActiveState charges $200 and distributes exe's. Maybe they should stop doing that?? Stuart, install ActiveState and try PerlApp, it will function during the trial period. Or use Perl2Exe, your choice. /g -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]