Arrow dereference operator question

2007-05-31 Thread David Unric
Based on perlref documentation arrow operator between brackets subscripts may be omitted so the following code is valid: @array = ( [1, 2], [3, 4] ); $element = $array[0][0];# shorthand for $element = $array[0]-[0] Could somebody explain why it causes syntax error when the above rule is

Re: Arrow dereference operator question

2007-05-31 Thread Chas Owens
On 5/31/07, David Unric [EMAIL PROTECTED] wrote: Based on perlref documentation arrow operator between brackets subscripts may be omitted so the following code is valid: @array = ( [1, 2], [3, 4] ); $element = $array[0][0];# shorthand for $element = $array[0]-[0] Could somebody explain

Re: Outlook CSV Parser

2007-05-31 Thread Laxminarayan G Kamath A
On Wed, 30 May 2007 10:38:40 +0200, Dr.Ruud [EMAIL PROTECTED] wrote: You forgot to supply a link to such a file. Or show a __DATA__ section for testing. http://download.deeproot.in/~kamathln/outlook-encrtypted-sample.csv -- Cheers, Laxminarayan G Kamath A e-mail: [EMAIL PROTECTED] Work URL:

Re: Outlook CSV Parser

2007-05-31 Thread Mumia W.
On 05/31/2007 02:32 AM, Laxminarayan G Kamath A wrote: http://download.deeproot.in/~kamathln/outlook-encrtypted-sample.csv Well I asked for it. :-) It's impossible to tell where one record ends and another record begins with that file. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Outlook CSV Parser

2007-05-31 Thread Dr.Ruud
Laxminarayan G Kamath A: Ruud: You forgot to supply a link to such a file. Or show a __DATA__ section for testing. http://download.deeproot.in/~kamathln/outlook-encrtypted-sample.csv OK, lets check how wellformed it is: perl -we' local $/; $_ = ; s/[^]*//g; s/(?=,)[^,]+(?=,)//g;

Re: Arrow dereference operator question

2007-05-31 Thread David Unric
I did suspected it would have something to do with the difference between array and list contexts. Your analysis seems to be correct. Thank you for solving this puzzle :) Regards On 5/31/07, Chas Owens [EMAIL PROTECTED] wrote: On 5/31/07, David Unric [EMAIL PROTECTED] wrote: Based on

did I get greedy quantifiers wrong ?

2007-05-31 Thread Sharan Basappa
I seem to be having some conceptual problem with greedy quantifiers .. My understanding is that it matches as much as follows while still allowing rest of the regex to match. But look at the following example : $str = mississippi; $str =~ m/m(.*i)(.*pi)/; print one is $1 \n; print two is $2 \n;

Re: zero width lookahead match

2007-05-31 Thread jeevs
$ perl -wle' $string = abc; while ($string =~ /(.*?)/g) { print pos($string), : , $1;} ' 0: 1: a 1: 2: b 2: 3: c 3: Can someone explain the working of the g modifier since my knowledge of using g was to use it for substituting globally... Here i get what paul is trying to explain

Passing arguments to subroutine

