Problem with Read() in PerlMagick

G

guba

Hello,

I have txt files with paths of image files and
parameter values for image processing operations
in PerlMagick. The structure is like this:

name of the variable without $
variable value

for example:

....
background_jp2_path
E:/ART/IM_Composing/Planes/2004/Tile14/T14-2004_04_30a-1-16T.JP2
crop_width
1222
background_x
2123
background_y
192
background_x_roll
489
....

I wrote a program that reads such txt files,
defines the variables and gets the variable
values like
$background_jp2_path = 'E:/ART/...'
I checked that all variables have the right
values with the print command.

But if I want to read the image file with
$background->Read("$background_jp2_path");
nothing happens!!
The variable has for sure
the right value and the file exists at the
right place which is proven by inserting
the path value by hand
$background->Read("E:/ART/...");
and this works.

Why is the Read()-command not working?
Thank you very much!
 
A

anno4000

Hello,

I have txt files with paths of image files and
parameter values for image processing operations
in PerlMagick. The structure is like this:

name of the variable without $
variable value

for example:

...
background_jp2_path
E:/ART/IM_Composing/Planes/2004/Tile14/T14-2004_04_30a-1-16T.JP2
crop_width
1222
background_x
2123
background_y
192
background_x_roll
489
...

I wrote a program that reads such txt files,
defines the variables and gets the variable
values like
$background_jp2_path = 'E:/ART/...'
I checked that all variables have the right
values with the print command.

But if I want to read the image file with
$background->Read("$background_jp2_path");

The quotes around $background_jp2_path are not
needed.
nothing happens!!

Nothing can happen in various ways. We need
that info. Does it hang? Return immediately?
What is the value of $background afterwards?
Does PerlMagick have diagnostics? A debug mode?
What do they say?
The variable has for sure
the right value and the file exists at the

Are you sure? Have you checked against a rogue
line feed at the end of th string?
Why is the Read()-command not working?
Thank you very much!

You haven't given us any information that could
help answer that question.

Anno
 
G

guba

Hello Anno,

thank you for answering.

Return immediately?

Yes it returns directly. I included a
$background->Write() but nothing is
written so I conclude the object is
empty because nothing was read in
this configuration; everything is working
fine when I checked the functionality
by inserting the path by hand.


Have you checked against a rogue
line feed at the end of th string?

This is maybe a starting point because only
the use of file paths are here a problem; all
other variables&values are working. To what
must I pay attention when checking it with
print "$background_jp2_path";
or how else could this be checked?
Thank you very much!

best regards
Guenter
 
A

anno4000

(e-mail address removed)-berlin.de schrieb:

[attribution restored, snippage]
This is maybe a starting point because only
the use of file paths are here a problem; all
other variables&values are working. To what
must I pay attention when checking it with
print "$background_jp2_path";
or how else could this be checked?

The simplest test would be to chomp() the variable
before using it and see if it works then.

Otherwise, look at the output of

print "$background_jp2_path";

The cursor should be at the end of the line, after the "h".
If it is at the beginning of the next line, the variable
ends with a line feed.

Anno
 
G

guba

Hello Anno,

your first suggestion was right it was a rogue line feed.
Thank you!

Guenter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top