[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: patch: Perl again ;)
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-08-30 22:54:50
[Download RAW message or body]

At 20:49 30/08/00 +0200, you wrote:
>Hi!
>
>I got my hands on a few old files and found a few bugs.
>(the fixes are already in CVS). However, the loading
>still didn't work, so I started to hack the conversion
>script again.
>
>This works for me and as it looks it can't harm and other
>files. The problem is that it doesn't handle xpm properly
>(dunno why). I'll check that now.

I'm surprised by this patch, because it looks a change (in kpr's
image collection) that would be anterior to the new textobject ? 
Why didn't everyone have a problem with that change then ?
Are you sure kpresenter doesn't have support for loading both 
types of file formats ? I thought so...

>David?
Yes? :)

[...]
>     {
>+      # store the url because this is a prart of the "path" for the images
>+      $url=$1 if(m/url=\"(.*)\"/);
I think this should be

$url=$1 if(m/url=\"([^\"]*)\"/);

otherwise with
url="blah" key="value"
you'll get in $1:
blah" key="value

>       s/>$/ syntaxVersion=\"2\">/;
>     }
>+  elsif (/<PIXMAPS>/)
>+    {
>+      $insidePixmaps=1;
>+    }
>+  elsif (/<\/PIXMAPS>/)
>+    {
>+      $insidePixmaps=0;
>+    }
>   elsif (/<TEXTOBJ/)
>     {
>       # Save object type of the TEXTOBJ tag
>@@ -115,6 +129,38 @@ while (<INPUT>)
> 	    }
> 	}
>       $_=$toprint;
>+    }
>+  elsif ($insidePixmaps)
>+    {
>+      if(/\s+name=\"/)
>+        {
>+          # Aha - this file is not version 2 but was created as "proper"
tgz storage... medieval times :)
>+          print "Found a name attribute, no need to create one.\n";
>+        }
>+      elsif (/<KEY(.*)\/>/)
>+      {
>+        # Okay - plain old kpresenter magic...
>+        $key=$1;
>+        # Note: The .*? is needed because it would be too greedy otherwise
see above...  .*? looks very strange to me. What does it do ? :)

>+        $filename=$1 if($key =~ /filename=\"(.*?)\"/);
>+        # Get the values - really straightforward
>+        $year=$1 if($key =~ /year=\"(\d+)\"/);
>+        $month=$1 if($key =~ /month=\"(\d+)\"/);
>+        $day=$1 if($key =~ /day=\"(\d+)\"/);
>+        $hour=$1 if($key =~ /hour=\"(\d+)\"/);
>+        $minute=$1 if($key =~ /minute=\"(\d+)\"/);
>+        $second=$1 if($key =~ /second=\"(\d+)\"/);
>+        # In Perl the month is <0...11>!!!
>+        $timestamp=timegm($second, $minute, $hour, $day, $month-1, $year);
>+        # Unfortunately we even have to mess with that string...
>+        $timestring=scalar gmtime($timestamp);
>+        # There are still some spaces too much when day<10
>+        $timestring =~ s/  / /;
>+        # Okay. Now let's cat the whole caboodle...
/msg apt dict caboodle ? :-)

>[...]

Wow, you're getting very good at perl ! :)

David.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic