Fwd: DELIVERY FAILURE: Delivery time expired

2007-06-24 Thread Tom Allison
This is getting annoying It might be useful if objectorb.com would actually provide some reason for delivery beyond Delivery time expired. Considering the string '***SPAM***' appears to be something I might find in SpamAssassin, and some people are starting to apply smtp rejections to

Re: quoted-printable characters

2007-06-23 Thread Tom Allison
This is where I got into trouble. MIME::Parser I can't seem to find any way to parse EVERYTHING to Unicode. there's mention of it, and mention that you don't want to do that. But I'm not sure why unless it's considered CPU intensive. On Jun 23, 2007, at 1:54 PM, Dr.Ruud wrote: Tom Allison

quoted-printable characters

2007-06-22 Thread Tom Allison
OK, on to the next one... charset = iso-8859-9 Quoted-Printable MIME::QuotedPrintable seems to only do conversions to ASCII which screws up the conversion. I could do conversion to utf via: use Encode; decode('MIME-Header',$string) where $string is represented as a header: =?iso-8859-9?Q?

still working with utf8

2007-06-21 Thread Tom Allison
OK, I sorted out what the deal is with charsets, Encode, utf8 and other goodies. Now I have something I'm just not sure exactly how it is supposet to operate. I have a string: =?iso-2022-jp?B?Rlc6IBskQjxkJDckNSRHJE8kSiQvJEYzWiQ3JF8kPyQkGyhC?= That is a MIME::Base64 encoded string of

Re: parse mime email

2007-06-20 Thread Tom Allison
Check the bugs on Email::MIME. IIRC there's an error when the response is '' which is legal but not handled by the code. I submitted a bug a couple of years ago and I don't believe it's been fixed. I found MIME::Tools to be the absolute best in parsing MIME content in it's ability to

charset/base64 encoding/encode.

2007-06-19 Thread Tom Allison
Still futzing around with email and character sets. Under Encode and perluniintro there's mention of octet \x{..} (255 chars up to \xff string some internal representation code point \x{...} 1, 2 or more bytes of data But I'm not sure about the order of things. So I'll try

Re: character encoding regex

2007-06-17 Thread Tom Allison
On Jun 17, 2007, at 6:14 AM, Dr.Ruud wrote: Tom Allison schreef: I'm trying to do some regular expression on strings in email. They could be encoded to something. But I can't tell because I don't have a utf8 unicode xterm window that will show me anything. There are more simple ways

Re: character encoding regex

2007-06-17 Thread Tom Allison
progress!!! On Jun 16, 2007, at 6:05 PM, Tom Phoenix wrote: On 6/16/07, Tom Allison [EMAIL PROTECTED] wrote: I'm trying to do some regular expression on strings in email. They could be encoded to something. But I can't tell because I don't have a utf8 unicode xterm window that will show me

character encoding regex

2007-06-16 Thread Tom Allison
I'm trying to do some regular expression on strings in email. They could be encoded to something. But I can't tell because I don't have a utf8 unicode xterm window that will show me anything. At best I get ?a?? and other trash like that. I think this is typical for ascii text renderings

Re: character encoding regex

2007-06-16 Thread Tom Allison
Mumia W. wrote: On 06/16/2007 02:29 PM, Tom Allison wrote: I'm trying to do some regular expression on strings in email. They could be encoded to something. But I can't tell because I don't have a utf8 unicode xterm window that will show me anything. At best I get ?a?? and other trash

Re: character encoding regex

2007-06-16 Thread Tom Allison
On Jun 16, 2007, at 6:05 PM, Tom Phoenix wrote: On 6/16/07, Tom Allison [EMAIL PROTECTED] wrote: I'm trying to do some regular expression on strings in email. They could be encoded to something. But I can't tell because I don't have a utf8 unicode xterm window that will show me anything

Re: Database insertion, escape issue

2007-06-12 Thread Tom Allison
On Jun 11, 2007, at 7:52 PM, Northstardomus wrote: I have a Perl script where I try to strip some data from a web page and insert it into a database. I'm having a problem where, it seems like the method of quoting the data for insertion don't seem to be working (as far as escaping the

Re: Database insertion, escape issue

2007-06-12 Thread Tom Allison
PROTECTED] (Tom Allison) wrote: On Jun 11, 2007, at 7:52 PM, Northstardomus wrote: I have a Perl script where I try to strip some data from a web page and insert it into a database. I'm having a problem where, it seems like the method of quoting the data for insertion don't seem

Re: Is there a perl equivalent to PHP variables $_POST and $_GET?

2007-06-11 Thread Tom Allison
use CGI: my $q = new CGI; my $method = $q-request_method(); Like the other guy said, Perl is a general purpose language. If you want specific HTTP stuff you'll have to load specific modules to do that. This is one example. You can do the same thing using Fast CGI and mod_perl as well.

Re: /s, /g and /m modifiers

2007-06-01 Thread Tom Allison
There's nothing here to say stop at a new line Without the modifiers the string looks like: 'one upon a time\nonce upon a time' Which matches your regex the same way 'once upon a time once upon a time' would. without the /g you'll match on the first one. I guess the question is, what do you

Re: How to split a large string with repeating delimiters into multiple substrings

2007-05-25 Thread Tom Allison
How about something like: Assume the string is in $string... my $regex = '\spsl\-url\([^\]+)\\/upsl\-url\'; while ($string =~ /$regex/gsm) { print $1,\n; } On May 24, 2007, at 1:47 PM, Octavian Rasnita wrote: Or if this string is stored in a file, and if it is very very big and you

regex question

2007-05-14 Thread Tom Allison
How do I pull all the words from a line between the two words 'from' and 'by' when I have NO IDEA what's in there, but I know they are all in one line. To make it more difficult. 'by' is optional... Like this: from..by.. or from.. I want all the stuff inside. Initially I'm

Re: regex question

2007-05-14 Thread Tom Allison
yitzle wrote: # Requires by: $line = daffromHello Worldby; $line =~ /from(.*)(by)/; print $1; Not sure about making it optional. Can always check if you got and then try without the by the .* pulls in too much. I'm going to have to back up and try this again. But I think it's late. -- To

Re: regex utf8

2007-05-12 Thread Tom Allison
this on a utf8 file or will perl just know. If it doesn't, can I just open everything in utf8 mode and not lose any data? On May 12, 2007, at 5:04 AM, Dr.Ruud wrote: Tom Allison schreef: Under perl version 5.8, does /(\w+)/ match UTF-8 characters without calling any special pragma

regex utf8

2007-05-11 Thread Tom Allison
OK, I'm reading through different unicode related perldocs and have a rather simple question. Under perl version 5.8, does /(\w+)/ match UTF-8 characters without calling any special pragma? I'm having a hard time finding something that makes the statement that clearly. I'm trying to

Re: regex utf8

2007-05-11 Thread Tom Allison
Chas Owens wrote: On 5/11/07, Tom Allison [EMAIL PROTECTED] wrote: OK, I'm reading through different unicode related perldocs and have a rather simple question. Under perl version 5.8, does /(\w+)/ match UTF-8 characters without calling any special pragma? I'm having a hard time finding

Re: UTF-8/SA WORKAROUND only - NOT - a fix..

2007-05-10 Thread Tom Allison
Darn it. I came in too late on this subject to make any sense out of it. But I have a similar issue that I ran into and I'm wondering if you might be able to shed some light on it -- like am I going in the right direction. I have a bayesian spam filter that I wrote in perl and have been

LWP useragent and SSL

2007-05-09 Thread Tom Allison
I recently started using LWP::UserAgent to access some HTTPS sites and ran into a problem that doesn't easily present a solution. I have one site that I can connect to and use with great success using HTTPS. I have another where the site owner gave me a certificate on file to use for

Re: forking problem with dbd::mysql

2007-05-09 Thread Tom Allison
sing its handle unexpectedly. The solution: Setting a flag (InactiveDestroy) on the parent's handle inside the child process prevents the automagic closing of the connection. * the magic in this case is the DESTROY method of DBI::db Where do you get the inactiveDestroy? Is this something

Re: forking problem with dbd::mysql

2007-05-09 Thread Tom Allison
On May 9, 2007, at 5:41 PM, Jeff Pang wrote: -Original Message- From: Chas Owens [EMAIL PROTECTED] The solution: Setting a flag (InactiveDestroy) on the parent's handle inside the child process prevents the automagic closing of the connection. * the magic in this case is the

Re: MAC and install CPAN

2007-04-30 Thread Tom Allison
On Apr 29, 2007, at 9:36 PM, Tom Phoenix wrote: On 4/29/07, Tom Allison [EMAIL PROTECTED] wrote: Warning: prerequisite Mac::Carbon 0.77 not found. We have 0.71. Have you tried installing a newer version of Mac::Carbon? Yes I did, and the make failed on that as well. Which is why I'm

Mac::Carbon Bug

2007-04-30 Thread Tom Allison
Can anyone provide details on if a workaround exists for the growing lists of defects for Mac::Carbon not being installable? Mac::Carbon 25075 24770 24841 File::HomeDir 25075 I'm in need of installing DBI on my MacBook. As a general practice I was going to 'install Bundle::CPAN' and then

Re: MAC and install CPAN

2007-04-30 Thread Tom Allison
natively on the make. Jon On Apr 30, 2007, at 1:37 PM, Tom Allison wrote: On Apr 29, 2007, at 9:36 PM, Tom Phoenix wrote: On 4/29/07, Tom Allison [EMAIL PROTECTED] wrote: Warning: prerequisite Mac::Carbon 0.77 not found. We have 0.71. Have you tried installing a newer version of Mac

Re: MAC and install CPAN

2007-04-30 Thread Tom Allison
Installation of XCode *and* removing the CPAN configuration file * sudo rm /System/Library/Perl/5.8.6/CPAN/Config.pm did the trick. I'm now back in business.!! On Apr 30, 2007, at 12:27 PM, Jonathan Heard wrote: Have you installed the Developer Tools from Apple Developer Connection?

Re: Mac::Carbon Bug

2007-04-30 Thread Tom Allison
Thanks. I didn't subscribe to [EMAIL PROTECTED] because it said it was for OS 9... On Apr 30, 2007, at 3:57 PM, Jay Savage wrote: On 4/30/07, Tom Allison [EMAIL PROTECTED] wrote: Can anyone provide details on if a workaround exists for the growing lists of defects for Mac::Carbon not being

MAC and install CPAN

2007-04-29 Thread Tom Allison
Greetings. I've been using perl for years under Unix and yesterday I picked up a MacBook. It doesn't come with DBI, so I tried to instal it from CPAN... And installing from CPAN I always started with Bundle::CPAN to get a clean slate I haven't had any success with it and I'm really

Re: goto return ?

2006-11-28 Thread Tom Allison
Rob Dixon wrote: JupiterHost.Net wrote: What about doing this? return if do_one_then_two($whatever); ... sub do_one_then_two { my $what = $_[0]; if ($what) { one(); two(); return 1; } return 0; } Thanks, I'm not looking for how to handle a condition

Re: postgres insert

2006-11-25 Thread Tom Allison
D. Bolliger wrote: Tom Allison am Donnerstag, 23. November 2006 16:13: [snipped some code] I get a STDERR warning printed out everytime this has a duplicate key violation... Any idea why eval{} doesn't suppress this? Hi Tom It'd be a bad idea... eval BLOCK adds the ability to catch runtime

postgres insert

