[CS-FSLUG] Script-error

Brian Derr bderr at myrealbox.com
Thu May 13 17:13:54 CDT 2004


On Thu, May 13, 2004 at 06:40:56PM +0300, Jukka Y wrote:
> It works now! Many thanks for you, Brian :-). I can now more easily squeese 
> some 5 Gb of loosely compressed jpg's into djvu-format (my goal is to put 
> them on single 700 Mb cdrom with no visible loss of quality, with 
> thumbnail-index etc etc...;-).

GREAT!  :-D

> I did find out that error which I mentioned my last message ("Unrecognized 
> character \xA0 at convert line 10") was caused by "blanks" which I may got 
> from copying Jonathans script directly from KMail's window). But there was 
> also something else, because after removing "blanks" interpreter warned me 
> with this message: "Can't find string terminator "EOF" anywhere before EOF 
> at ./convert line 12." Maybe this had something to with what you mentioned 
> about giving multiple commands to system()..?
> 
> Thanks also for line-numbering tip :-). In case you are interested to see what 
> caused the second error, script had this numbering:

That is from my days of CS 161 and CS 162 at college, the instructor
wouldn't grade it if the program wasn't line numbered.  I really like
the idea though because it helps other people to find what you're
talking about when you can just say "look at line 8".

I think the problem with the script below is that you cannot have
anything after the "here document" completion word, "EOF" in your case.
So...

> 1	#!/usr/bin/perl
> 2
> 3	use strict;
> 4	use warnings;
> 5
> 6	my $filelist = `find`;
> 7	my @files = split /\n/,$filelist;
> 8
> 9	for my $file (@files)
> 10	{next unless ($file =~ m#\.jpg$#);
> 11	$file =~ s#\.[^/]*$##;
> 12	system (<<EOF);
> 13	convert '$file.jpg' '$file.pnm' &&
> 14	rm '$file.jpg' &&
> 15	c44 '$file.pnm' '$file.djvu' &&
> 16	rm '$file.pnm'
> 17	EOF
  18  }
 
If that does not fix it, try doing this:

 12  system( <<EOF
 ...
 17  EOF
 18  );
 19  }

I have no idea wether or not that will work, but worth a try for
learning's sake.  Have fun with Perl, it is quite the language!  :-)

> Perl is something I would like to learn (I have even bought a book of it). 
> Btw. Did you know that Larry Wall - the guy that originally wrote 
> perl-interpreter - is christian?

I did in fact know that, he is an accomplished linguisist and he lent
his knowledge of language to the writing of Perl.  An interesting guy
for sure...I actually lived quite close to Randal "Merlyn" Schwartz on
of the main Perl hacker/guru/monks.  Never had a chance to meet him;
maybe next time I'm back in Oregon I can.  :-)

Brian

-- 
The just man walketh in his integrity:
his children are blessed after him.  -- Proverbs 20:7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://ofb.biz/pipermail/christiansource_ofb.biz/attachments/20040513/4474670f/attachment.sig>


More information about the Christiansource mailing list