Re: Strange problem with substr() function and right aligned fields

2009-03-05 Thread Jenda Krynicky
From: "Bill Harpley" 
> My Comment:  this is an obvious approach, with numerous advantages.
> However, it requires installation of the BD:Oracle module, which can be
> very tricky.
> Basically, I started to install and configure all of this (Perl,
> DBI,DB:Oracle) on HP-UX 11.31 but after 4 days I ran out of time. That
> is why I resorted to SQL*Plus queries :-(
> 
> If I can find the time next week, I will finish the installation next
> week, though success is not guaranteed { :-(  x 2 }

I bet you could get help here or at dbi-us...@perl.org
Not from me because I've never met HP-UX and it's almost ten years 
since I needed DBD::Oracle, but I bet there are people with enough 
experience with both here.

All I remember is that you had to have the Oracle client libraries 
installed and had to tell the Makefile.PL where to find them. But how 
...

Good luck, Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Strange problem with substr() function and right aligned fields

2009-03-05 Thread Bill Harpley
Jenda,

Thanks for questioning my method of approach:

> I must process the output of an SQL query using Perl.
> 
> I know the column position of the data in the output file, which means

> that I am able to calculate the width of each field.
> 
> All of the data in the file is left-aligned to the field, except for 
> one column.
> ...

"Why do you write the SQL query results into a text file only to have to
parse them out later? Run the SQL from the Perl script via DBI and you
will not need any substr().

Jenda"
=
 

My Comment:  this is an obvious approach, with numerous advantages.
However, it requires installation of the BD:Oracle module, which can be
very tricky.
Basically, I started to install and configure all of this (Perl,
DBI,DB:Oracle) on HP-UX 11.31 but after 4 days I ran out of time. That
is why I resorted to SQL*Plus queries :-(

If I can find the time next week, I will finish the installation next
week, though success is not guaranteed { :-(  x 2 }

Regards,
BiLL





--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Strange problem with substr() function and right aligned fields

2009-03-05 Thread Jenda Krynicky
From: "Bill Harpley" 
> I must process the output of an SQL query using Perl.
> 
> I know the column position of the data in the output file, which means
> that I am able to calculate the width of each field.
> 
> All of the data in the file is left-aligned to the field, except for one
> column.
> ...

Why do you write the SQL query results into a text file only to have 
to parse them out later? Run the SQL from the Perl script via DBI and 
you will not need any substr().

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Strange problem with substr() function and right aligned fields

2009-03-03 Thread John W. Krahn

Bill Harpley wrote:

I must process the output of an SQL query using Perl.

I know the column position of the data in the output file, which means
that I am able to calculate the width of each field.

All of the data in the file is left-aligned to the field, except for one
column.

Basically, in the output of the SQ query, the right-aligned colum looks
like this: 
	NODE_UL 
= 
		146 
		281 
		985 
So both the data and Field Title are right-aligned to the column. 
I am using a function cal of the form:

$field_value=substr( $input_line , $field_start, $field_width ) ;
Where:
$input_line : line read from the source data file
$field_start : fixed value read from a table (array)
$field_width : calculated value of the field width, from the field
boundary definitions in the table
$field_value: value retruned by the function
However, for some strange reason, the Perl substr() function is unable
to read the right-most character of a right-aligned field. So in the
output data the above numbers would be 14, 28, 98. 
I have extended the boundary column number in the field definition

table, so that substr() uses a bigger field width. But this has not
solved the problem. Extending the field boundary to the right has no
effect, even if I use a ridiculous value.
Does this sound like some sort of bug?? The substr() function has no
problem processing left-aligned fields and I have have said, increasing
the field width does not solve the problem either.
I am using Perl 5.8.4 on Solaris.


I found this in perl585delta.pod:

   ·   Several obscure bugs involving manipulating Unicode strings 
with "substr" have been fixed.



So perhaps you are dealing with Unicade strings?



John
--
Those people who think they know everything are a great
annoyance to those of us who do.-- Isaac Asimov


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Strange problem with substr() function and right aligned fields

2009-03-03 Thread Bill Harpley
I must process the output of an SQL query using Perl.

I know the column position of the data in the output file, which means
that I am able to calculate the width of each field.

All of the data in the file is left-aligned to the field, except for one
column.

Basically, in the output of the SQ query, the right-aligned colum looks
like this: 
NODE_UL 
= 
146 
281 
985 
So both the data and Field Title are right-aligned to the column. 
I am using a function cal of the form:
$field_value=substr( $input_line , $field_start, $field_width ) ;
Where:
$input_line : line read from the source data file
$field_start : fixed value read from a table (array)
$field_width : calculated value of the field width, from the field
boundary definitions in the table
$field_value: value retruned by the function
However, for some strange reason, the Perl substr() function is unable
to read the right-most character of a right-aligned field. So in the
output data the above numbers would be 14, 28, 98. 
I have extended the boundary column number in the field definition
table, so that substr() uses a bigger field width. But this has not
solved the problem. Extending the field boundary to the right has no
effect, even if I use a ridiculous value.
Does this sound like some sort of bug?? The substr() function has no
problem processing left-aligned fields and I have have said, increasing
the field width does not solve the problem either.
I am using Perl 5.8.4 on Solaris.
I know I could probably fix this by tweaking the SQL query but it would
still be nice to know what exactly is going on here.
Thanks in advance for any help you can give.

Regards,
Bill Harpley






Problem with substr

2002-08-02 Thread Pablo Jejcic

Hi, I have the attached problem with a PERL program. I'm trying to read
a cookie from an ASP page.

If anyone have any idea, it will be really appreciated.-

Pablo.-


--- Begin Message ---



Use of uninitialized value in index at ./outlook-grabber.pl line 232.
Use of uninitialized value in substr at ./outlook-grabber.pl line 232.


And line 232 looks like:

  for ($cnt=0; $cnt")
{
  $ignore = 2;
}
  }
  return $newtext;
}





--- End Message ---

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]