2006-11-23 Thread Tom Allison
I've been using something like this for Oracle for some time and tried it with Postgresql. (RaiseError doesn't change the outcome) sub insert_token { my $token = shift; eval{ $sth1-execute($token) }; if ($@) { return 1 if $@ =~ /duplicate key violates unique constraint/;

efficiently keeping a short list

2006-07-09 Thread Tom Allison
I want to keep a short list of the most recently used 'X'. 200 elements. Is there any suggestions other than to unshift @recent, $element; $#recent = $maximum; I know this will create a lot of array movement, but I can't think of anything better off the top of my head. You? -- To

Re: html - timtowtdi

2006-07-07 Thread Tom Allison
Thomas Bätzler wrote: Tom Allison [EMAIL PROTECTED] wrote: OK, perl almost has a problem with how many different ways to make web pages. I was looking around for something that was simple but mostly fast and common You might also want to check out Embperl and Mason - the latter being

html - timtowtdi

2006-07-06 Thread Tom Allison
OK, perl almost has a problem with how many different ways to make web pages. I was looking around for something that was simple but mostly fast and common (meaning I'll find mention of it in job postings some day...). Template and HTML::Template seem to be some pretty good starting points

threading a needle on TEST

2006-07-02 Thread Tom Allison
OK, I'm trying to set up some tests and I'm just getting hammered on all these little niggly points. So many of them that I have to assume I'm doing something fundamentally wrong. I used module-starter to kick start my little project and I now have some files that are auto-generated for me.

Re: threading a needle on TEST

2006-07-02 Thread Tom Allison
Tom Phoenix wrote: On 7/2/06, Tom Allison [EMAIL PROTECTED] wrote: So I tried to run all the tests at once using: perl -T -I/home/tom/foo/lib t/* and it runs only the first one found Ignoring the other 4 test scripts. Perl's -T runtime switch doesn't mean test! :-) If you want to run

Re: threading a needle on TEST

2006-07-02 Thread Tom Allison
Tom Allison wrote: And so I'm really frustrated and not sure how it's all suppose to glue together for me, Joe Developer who is trying to just write some modules for my own personal use with the idea that some year I can release something to CPAN. But some of these tools don't quite gel

CGI's

2006-06-03 Thread Tom Allison
what's the difference between SpeedyCGI CGI::Speedy CGI::Fast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Servlet

2006-05-30 Thread Tom Allison
How can I impliment a Servlet in Perl without writing my own http server or running apache? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Servlet::Http::HttpServlet

2006-05-27 Thread Tom Allison
I'm trying to put together an interface for an application of mine using this HttpServlet module. But I can't seem to find anything in the docs that actually explains how to use this module. Specifically, setting up and configuring the interface to listen to certain ports, define roles, and

Re: not forking

2006-05-16 Thread Tom Allison
Paul Johnson wrote: On Mon, May 15, 2006 at 04:46:07PM -0400, Tom Allison wrote: I've got a *bunch* of code that I've been rewriting recently and ran into a rather weird problem. it won't fork. If I write the following: foreach my $file ( @$files ) { my $pid = fork(); print $pid -- $file

not forking

2006-05-15 Thread Tom Allison
I've got a *bunch* of code that I've been rewriting recently and ran into a rather weird problem. it won't fork. If I write the following: foreach my $file ( @$files ) { my $pid = fork(); print $pid -- $file\n; [] } I will get an output of: 0 -- file_one 3242 -- file_one 0--

Re: Split function help

2006-04-25 Thread Tom Allison
Irfan J Sayed wrote: Hi, I have a following line/statement stored in variable $test deliver.Admin_Irfan_Project.20060413.212355 i want to split this line in . and store in array. I am using following code my @name = Split(/./, $test); split uses regular expressions to identify where to

Re: truncate

2006-04-25 Thread Tom Allison
Smith, Derek wrote: I want to use truncate to delete a matched line out a named.conf file on my DNS box. Here is my code As others have said, this will lop off the end of the file. Another option is to run perl -i and edit the file in place. while(){ print if /Acheck\-names/ } But under

arguments

2006-04-20 Thread Tom Allison
Maybe I'm getting old, but I'm starting to thing that if there is a method/sub/function/whatever that has more than one argument, one should always pass the args as a hash reference. This eliminates the problems of getting the variables out of order. It's probably slower and higher memory

Re: And a CGI question.

2006-03-26 Thread Tom Allison
Koms Bomb wrote: If I have a cgi script that send text/plain what does the client see if I send all the text at once but then don't exit for seconds because I'm doing some background processing at my end? do they sit and spin around in circles? Don't hang the

SMS or text messaging

2006-03-25 Thread Tom Allison
I'm pretty familiar with some (or enough) of the perl mail modules to send email whereever and however I need to. I'm trying to understand how this relates to text messages on cell phones. I've used email for sending text messages to pagers ([EMAIL PROTECTED]) but I don't know if the same

And a CGI question.

2006-03-25 Thread Tom Allison
If I have a cgi script that send text/plain what does the client see if I send all the text at once but then don't exit for seconds because I'm doing some background processing at my end? do they sit and spin around in circles? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Taint mode and SQL

2006-03-25 Thread Tom Allison
I was looking at some code of mine and it seems that there is a potential for a problem here that I wasn't aware of. I'm using CGI and DBI together and found that I can do the following under Taint just fine. my $username = $q-param('username'); and later one... my $sql = select .. from ..

SIGNALS OOP

2006-03-21 Thread Tom Allison
I'm trying to refactor an application I wrote a few months ago and ran into a question about SIG{TERM}. Currently I have a single application that uses the approach of: my $please_die = 0; $SIG{TERM} = sub {$please_die = 1 }; to control when I should exit out of different loops and structures.

Re: line by line file read

2006-03-07 Thread Tom Allison
Saurabh Singhvi wrote: Hi #!/usr/bin/perl open(FILE,'file') or die Couldn't open $!; while (1){ .. ... } } This is a sample code i am using to read a file Now the issue here is that the complete file gets loaded into memory at once and then the following job of

regex grrr

2006-03-07 Thread Tom Allison
Here's my problem: $one = 'this (is a) 1/2 measure example'; Try and run that through a regex like if ( $two =~ /$one/ ) { and it's pretty ugly. Who do I get the literal string for $one? In this case I think it would be something like: $two =~ /this \(is a\) 1\/2 measure example/ -- To

eval{}

2006-03-06 Thread Tom Allison
I ran into a potential problem when writing some code this weekend. I'm running a network socket to pick up data and then run it against a database connection before I return the response. Essentially it falls into a few steps: read from network read from database write to database do

Re: eval{}

2006-03-06 Thread Tom Allison
Jay Savage wrote: die on errors and just keep passing them up the line: eval { eval { eval { bad_system_call() or die $!\n; } or die $@; } or die $@; }; print eval says: [EMAIL PROTECTED] if $@; As long as you keep

Taint compliant mail checker

2006-03-02 Thread Tom Allison
I was interested in using Mail::CheckUser in a CGI script. I've liked it in the past for other applications that weren't exposed like a CGI script. However I just found out that the module is not compatable with the Taint pragma. Since I'm relatively new to writing CGI scripts and am

Re: Net::Server

2006-02-20 Thread Tom Allison
On 2/20/2006, Beau E. Cox [EMAIL PROTECTED] wrote: On Sunday 19 February 2006 13:52, Tom Phoenix wrote: On 2/18/06, Tom Allison [EMAIL PROTECTED] wrote: I am trying to set up a server using Net::Server. I believe that you omitted a vital piece at the top of your code: a package directive

Re: Net::Server

2006-02-20 Thread Tom Allison
Beau E. Cox wrote: On Monday 20 February 2006 10:06, Tom Allison wrote: package AuthServer; @ISA = qw[Net::Server]; my $server = bless { port = 8081, }, 'AuthServer'; $server-run(); No. This _works_: package AuthServer; use Net::Server; @ISA = qw[Net::Server]; AuthServer-run( port

Net::Server

2006-02-18 Thread Tom Allison
I am trying to set up a server using Net::Server. Mostly this is out of curiousity more than anything else. But following the man pages I got stuck. I was trying to set up a server to connect to port 8081, but none of the configuration options I've put in below appear in the file I'm running.

A question about CGI

2006-02-16 Thread Tom Allison
The easy thing would be to run a CGI script that connects to a database by putting the username and password right in the script. That's a great idea as long as I never have a condition where the script does a 'dump' to the screen. I'm not a fan of 'never'... So... What are the options?

BerkeleyDB

2006-02-13 Thread Tom Allison
I was trying out some jobs with the Berkeley DB and decided to move up from DB_File to BerkeleyDB. I don't need a lot of features, just speed. But I keep running into a dumb error that doesn't make any sense to me. untie attempted while 1 inner references still exist at ./dbm_test.pl line 31.

Re: BerkeleyDB

2006-02-13 Thread Tom Allison
Hans Meier (John Doe) wrote: Tom Allison am Dienstag, 14. Februar 2006 02.28: I was trying out some jobs with the Berkeley DB and decided to move up from DB_File to BerkeleyDB. I don't need a lot of features, just speed. But I keep running into a dumb error that doesn't make any sense to me

regex...

2006-01-09 Thread Tom Allison
I'm trying to capture the base URL and everything after that into two arguements for all web page elements related to href and src properties in tags. EG: a href = http://www.google.com/; would return 'www.google.com' and '/' So I tried this: $string =~

Re: How to run a batch file

2006-01-09 Thread Tom Allison
The Roopak Times wrote: Hi All how can i run a batch file by a perl script. i'm also getting a compilation error in following program. i have output of ping commnad in a text file and i want to replace the IP Address with the hostname. error is:- Global symbol %sites requires explicit package

Re: regex...

2006-01-09 Thread Tom Allison
Tom Allison wrote: I'm trying to capture the base URL and everything after that into two arguements for all web page elements related to href and src properties in tags. EG: a href = http://www.google.com/; would return 'www.google.com' and '/' So I tried this: $string =~ m|(?:href|src)\W

Re: 15 Million RAW

2005-11-25 Thread Tom Allison
Chris Devers wrote: On Thu, 24 Nov 2005, Pierre Smolarek wrote: Lorenzo Caggioni wrote: The program I written takes 25 sec for 10.000 line... too much How quickly do you need to it if 25 seconds is too long? If 10,000 lines take 25 seconds, you're doing 400 lines per second. At

ALARM

2005-11-22 Thread Tom Allison
I figured out I can do this: eval { local $SIG{ALRM} = sub { warn(alarm\n) }; alarm 1; for(my $j = 0; $j 1_000_000, $j++) { my $x = log(rand()*1000+1); } alarm 0; }; if ( $@ ) { carp [EMAIL PROTECTED]; } Which is very similar to

Re: ALARM

2005-11-22 Thread Tom Allison
John Doe wrote: Tom Allison am Dienstag, 22. November 2005 12.24: I figured out I can do this: eval { local $SIG{ALRM} = sub { warn(alarm\n) }; alarm 1; for(my $j = 0; $j 1_000_000, $j++) { my $x = log(rand()*1000+1); } alarm 0

Re: Mail::Send and Taint

2005-11-20 Thread Tom Allison
Tom Allison wrote: I think I just got burned on Mail::Send. I've been using it for months/years with no problem, but now I'm writing a web app and Taint won't let me use Mail::Send Insecure $ENV{PATH} while running with -T switch at /usr/share/perl5/Mail/Mailer/sendmail.pm line 16

Re: local $/ = '';

2005-11-19 Thread Tom Allison
Brian Volk wrote: Hi All~ I'm trying to get my head around local $/ = ''; #enable paragraph mode. This will match everytime it encounters a match like /^$/ in regex terms. Unfortunately, I can't seem to repeat your output. But if I change it to the following it works just find. BTW

Mail::Send and Taint

2005-11-19 Thread Tom Allison
I think I just got burned on Mail::Send. I've been using it for months/years with no problem, but now I'm writing a web app and Taint won't let me use Mail::Send Insecure $ENV{PATH} while running with -T switch at /usr/share/perl5/Mail/Mailer/sendmail.pm line 16. What got me is that I call

AJAX

2005-11-18 Thread Tom Allison
I'm wondering if this is possible. But can perl interact with an AJAX designed site as a client (LWP-ish)? (It's probably a really stupid question, but I just started reading on this stuff and thought I would ask about my fav programming language). -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: referencing functions

2005-11-16 Thread Tom Allison
Well, you can define the subs anywhere and use references: sub f { my $value = shift; print $value\n; } sub g { my $value = shift; print \t$value\n; } my %subs = ( f = \f, g = \g, ); Now THAT looks good. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: about email sender

2005-11-15 Thread Tom Allison
Mail::Send is great! Never dared Net::SMTP. MIME::Lite is also very reasonable to use. On 11/15/2005, ZHAO, BING [EMAIL PROTECTED] wrote: Hi, all: I have tried to read the email::sender module on CPAN, but it is far beyond my ablilty to understand it. And the synopsis gave me

referencing functions

2005-11-15 Thread Tom Allison
#!/usr/bin/perl use strict; use warnings; sub f { my $value = shift; print $value,\n; } sub g { my $value = shift; print \t,$value,\n; } my $var = shift; my $code = \$var; $code(test); = I got this working well enough but it's not quite

Re: referencing functions

2005-11-15 Thread Tom Allison
John W. Krahn wrote: Tom Allison wrote: #!/usr/bin/perl use strict; use warnings; sub f { my $value = shift; print $value,\n; } sub g { my $value = shift; print \t,$value,\n; } my $var = shift; my $code = \$var; $code(test); = I got

Re: combining array ref's

2005-11-14 Thread Tom Allison
John W. Krahn wrote: Tom Allison wrote: John W. Krahn wrote: Mike Blezien wrote: what is the most effecient way to combine multiple array refs into one array ref, IE: my $arrayrefA = ['1',2','3']; my $arrayrefB = ['4','5','6']; my $arrayrefC = ['7','8','9']; my $allarrayref = (Combine

Re: Why glob() ?

2005-11-13 Thread Tom Allison
Randal L. Schwartz wrote: Gustav == Gustav Wiberg [EMAIL PROTECTED] writes: Gustav Why to use glob()-command when I can use exec() ??? I don't get it... In modern Perl, glob() is internal, where exec/system/backquote/pipes are external, so it's very likely faster to use glob, perhaps ten or

Re: Why glob() ?

2005-11-13 Thread Tom Allison
Gustav Wiberg wrote: Hi again! If I understood it right... @list = glob('*.txt'); would return all files that ends with *.txt in current directory? Usually. If there are a lot of files in the directory, this will file. About the same time that the shell command 'rm' or 'ls' will faile if

Re: info pls

2005-11-13 Thread Tom Allison
Ssavitha wrote: Hi, Pls. let me know the connection string in perl script to connect to SQL server. Please let us know when you RTFM and don't forget to read DBI and don't forget that it depends on the database and you might even been using DBI::Class. -- To unsubscribe, e-mail:

Re: combining array ref's

2005-11-13 Thread Tom Allison
John W. Krahn wrote: Mike Blezien wrote: Hello, Hello, what is the most effecient way to combine multiple array refs into one array ref, IE: my $arrayrefA = ['1',2','3']; my $arrayrefB = ['4','5','6']; my $arrayrefC = ['7','8','9']; my $allarrayref = (Combine $arrayrefA $arrayrefB

regex question

2005-11-08 Thread Tom Allison
if ($text =~ /(.*?($crlf))\2(.*)/sm) { Do I read this right? the '\2' is a repeat character of the second match where match \1 is (.*?$crlf) and match \2 is $crlf ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: PS what is the correct/efficient function to create a file

2005-11-07 Thread Tom Allison
You could always use Shell module. Hi, unlink $file works fine, but link $file doesn't even exist, The sysopen function seems to be tedious, does anyone know how to effectively create a file in some directory in perl? -- To unsubscribe, e-mail:

regex heck

2005-11-03 Thread Tom Allison
I've been playing with some regex, Benchmark, and 'slurping' and found something that I could do (If I could get it to work) but not sure I want to do it. Benchmark: reading a file using: my $line = do {local $/; $file}; versus; while ($file) { } is ~2x faster on my

Binary Large Objects (BLOB) decoding

2005-10-27 Thread Tom Allison
I'm making a crude attempt to parse through some database BLOBS with some success. Some of the information is in XML format, some in text. But a lot of crud exists because of the binary characters. I originally tried this: my $ascii = unpack(A*, $blob); but with limited success. At least it

Re: flock network

2005-10-13 Thread Tom Allison
John Doe wrote: Tom Allison am Mittwoch, 12. Oktober 2005 15.55: [...] Since you got no answer yet from somebody knowing better: thanks, I'll look into it. I'm at a disadvantage since it is difficult to install something on this machine. I'm not root. -- To unsubscribe, e-mail: [EMAIL

test/debugging modules that are duplicates of existing modules.

2005-10-13 Thread Tom Allison
I'm pretty sure I'm not doing this right. I have two modules of the same name, current version and future version, in two different directories. $HOME/test/Module1.pm $HOME/test/Module2.pm $HOME/lib/Module1.pm $HOME/lib/Module2.pm and another module: $HOME/lib/Module3.pm Under perl -d I

flock network

2005-10-12 Thread Tom Allison
perldoc says I can't do flock over a network. I assume this is NFS mounted files. Two questions: How do I test for NFS mounting so I can flag it as a problem in my code? What options are there for locking over NFS besides using foo.lock files all over the place? -- To unsubscribe, e-mail:

fork + objects + logging

2005-10-11 Thread Tom Allison
fork(): I'm trying to put a perl wrapper around some clunky java code to make it play nicer. The best arrangement I have come up with is to use: open(JVM, java_app.sh |); I suppose I could use system() as well, but if I read correctly the STDOUT from the java application would become the

Re: TEST

2005-10-06 Thread Tom Allison
So make tests that just run the scripts and then examine the outputs. If there are unwanted side effects you can't undo from the test then you need to modify the script in some way. Is this where 'do' comes into use? This is why writing the tests *before* writing the code makes life so

TEST

2005-10-04 Thread Tom Allison
This isn't a test message sent to the list, that would be lame. ;) However it's all about Testing and how to do it the right way. I've been trying to use Test::More as the cornerstone of my testing. This kind of falls into a pseudo-philosophical discussion of how to code but I'll try really

Re: Need help with Perl Book

2005-10-04 Thread Tom Allison
Bobby Jafari wrote: Hi All, I am looking for a suitable Perl Book to buy. I use Perl mainly for running test scripts on Telecommunications based products. I use Net::SNMP and Net::Telnet extensively. I also need a book on a good GUI Interface for Perl. Is TK a good option? What are other GUI

Re: TEST

2005-10-04 Thread Tom Allison
Peter Scott wrote: On Tue, 04 Oct 2005 05:45:13 -0400, Tom Allison wrote: It seems that there really isn't any clear way to test a subroutine within a script and not a module. Besides loading it into a module and running everything from there -- any suggestions? I don't see it practical

Re: DBI fetch

2005-09-29 Thread Tom Allison
Peter Scott wrote: On Sat, 27 Aug 2005 14:07:09 +0300, Octavian Rasnita wrote: What do you think, if the most important is the speed, which method is recommended to get the results of a DBI query? fetchrow_arrayref or fetchrow_array (I guess that fetchrow_hashref has the lowest speed).

Re: Date in perl

2005-09-29 Thread Tom Allison
Gomez, Juan wrote: Hi all I have a problem need to work with date I have a input like these : 20050829 and I need to change it to something like this : Aug 29 2005 but it still eludes me how to do that can anyone help me please? thanks Armando I was going to say use

Re: Need a list of files in a dir.

2005-09-26 Thread Tom Allison
Wiggins d'Anconia wrote: Please bottom post... Daniel Kurtz wrote: Ooh ooh ooh! One I know! open(COMMAND, dir |); @files = COMMAND; Well, there's two methods that I use where I can and they are probably more portable. glob works well most of the time: @files = /directory/goes/here/*;

Re: the time a program runs

2005-09-26 Thread Tom Allison
Octavian Rasnita wrote: Hi, I have tried to find out the time a perl program runs, and I have used: #at the start of the program: my $begin = (times)[0]; my $begin_t = time(); ... The program follows # at the end of the program: my $end = (times)[0] - $begin; my $end_t = time() - $begin_t;

infile data

2005-09-06 Thread Tom Allison
I've been using the practice of putting something at the bottom of a file for holding static data, like SQL, by calling a __DATA__ handle: my $sql = join('',(DATA)); __DATA__ select . Is there any way to do this twice? To define two sets of static SQL? -- To unsubscribe, e-mail: [EMAIL

  1   2   >