2007-05-31 Thread Alma
Hi All, I need to pass the result of prepare statement as an argument to the subroutine. sub abc() { my $self= shift; my($id,$title) = @_; my $sth1= $databasehandle-prepare(select file_path from xyz where id='$id' and title like '$title'); my $res =

Re: zero width lookahead match

2007-05-31 Thread Sharan Basappa
Its the same logic - continue after first substitution/match. In case of subst.. it continues and in case of regex, the search continues after first match until the complete string is exhausted On 30 May 2007 22:54:39 -0700, jeevs [EMAIL PROTECTED] wrote: $ perl -wle' $string = abc; while

Re: Passing arguments to subroutine

2007-05-31 Thread Jonathan Lang
Alma wrote: Hi All, I need to pass the result of prepare statement as an argument to the subroutine. -snip- abc is calling delete_file() . where it need to delete the file stored at the location mentioned in file_path. Its not giving me an error but its not deleting the files from the

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Chas Owens
On 5/31/07, Sharan Basappa [EMAIL PROTECTED] wrote: snip $str =~ m/m(.*i?)(.*pi)/; snip ? only means non-greedy when following a * or a +. When it follows a pattern it means optional. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Chas Owens
On 5/31/07, Chas Owens [EMAIL PROTECTED] wrote: On 5/31/07, Sharan Basappa [EMAIL PROTECTED] wrote: snip $str =~ m/m(.*i?)(.*pi)/; snip ? only means non-greedy when following a * or a +. When it follows a pattern it means optional. Oh, and it makes the generalized* versions non-greedy as

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Sharan Basappa
Thanks Chas .. I was wondering about the first regex str =~ m/m(.*i)(.*pi)/; did not match all the way till mississip. In fact my initial understanding was that the regex would match mississippi leaving nothing for second regex. Can you throw some light on this .. On 5/31/07, Chas Owens [EMAIL

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Paul Lalli
On May 31, 6:02 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: I seem to be having some conceptual problem with greedy quantifiers .. My understanding is that it matches as much as follows while still allowing rest of the regex to match. 90% correct. The other 10% is that the match starts

Re: Passing arguments to subroutine

2007-05-31 Thread Paul Lalli
On May 31, 4:27 am, [EMAIL PROTECTED] (Alma) wrote: I need to pass the result of prepare statement as an argument to the subroutine. sub abc() The () there very specifically say This subroutine takes no arguments. { my $self= shift; my($id,$title) = @_; ... and yet

Re: Passing arguments to subroutine

2007-05-31 Thread Chas Owens
On 31 May 2007 01:27:26 -0700, Alma [EMAIL PROTECTED] wrote: snip deleteposter_file(@row); snip sub delete_file() snip This would seem to be the problem, also where did you learn that you should put on the front of your subroutine calls? I am curious because I keep seeing people do

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Chas Owens
On 5/31/07, Sharan Basappa [EMAIL PROTECTED] wrote: Thanks Chas .. I was wondering about the first regex str =~ m/m(.*i)(.*pi)/; did not match all the way till mississip. In fact my initial understanding was that the regex would match mississippi leaving nothing for second regex. Can you throw

Re: Passing arguments to subroutine

2007-05-31 Thread yitzle
On 31 May 2007 01:27:26 -0700, Alma [EMAIL PROTECTED] wrote: -- snip -- unlink($file_path); -- snip -- I'm aware that the question was already answered, but a generic tip for the future. You could try adding a statement like: print Deleting $file_path\n; to help debug and ensure the

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread yitzle
Untested code. $str = mississippi; $str =~ m/m(.*i)/; print $1; # Should output mississippi $str = mississippi; $str =~ m/m(.*i)(.*pi)/; This requires $2 to have .*pi in it. Since this is a greedy RegEx, $1 will grab mississi (must end by an i) and leave as little as possible for $2 - ie ppi.

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Sharan Basappa
Thanks a lot Paul .. For this rule : $str = mississippi; $str =~ m/m(.*i)(.*pi)/; My initial understanding was that .*i would match all the way till last char i. This would indeed be true if .*i was not followed by .*pi. Do you agree ? On 31 May 2007 06:11:45 -0700, Paul Lalli [EMAIL

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Paul Lalli
On May 31, 10:15 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: Thanks a lot Paul .. For this rule : $str = mississippi; $str =~ m/m(.*i)(.*pi)/; My initial understanding was that .*i would match all the way till last char i. This would indeed be true if .*i was not followed by .*pi.

Re: Passing arguments to subroutine

2007-05-31 Thread Chas Owens
On 5/31/07, yitzle [EMAIL PROTECTED] wrote: snip I suspect one of the tutorials that Google or Perl.org points to has something in it that needs correcting. snip Probably more than one thing. I would suggest reading the following books to learn Perl and to only use random tutorials on the

Sending mail without a callback

2007-05-31 Thread Ben Edwards
Have been googleing for a while and don't seem to be able to find a perl library which allows me to send an email without having to resort to a callback. Can someone please point me in the correct direction. Ben -- Ben Edwards - Bristol, UK If you have a problem emailing me use

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread Sharan Basappa
Thanks Paul, Yitzle .. On 31 May 2007 07:28:26 -0700, Paul Lalli [EMAIL PROTECTED] wrote: On May 31, 10:15 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: Thanks a lot Paul .. For this rule : $str = mississippi; $str =~ m/m(.*i)(.*pi)/; My initial understanding was that .*i would match all

Re: Sending mail without a callback

2007-05-31 Thread Chas Owens
On 5/31/07, Ben Edwards [EMAIL PROTECTED] wrote: Have been googleing for a while and don't seem to be able to find a perl library which allows me to send an email without having to resort to a callback. Can someone please point me in the correct direction. snip use Mail::Sender; my $sender

Re: Outlook CSV Parser

2007-05-31 Thread Dr.Ruud
Mumia W. schreef: Laxminarayan G Kamath A: http://download.deeproot.in/~kamathln/outlook-encrtypted-sample.csv Well I asked for it. :-) It's impossible to tell where one record ends and another record begins with that file. Maybe not, because the rule was that it ends at newline, unless

ScanAlert XSS warnings

2007-05-31 Thread Mike Blezien
Hello, there is a script on our site, that receives this warning from the HackSafe scanalerts -- ... The remote web application appears to be vulnerable to cross site scripting (XSS). General Solution: HTML encode

Re: Passing arguments to subroutine

2007-05-31 Thread Paul Lalli
On May 31, 10:15 am, [EMAIL PROTECTED] (Yitzle) wrote: I suspect one of the tutorials that Google or Perl.org points to has something in it that needs correcting. Actually, it's an unfortunate truth that up until Edition 3, the Llama itself recommended that you use the to call subroutines...

Re: ScanAlert XSS warnings

2007-05-31 Thread Tom Phoenix
On 5/31/07, Mike Blezien [EMAIL PROTECTED] wrote: there is a script on our site, that receives this warning from the HackSafe scanalerts -- ... The remote web application appears to be vulnerable to cross site

Re: ScanAlert XSS warnings

2007-05-31 Thread Mike Blezien
Tom, - Original Message - From: Tom Phoenix [EMAIL PROTECTED] To: Mike Blezien [EMAIL PROTECTED] Cc: Perl List beginners@perl.org Sent: Thursday, May 31, 2007 1:46 PM Subject: Re: ScanAlert XSS warnings On 5/31/07, Mike Blezien [EMAIL PROTECTED] wrote: there is a script on our

Re: IO::Socket::INET client hangs on no server on windoze

2007-05-31 Thread kenTk
On May 29, 7:55 pm, [EMAIL PROTECTED] (kenTk) wrote: On May 29, 2:40 pm, [EMAIL PROTECTED] (Zentara) wrote: On 28 May 2007 08:28:35 -0700, [EMAIL PROTECTED] (kenTk) wrote: If there is no server or no connection this hangs for about 20 seconds and then crashes with the following error

Re: Passing arguments to subroutine

2007-05-31 Thread [EMAIL PROTECTED]
On May 31, 9:27 am, [EMAIL PROTECTED] (Alma) wrote: sub delete_file() { my $self = shift; my $file_path = @_; That sets $file_path to the number of arguments in the call to the method delete_file(). To set $file_path to the first of the arguments in the call to the method

Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Alma
Hi , Urgent help. I have written 2 modules one abc.pm xyz.pm (admin modules). abc.pm -- my $databasehandle; sub new($){ my ($self,$usr,$pwd) = @_; $usr||= test; $pwd ||= test123; ($self) = {}; bless($self); $databasehandle =

Re: Arrow dereference operator question

2007-05-31 Thread [EMAIL PROTECTED]
On May 31, 7:55 am, [EMAIL PROTECTED] (David Unric) wrote: Based on perlref documentation arrow operator between brackets subscripts may be omitted so the following code is valid: @array = ( [1, 2], [3, 4] ); $element = $array[0][0];# shorthand for $element = $array[0]-[0] Could

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread jeevs
On May 31, 3:02 pm, [EMAIL PROTECTED] (Sharan Basappa) wrote: I seem to be having some conceptual problem with greedy quantifiers .. My understanding is that it matches as much as follows while still allowing rest of the regex to match. But look at the following example : $str = mississippi;

Re: Passing arguments to subroutine

2007-05-31 Thread [EMAIL PROTECTED]
On May 31, 9:27 am, [EMAIL PROTECTED] (Alma) wrote: Hi All, I need to pass the result of prepare statement as an argument to the subroutine. sub abc() { my $self= shift; my($id,$title) = @_; my $sth1= $databasehandle-prepare(select file_path from xyz where

Re: did I get greedy quantifiers wrong ?

2007-05-31 Thread [EMAIL PROTECTED]
On May 31, 11:02 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: I seem to be having some conceptual problem with greedy quantifiers .. My understanding is that it matches as much as follows while still allowing rest of the regex to match. Yes. That is correct. $str = mississippi; $str =~

Re: Arrow dereference operator question

2007-05-31 Thread [EMAIL PROTECTED]
On May 31, 7:55 am, [EMAIL PROTECTED] (David Unric) wrote: Based on perlref documentation arrow operator between brackets subscripts may be omitted so the following code is valid: @array = ( [1, 2], [3, 4] ); $element = $array[0][0];# shorthand for $element = $array[0]-[0] Could

Re: encode UTF8 - MIME

2007-05-31 Thread [EMAIL PROTECTED]
On May 30, 5:58 pm, [EMAIL PROTECTED] (Chas Owens) wrote: On 30 May 2007 06:07:55 -0700, cc96ai [EMAIL PROTECTED] wrote: snip I have a UTF8 input $value = %23%C2%A9%C2%AE%C3%98%C2%A5%C2%BC%C3%A9%C3%8B %C3%B1%C3%A0%C3%A6%3F%23; the HTML output should be #(c)(r)Ø¥¼éËñàæ?#; but I cannot

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Jonathan Lang
Alma wrote: Hi , Urgent help. I have written 2 modules one abc.pm xyz.pm (admin modules). abc.pm -- my $databasehandle; Note that this establishes a single $databasehandle for every object of type 'abc' that you create; it does not create a separate one

Re: encode UTF8 - MIME

2007-05-31 Thread oryann9
Oddly, there's a uri_unescape_utf8 but no uri_unescape_utf8 provided by URI::Escape. However combining URI::Escape::uri_unescape() and Encode::decode_utf8() in one statement is not overly taxing. use Encode; use URI::Escape qw(uri_unescape); my $e_accute = decode_utf8 uri_unescape

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Chas Owens
On 5/31/07, Jonathan Lang [EMAIL PROTECTED] wrote: snip Again, you have a signature problem. 'sub new($)' says that 'new' will take a single scalar as a parameter; as such, @_ will only ever have one value in it: $usr and $pwd will always be set to null. snip Well, there is a prototype

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Chas Owens
On 31 May 2007 06:17:50 -0700, Alma [EMAIL PROTECTED] wrote: snip I am getting an error : Can't locate object method prepare via package abc at xyz.pm snip Besides the things that are wrong that other people have mentioned, you need to make the abc class a subclass of DBI. This being Perl

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Mumia W.
On 05/31/2007 08:17 AM, Alma wrote: [...] $database_handle = abc-new('test','test123'); [...] No, the 'new' method of 'abc' returns an object of type 'abc'--not a database handle. Review the return statement in abc::new again. sub display() { my $self = shift; my $sth =

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Jonathan Lang
Chas Owens wrote: Well, there is a prototype problem, but it isn't that $ will force new to only accept one value, but rather that prototypes and OO Perl don't mix. Perl simply ignores prototypes on methods. Also prototypes are broken*, don't use them. -snip- *

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Chas Owens
On 5/31/07, Jonathan Lang [EMAIL PROTECTED] wrote: snip Also prototypes are broken*, don't use them. -snip- * http://library.n0i.net/programming/perl/articles/fm_prototypes/ Broken and don't use them is a bit extreme. But I will agree with the general sentiment that they should not be used as

Effective date grab

2007-05-31 Thread Mathew Snyder
A while ago I had posted requesting help with a long block of code that would do all kinds of stuff dealing with the date. It turned out to not work despite being technically, correct. Instead of getting help with it, Mr. Phoenix provided me with a block of code that did what I needed but much

Re: Effective date grab

2007-05-31 Thread yitzle
Too tired to write real code. Pseudo-code: use timelocal; @curTime = localtime; $curTime[3] = 1; # Set to first of the month $time = timelocal @curTime; # The 'time' as of the forst of the month $thisMonth = $curTime[4]; $dayLength = 24*60*60; do { @dataToUse = localtime $time; # do the

Re: Effective date grab

2007-05-31 Thread Mathew Snyder
Yes, a month from the first to the last day. This is how I'm doing it right now which seems to be a lot of code which should be able to be pruned: #Declare the variables we'll need my $count = 1; my $febDays; my @days; my %time; my %months31 = ( 01 = undef, 03 = undef, 05