Passing options to subroutines and modules! (First time writing a module!)

2007-03-12 Thread Benct Philip Jonsson
Dear all! I'm writing a module (strictly for in-house use!) for converting an in-house legacy encoding -- from the time when you had to fake the ordinary alphabet + whatever special characters you needed onto the 223 characters of whatever 8-bit encoding your OS happened to support -- to

Re: Passing options to subroutines and modules! (First time writing a module!)

2007-03-12 Thread Chas Owens
On 3/11/07, Benct Philip Jonsson [EMAIL PROTECTED] wrote: snip :use HTML::Entities; : :sub transliterate ($;$){ my($text,$option) = @_; : :# Begin troblesome part! :if($option ref $option ne 'HASH'){ :die The second argument to transliterate() must :

Regular expression, not this string

2007-03-12 Thread Dave Cardwell
Hello there, I'm having trouble constructing a regular expression that would do the following: FOO... ...followed by anything but BAR (non-greedy)... ...followed by BAZ (captured)... ...followed by anything but BAR (greedy)... ...followed by BAR I've been looking at zero-width negative

Re: Regular expression, not this string

2007-03-12 Thread Chas Owens
On 3/12/07, Dave Cardwell [EMAIL PROTECTED] wrote: Hello there, I'm having trouble constructing a regular expression that would do the following: FOO... ...followed by anything but BAR (non-greedy)... ...followed by BAZ (captured)... ...followed by anything but BAR (greedy)... ...followed by

Re: Regular expression, not this string

2007-03-12 Thread Chas Owens
On 3/12/07, Chas Owens [EMAIL PROTECTED] wrote: The key here is zero-width. These constructs do not consume any characters, so they must be combine with patterns that do: /^FOO(?!BAR).*?(BAZ)(?!BAR).*BAR/ However, this will only work if BAR directly follows FOO. This string will still

Re: Regular expression, not this string

2007-03-12 Thread Chas Owens
On 3/12/07, Chas Owens [EMAIL PROTECTED] wrote: On 3/12/07, Chas Owens [EMAIL PROTECTED] wrote: The key here is zero-width. These constructs do not consume any characters, so they must be combine with patterns that do: /^FOO(?!BAR).*?(BAZ)(?!BAR).*BAR/ However, this will only work if BAR

Query regarding seek and tell

2007-03-12 Thread Beginner
Hi, When I ask for the filehandle position (tell) it is reporting the pointer as being a few bytes further along than I expect it to be. For instance if I do this: #!/bin/perl use strict; use warnings; my ($start,$d,$var); my $file = 'myjpeg.jpg'; open(FH,$file) or die Can't open $file:

Re: Regular expression, not this string

2007-03-12 Thread Rob Dixon
Dave Cardwell wrote: Hello there, I'm having trouble constructing a regular expression that would do the following: FOO... ...followed by anything but BAR (non-greedy)... ...followed by BAZ (captured)... ...followed by anything but BAR (greedy)... ...followed by BAR I've been looking at

Re: Query regarding seek and tell

2007-03-12 Thread Tom Phoenix
On 3/12/07, Beginner [EMAIL PROTECTED] wrote: When I ask for the filehandle position (tell) it is reporting the pointer as being a few bytes further along than I expect it to be. binmode(FH); while (FH) { If it's a binary file, you shouldn't read it by lines, which is what this does. You

Re: Regular expression, not this string

2007-03-12 Thread Dave Cardwell
Chas Owens wrote: On 3/12/07, Chas Owens [EMAIL PROTECTED] wrote: On 3/12/07, Chas Owens [EMAIL PROTECTED] wrote: The key here is zero-width. These constructs do not consume any characters, so they must be combine with patterns that do: /^FOO(?!BAR).*?(BAZ)(?!BAR).*BAR/ However, this

Re: Query regarding seek and tell

2007-03-12 Thread Beginner
On 12 Mar 2007 at 9:34, Tom Phoenix wrote: On 3/12/07, Beginner [EMAIL PROTECTED] wrote: When I ask for the filehandle position (tell) it is reporting the pointer as being a few bytes further along than I expect it to be. binmode(FH); while (FH) { If it's a binary file, you

Re: Regular expression, not this string

2007-03-12 Thread Dave Cardwell
Rob Dixon wrote: Dave Cardwell wrote: Hello there, I'm having trouble constructing a regular expression that would do the following: FOO... ...followed by anything but BAR (non-greedy)... ...followed by BAZ (captured)... ...followed by anything but BAR (greedy)... ...followed by BAR I've

Re: Query regarding seek and tell

2007-03-12 Thread Rob Dixon
Beginner wrote: Hi, When I ask for the filehandle position (tell) it is reporting the pointer as being a few bytes further along than I expect it to be. For instance if I do this: #!/bin/perl use strict; use warnings; my ($start,$d,$var); my $file = 'myjpeg.jpg'; open(FH,$file) or die Can't

Removing blank lines

2007-03-12 Thread Grant
Hello, I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use (and highly recommend) interchange: http://www.icdevgroup.org I basically want to wrap all of my code in [filter no_blank_lines][/filter].

Re: Removing blank lines

2007-03-12 Thread Beginner
On 12 Mar 2007 at 11:09, Grant wrote: Hello, I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use (and highly recommend) interchange: http://www.icdevgroup.org I basically want to wrap all of my code in

Re: Regular expression, not this string

2007-03-12 Thread Rob Dixon
Dave Cardwell wrote: Rob Dixon wrote: Dave Cardwell wrote: Hello there, I'm having trouble constructing a regular expression that would do the following: FOO... ...followed by anything but BAR (non-greedy)... ...followed by BAZ (captured)... ...followed by anything but BAR (greedy)...

RE: Removing blank lines

2007-03-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
-Original Message- From: Beginner [mailto:[EMAIL PROTECTED] Sent: Monday, March 12, 2007 11:16 To: beginners@perl.org Subject: Re: Removing blank lines On 12 Mar 2007 at 11:09, Grant wrote: Hello, I'm having a lot of trouble figuring out how to remove blank lines from

Re: Regular expression, not this string

2007-03-12 Thread Dave Cardwell
Rob Dixon wrote: Dave Cardwell wrote: Rob Dixon wrote: Dave Cardwell wrote: Hello there, I'm having trouble constructing a regular expression that would do the following: FOO... ...followed by anything but BAR (non-greedy)... ...followed by BAZ (captured)... ...followed by anything but BAR

Re: Removing blank lines

2007-03-12 Thread Rob Dixon
Grant wrote: Hello, I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use (and highly recommend) interchange: http://www.icdevgroup.org I basically want to wrap all of my code in [filter no_blank_lines][/filter].

What module should I use for this: SOAP, XML?

2007-03-12 Thread Zembower, Kevin
I'm trying to extract a single variable from a page like http://www.weather.gov/data/current_obs/KDMH.xml. This is the National Weather Services current observations for Baltimore's Inner Harbor. I'm just interested in the data enclosed by temp_f tags, the current temperature. I just want to get

Re: Removing blank lines

2007-03-12 Thread Grant
Hello, I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use (and highly recommend) interchange: http://www.icdevgroup.org I basically want to wrap all of my code in [filter

Re: Removing blank lines

2007-03-12 Thread Rob Dixon
Wagner, David --- Senior Programmer Analyst --- WGO wrote: -Original Message- From: Beginner [mailto:[EMAIL PROTECTED] Sent: Monday, March 12, 2007 11:16 To: beginners@perl.org Subject: Re: Removing blank lines On 12 Mar 2007 at 11:09, Grant wrote: Hello, I'm having a lot of

Re: Removing blank lines

2007-03-12 Thread Grant
I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use (and highly recommend) interchange: http://www.icdevgroup.org I basically want to wrap all of my code in [filter no_blank_lines][/filter]. no_blank_lines

Re: Query regarding seek and tell

2007-03-12 Thread Tom Phoenix
On 3/12/07, Beginner [EMAIL PROTECTED] wrote: What I am tring to do is find the x and y dimension of a jpeg Ah, Image::Size. http://search.cpan.org/~rjray/Image-Size-3.01/lib/Image/Size.pm Enjoy! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Generating Graphs with Perl

2007-03-12 Thread Bary Gold
I am using Perl within web pages created at the DBMS site www.baseportal.com. So, when Perl executes, it executes at their site and not mine. As a consequence, I am unable to download and install anything, period. I am creating interesting (for me that is) applications at this site. But I would

Re: Query regarding seek and tell

2007-03-12 Thread Beginner
On 12 Mar 2007 at 10:49, Tom Phoenix wrote: On 3/12/07, Beginner [EMAIL PROTECTED] wrote: What I am tring to do is find the x and y dimension of a jpeg Ah, Image::Size. http://search.cpan.org/~rjray/Image-Size-3.01/lib/Image/Size.pm Enjoy! Image::size Image::Info and the

Re: Generating Graphs with Perl

2007-03-12 Thread Tom Phoenix
On 3/12/07, Bary Gold [EMAIL PROTECTED] wrote: I am using Perl within web pages created at the DBMS site www.baseportal.com. So, when Perl executes, it executes at their site and not mine. As a consequence, I am unable to download and install anything, period. Not ANYTHING anything, not even

Re: Removing blank lines

2007-03-12 Thread Rob Dixon
Grant wrote: I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use (and highly recommend) interchange: http://www.icdevgroup.org I basically want to wrap all of my code in [filter no_blank_lines][/filter].

Re: Removing blank lines

2007-03-12 Thread yitzle
Have the data in an array and do i = 0; foreach (@text) { $text2[i++] = $_ if (! m/^\s$/); } On 3/12/07, Rob Dixon [EMAIL PROTECTED] wrote: Grant wrote: I'm having a lot of trouble figuring out how to remove blank lines from my HTML. The lines are generated by my shopping cart. I use

Re: Removing blank lines

2007-03-12 Thread Tom Phoenix
On 3/12/07, yitzle [EMAIL PROTECTED] wrote: Have the data in an array and do i = 0; foreach (@text) { $text2[i++] = $_ if (! m/^\s$/); } If you had remembered to put a dollar sign on $i, you'd be reinventing grep: my @text2 = grep ! /^\s$/, @text; Cheers! --Tom Phoenix Stonehenge Perl

Re: Removing blank lines

2007-03-12 Thread Grant
$val =~ s/^\s*\n//mg; I'm not having any luck there either. I'm not sure what is actually creating the blank lines. It could be spaces, tabs, or some other blank line creator. The \s marker will match all of those. Can you show us your code please? Don't forget that your function is

Re: What module should I use for this: SOAP, XML?

2007-03-12 Thread Chas Owens
On 3/12/07, Zembower, Kevin [EMAIL PROTECTED] wrote: I'm trying to extract a single variable from a page like http://www.weather.gov/data/current_obs/KDMH.xml. This is the National Weather Services current observations for Baltimore's Inner Harbor. I'm just interested in the data enclosed by

Re: What module should I use for this: SOAP, XML?

2007-03-12 Thread Jenda Krynicky
From: Zembower, Kevin [EMAIL PROTECTED] I'm trying to extract a single variable from a page like http://www.weather.gov/data/current_obs/KDMH.xml. This is the National Weather Services current observations for Baltimore's Inner Harbor. I'm just interested in the data enclosed by temp_f tags,

Re: Unescaping a string escaped with Javascript

2007-03-12 Thread Jay Savage
On 3/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi All I am updataing an application that includes a section which has a number of strings created on a WEB page and escaped with Javascript escape before being sent to a perl script. The original application had a custom unescape function

Multiple character command line switch

2007-03-12 Thread brajesh agrawal
Hi all, I was trying to write a script. I wanted to use multiple characters in command line switches. For example myScript -f1 file1 -f2 file2 now getopt or getopts allows only for single character switches (please correct me if its not true). Is there any module which will allow my to have

Question about system call

2007-03-12 Thread Mathew
I recently forgot about the unlink function and had been trying to remove files using the less efficient system call to run rm -f /path/to/files. I found, however, that this didn't work at all. I've since replaced it with unlink and get the results one can expect to get so it isn't a matter of

Re: Multiple character command line switch

2007-03-12 Thread Jeff Pang
Hi all, I was trying to write a script. I wanted to use multiple characters in command line switches. For example myScript -f1 file1 -f2 file2 now getopt or getopts allows only for single character switches (please correct me if its not true). Is there any module which will allow my to have

Re: Multiple character command line switch

2007-03-12 Thread yitzle
You can access the command line parameters directly without any module with @ARGV. Not sure if this helps. myScript -f1 file1 -f2 file2 Something like this might work: for ( $i = 0; $i [EMAIL PROTECTED] - 1; $i += 2 ) { hash{AGV[$i]} = AGV[$i + 1]; } print FIle 1: $hash{'-f'}; On 3/13/07,

Re: Question about system call

2007-03-12 Thread Jeff Pang
I recently forgot about the unlink function and had been trying to remove files using the less efficient system call to run rm -f /path/to/files. I found, however, that this didn't work at all. I've since replaced it with unlink and get the results one can expect to get so it isn't a matter of

Re: Question about system call

2007-03-12 Thread yitzle
Where you doing rm -f $file or `rm -f $file`? You need to use backticks for system commands. On 3/13/07, Mathew [EMAIL PROTECTED] wrote: I recently forgot about the unlink function and had been trying to remove files using the less efficient system call to run rm -f /path/to/files. I found,