LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-23-2005, 06:57 PM   #1
belmer2
LQ Newbie
 
Registered: Apr 2005
Posts: 1

Rep: Reputation: 0
filename truncation Perl


Hi All,

I seem to have an environment issue. The code below works fine on FreeBSD 4.9, however when on my Fedora box, $fname gets the first 4 characters cut off when I do the ImageMagick read request. The temp file gets generated with full file name. Error below.

I am fairly new at this, so I'm not sure if it could be an IM, or Perl problem as well. IM 6.2.1 with JPEG and 8bit color depth. Perl 5.8.6

-Chris


$fname_temp = 1;
$fname = `mktemp $temppath/colors.XXXXXXXXXXX`;
chomp $fname;

$ua = LWP::UserAgent->new;
#~File gets written here fine.
$resp = $ua->request(
HTTP::Request->new(GET => $ARGV[0]),
$fname
);
if ( ! $resp->is_success() ) {
unlink($fname);
print 'ccol.pl: Request error: ' . $resp->status_line . "\n";
exit 1;
}
}
else {
$fname = $ARGV[0];
}

##################################### Read image #####################################
$image = Image::Magick->new;
#~IM can't find it because of the 1st 4 characters being truncated here.
$str = $image->Read($fname);
$str && die $str;

ERROR
<h1>Software error:</h1>
<pre>Exception 430: unable to open file `ors.AudRlow3205': No such file or directory at code.pl line 100.</pre>
<p>
For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.
 
Old 04-24-2005, 01:31 PM   #2
puffinman
Member
 
Registered: Jan 2005
Location: Atlanta, GA
Distribution: Gentoo, Slackware
Posts: 217

Rep: Reputation: 31
Looks like you've got an extra bracket after the if clause, and could you maybe throw some code tags around the code? Variable width font makes it difficult to read code, at least for me.

So it looks like right before you're loading it with IM you're assigning $fname from the @ARGV array (in the else). Did you check what was in @ARGV? What is the calling syntax?

Sorry about the smilies, I'm feeling giddy right now for some reason.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Rounding and Truncation Opeth Programming 4 09-17-2005 07:16 PM
how to seperate filename from path in perl mengle Programming 2 08-28-2005 01:35 AM
Perl Scripting on Filename lengths supreme_command Programming 2 05-16-2004 03:06 AM
Truncation problem Big Al Debian 3 04-12-2004 08:26 PM
Perl Parsing filename The Jesus Programming 4 10-03-2003 03:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration