[24584] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6760 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 2 14:06:13 2004

Date: Fri, 2 Jul 2004 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 2 Jul 2004     Volume: 10 Number: 6760

Today's topics:
    Re: catching ctrl chars (justme)
    Re: catching ctrl chars <mritty@gmail.com>
    Re: Correct file locking techniques <ddunham@redwood.taos.com>
        finding every combination of n values at y positions (another one)
        Help with file download. <jimsimpson@cox.net>
        Logfile name hack <magoo@hal-pc.org>
    Re: Logfile name hack <mritty@gmail.com>
    Re: Logfile name hack <daedalus@videotron.ca>
    Re: Logfile name hack <daedalus@videotron.ca>
    Re: Matching a part of a string (TonyShirt)
    Re: Newbie: How to I extract word (Mav)
        OLE Automation: question about Word SaveAs (Greg Howard)
    Re: OLE Automation: question about Word SaveAs <matthew.garrish@sympatico.ca>
        please visit my website! <Maren.Kuhlmey@t-com.net>
    Re: Request for comments on a JPEG metadata Perl module <josef.moellers@fujitsu-siemens.com>
    Re: Request for comments on a JPEG metadata Perl module <bettelli@cpan.org>
    Re: Request for comments on a JPEG metadata Perl module <bettelli@cpan.org>
    Re: shouldnt this evaluate in a scalar context??? <noreply@gunnar.cc>
    Re: shouldnt this evaluate in a scalar context??? (dutone)
    Re: tern an hebrew string into unicode <scobloke2@infotop.co.uk>
    Re: tern an hebrew string into unicode <flavell@ph.gla.ac.uk>
        threads and getlocaltime (Charlie)
    Re: undefined subroutine that is defined?  mob_perl / p <richard@zync.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 2 Jul 2004 08:29:15 -0700
From: eight02645999@yahoo.com (justme)
Subject: Re: catching ctrl chars
Message-Id: <c0837966.0407020729.52182232@posting.google.com>

Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote in message news:<4hvvbc.5gm.ln@goaway.wombat.san-francisco.ca.us>...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 2004-07-01, justme <eight02645999@yahoo.com> wrote:
> 
> > i want to catch from the keyboard. I have looked at perldoc -q signal
> 
> perldoc -q signal talks about trapping signals, not catching keystrokes.
> 
> >     $Interrupted = 0;   # to ensure it has a value
> >     $SIG{INT} = sub {
> >         $Interrupted++;
> >         syswrite(STDERR, "ouch\n", 5);
> >     }
> >
> > Does this example catch Ctrl-x?
> 
> No, it traps SIGINT, which is commonly sent by ctrl-c.  IIRC ctrl-x
> doesn't normally send a signal, so you can't trap it this way.
> 
> Why don't you describe your goal, rather than trying to describe what
> you think you want to do?  Why are you so concerned with ctrl-x?
> 
> - --keith
> 
> - -- 
> kkeller-usenet@wombat.san-francisco.ca.us
> (try just my userid to email me)
> AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
> 
> -----BEGIN xxx SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> 
> iD8DBQFA44FhhVcNCxZ5ID8RAgSfAJwOszJpruEcvk6lD6kgMqSVhWotjwCgjq6C
> Ro02Dl1lGYWpTt+NrFDzCAE=
> =EM95
> -----END PGP SIGNATURE-----


actually this is what i want:

A user interface to prompt user to continue or use ctrl-x to return to
previous menu.


eg

"Do you accept? [Yn] or Ctrl-x to return to previous"

When the user press Ctrl-x, it will go back to previous page...

something like that....
thanks


------------------------------

Date: Fri, 2 Jul 2004 11:52:03 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: catching ctrl chars
Message-Id: <20040702114337.T16568@barbara.cs.rpi.edu>

On Fri, 2 Jul 2004, justme wrote:

> actually this is what i want:
>
> A user interface to prompt user to continue or use ctrl-x to return to
> previous menu.
>
>
> eg
>
> "Do you accept? [Yn] or Ctrl-x to return to previous"
>
> When the user press Ctrl-x, it will go back to previous page...

CTRL-X has a ordinal representation of 24.  (At least it does for me on
the two systems I tried it out - WinXP and Solaris).  Here is a solution
based on the documentation previously suggested to you
perldoc -q single


#!/usr/bin/perl
use strict;
use warnings;
use Term::ReadKey;

print "Do you accept? [Yn] or Ctrl-x to return to previous\n";
ReadMode "raw";
my $key = ReadKey 0, *STDIN;
if (ord($key) == 24) {
   previousPage;
} elsif ($key =~ /^y$/i){
   heSaidYes;
} else {
   heSaidNo;
}


Paul Lalli


------------------------------

Date: Fri, 02 Jul 2004 15:25:15 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Correct file locking techniques
Message-Id: <v7fFc.5317$oO.2011@newssvr25.news.prodigy.com>

Ben Morrow <usenet@morrow.me.uk> wrote:
>> If you want to write a file, open the lock file for write (that will, at 
>> least on some systems, wipe out the contents of the lock file), then 
>> establish an exclusive lock on it.

> The usual reason for using a lockfile is to avoid making locking calls
> altogether... a call to sysopen with O_CREAT | O_EXCL will atomically
> test-and-create the named file, so there is no need to then lock it.

Assuming NFS isn't involved.

I often use a separate lockfile because I don't want to modify my data
file directly, lest a crash leave it in an inconsistent state.

Instead I lock a separate file so that I can move a new file or files
into place and not have to worry about my lock moving with it.

> Yes. I belive most network filesystems do it properly; the exception is
> NFSv2, and there are (at least on linux) instructions in open(2) for how
> to safely lock files over NFS.

With increased cleanup requirements also, unfortunately.  I tend not to
do it because things get so messy.

>>     sub lockex{
>>       open LOCK,">lockfile.txt"

> Note that if you choose to put any useful information in the lockfile
> (it is common to put the pid and possibly the hostname of the process
> which created the lock, so later processes can check if you still exist)
> you would need to sysopen it with O_RDWR | O_CREAT to ensure you didn't
> destroy info about someone else's lock.

The same as.. open (LOCK, "<+lockfile.txt").  

-- 
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


------------------------------

Date: Fri, 02 Jul 2004 18:07:17 +0100
From: "Steve (another one)" <y66y@56yu4b6.com>
Subject: finding every combination of n values at y positions
Message-Id: <cc44o9$1o8$1@news.liv.ac.uk>

I have just wasted a crazy amount of time trying to populate an array 
containing every combination of n values at y positions.  It feels as 
though it should be trivial and the sort of thing I do every day, but in 
fact I could not find the simple solution that surely must exist.

Below is my best attempt - it will also explain the task if I haven't 
been clear - can someone tell me if there is a simpler way of doing it.

Thanks

Steve

(Actually I am probably really hoping you will all say "cool, what a 
brilliant way to do it", but I somehow doubt that will happen!)


#!/usr/bin/perl

## find all possible combinations of values at $number_of_position positions

use strict;

my $min_value = 1;
my $max_value = 4;
my $number_of_positions = 3;


my $individual = 0;
my $incrementing = 0;
my $dun;
my @data_set;
my @one_set;
for my $x (0..($number_of_positions-1)){push @one_set,$min_value}

###################################################
sub increment{
  if ($one_set[$incrementing] > $max_value){$incrementing++;
                                             $one_set[$incrementing]++;
                                                   increment();
                                             $incrementing--;
 
$one_set[$incrementing]=$min_value;
                                             }
}
###################################################

while (1){
   push @{$data_set[$individual]}, @one_set;

   # done yet ?
   foreach (@one_set){ $dun = ($_ == $max_value); last unless $dun}
   last if $dun;

   $one_set[$incrementing]++;
   $individual++;

   increment();
}

# show array
$individual=0;
foreach (@data_set){ print "$individual -  @{$_}\n"; $individual++  }









------------------------------

Date: Fri, 2 Jul 2004 11:37:26 -0400
From: "Jim Simpson" <jimsimpson@cox.net>
Subject: Help with file download.
Message-Id: <ajfFc.606$O14.194@lakeread03>

My bank allows me to download a .csv file of my account and I'm trying to
automate the process. So far I've gotten into the download manager sheet but
after hours and hours of work I've been unable to get any further. The
download manager sheet contains 2 forms plus a "download Button" - one form
is a 1 of 2 choice drop down menu the other is a 1 of 10 choice radio button
form. Can someone please help me. A portion of my code follows:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# secure login
  my $ua = LWP::UserAgent->new();
  $ua->protocols_allowed( ['https'] );
  $ua->cookie_jar(HTTP::Cookies->new(file => ".cookies.txt", autosave =>
1));
  my $response = $ua->post($https_login, [ 'username' => "$https_user",
'password' => "$https_pass", 'submit' => 'Submit' ] );
  if ($response->is_error())
  {
    printf " %s\n", $response->status_line;
    print "https request error!\n";
  }
  else
  {
    open my $fh, '> myfile.html' or die $!;
    print $fh $response -> content;
    close $fh;
  }

# get download manager sheet.
  if ($response->content() =~ (/.*<a\s+href="(.*)">Account\s+Download/))
  {
    my $nav_url = $baseurl . $1;
    my $response2 = $ua->post($nav_url);
    if ($response2->is_error())
    {
      printf " %s\n", $response2->status_line;
      print "https request error!\n";
    }
    else
    {
      open my $fh, '> myfile2.html' or die $!;
      print $fh $response2 -> content;
      close $fh;
    }
  }
  else
  {
    printf " %s\n", $response->status_line;
    print "https request error!\n";
  }

# Get "download.csv".
  my $csvresponse = $ua->post($burl . $1, [ 'name' => "name of dropdown
form", 'VALUE' => "$https_value2", 'NAME' => 'name of Radio button form',
'VALUE' => "$https_value1",  'name' => "name of button",  'value' =>
"Download Data"] );

  if ($csvresponse->is_error())
  {
    printf " %s\n", $csvresponse->status_line;
    print "https request error!\n";
  }
  else
  {
    open my $fh, '> myfile3.html' or die $!;
    print $fh $csvresponse -> content;
    close $fh;
  }
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
After running the above, my file2.html and myfile3.html both show the
download manager sheet. I hope I have included enough info. If not I will be
happy to provide more detail.

Thanks for all help.

Jim




------------------------------

Date: Fri, 2 Jul 2004 09:54:11 -0500
From: magoo <magoo@hal-pc.org>
Subject: Logfile name hack
Message-Id: <MPG.1b4f3310d3e0384a989684@news.hal-pc.org>


Just got through writing a program which wrote some output to a logfile.

Not wanting to overwrite a previous log file, I threw this together:
#================================================================

$logfile_version = 1;
$logfile = "${dir_name}/logfile_v${logfile_version}.log";

#Pre-existing logfile?
while ( -e $logfile ) {
  ($logfile_version = $logfile) =~ s/\D//g;
  $logfile_version += 1;
  $logfile = "${dir_name}/logfile_v${logfile_version}.log";
}

open(LOGFILE, ">$logfile) or die "Blah, blah, blah...";

#================================================================

This creates a series of logfiles named:
  logfile_v1.log
  logfile_v2.log
  etc

I would be interested in hearing any input concerning creating,
using, logfiles that anyone might want to share.

Regards,
magoo






------------------------------

Date: Fri, 2 Jul 2004 11:20:49 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Logfile name hack
Message-Id: <20040702111521.T16568@barbara.cs.rpi.edu>

On Fri, 2 Jul 2004, magoo wrote:

> Just got through writing a program which wrote some output to a logfile.
>
> Not wanting to overwrite a previous log file, I threw this together:
> #================================================================
>
> $logfile_version = 1;
> $logfile = "${dir_name}/logfile_v${logfile_version}.log";

They don't hurt, but the { } are unnecessary.  Neither / nor . are valid
variable name characters.

>
> #Pre-existing logfile?
> while ( -e $logfile ) {
>   ($logfile_version = $logfile) =~ s/\D//g;

I don't quite understand why you're doing this.  You are speciifically
creating the $logfile string.  You know what it looks like.  You know what
it contains.  In every iteration, you're assigning $logfile_version to
exactly what it already is.

This could, in fact, cause a bug in your algorithm, should $dir_name ever
contain any digits.


>   $logfile_version += 1;
>   $logfile = "${dir_name}/logfile_v${logfile_version}.log";
> }
>
> open(LOGFILE, ">$logfile) or die "Blah, blah, blah...";
>
> #================================================================
>
> This creates a series of logfiles named:
>   logfile_v1.log
>   logfile_v2.log
>   etc

> I would be interested in hearing any input concerning creating,
> using, logfiles that anyone might want to share.

Out of curiousity, what do you want to happen if the directory contains
the two files:

logfile_v1.log
logfile_v3.log

Your method will create a new file logfile_v2.log.  This may be what you
want.  If it's not, you'll have to change your algorithm a bit.  Or, you
may decide this isn't a possibility, that you'll never remove a log file
once it exists.  That's for you to decide, of course.

Paul Lalli


------------------------------

Date: Fri, 2 Jul 2004 12:41:35 -0400
From: "Daedalus" <daedalus@videotron.ca>
Subject: Re: Logfile name hack
Message-Id: <AcgFc.33794$t55.986348@wagner.videotron.net>

> Just got through writing a program which wrote some output to a logfile.
>
> Not wanting to overwrite a previous log file, I threw this together:
> #================================================================
>
> $logfile_version = 1;
> $logfile = "${dir_name}/logfile_v${logfile_version}.log";
>
> #Pre-existing logfile?
> while ( -e $logfile ) {
>   ($logfile_version = $logfile) =~ s/\D//g;
>   $logfile_version += 1;
>   $logfile = "${dir_name}/logfile_v${logfile_version}.log";
> }
>
> open(LOGFILE, ">$logfile) or die "Blah, blah, blah...";
>
> #================================================================
>
> This creates a series of logfiles named:
>   logfile_v1.log
>   logfile_v2.log
>   etc
>
> I would be interested in hearing any input concerning creating,
> using, logfiles that anyone might want to share.

Could use the current date to make different log files name (if you want
several logs per days maybe date-time) Code would looks like this:

open DATE, "date|" or die "Failed to open DATE: $!";
(my $date = <DATE>) =~ s/[^\d]//g;
my $dir_name = "/your/log/dir/";
my $logfile = "${dir_name}log-$date.log";
open LOGFILE, ">>$logfile" or die "Failed to open LOGFILE: $!";

It could be useful to have log files named by date (or date-time).

DAE




------------------------------

Date: Fri, 2 Jul 2004 13:09:22 -0400
From: "Daedalus" <daedalus@videotron.ca>
Subject: Re: Logfile name hack
Message-Id: <GCgFc.33804$t55.1002118@wagner.videotron.net>

> > This creates a series of logfiles named:
> >   logfile_v1.log
> >   logfile_v2.log
> >   etc
> >
> > I would be interested in hearing any input concerning creating,
> > using, logfiles that anyone might want to share.

Anyway if you want the program to create a new log file each it runs, here's
an simple example that would more simply do what you initialy wanted:

my $dir_name = "/your/log/dir/";
my $file_name = "logfile_v";
my $version = 1;
$version++ while -e "$dir_name$filename$version.log";
my $logfile = "$dir_name$filename$version.log";
open LOGFILE, ">$logfile" or die "Failed to open LOGFILE: $!";

This would create : logfile_v1 then logfile_v2 and so on each time it runs.

DAE




------------------------------

Date: 2 Jul 2004 06:48:51 -0700
From: tonyshirt@hotmail.com (TonyShirt)
Subject: Re: Matching a part of a string
Message-Id: <52d54c07.0407020548.45046feb@posting.google.com>

"gnari" <gnari@simnet.is> wrote in message news:<cc258o$gsp$1@news.simnet.is>...
> "TonyShirt" <tonyshirt@hotmail.com> wrote in message
> news:52d54c07.0407011338.1c42a32e@posting.google.com...
> > I have a string "FILEVERSION 1,01,0,21\n"
> > I want to match only the numbers "1,01,0,21"
> >
> > i'm using /([0-9]+,[0-9]+,[0-9]+,[0-9]+)/
> > but I'm still getting the whole string.  Why?  I know its easier (At
> > this point) to just split the string by \s, but I just cant give it
> > up!
> 
> there probably is somemthing wrong with how you are 'getting' it
> 
>   my $x="FILEVERSION 1,01,0,21\n";
>   print "gotit: ($1)\n" if $x=~/([0-9]+,[0-9]+,[0-9]+,[0-9]+)/;
> 
> gnari

This makes sense -- I was struggling becuse I thought that $x contain the match.
Thanks for the help! Tony


------------------------------

Date: 2 Jul 2004 09:12:52 -0700
From: mluvw47@yahoo.com (Mav)
Subject: Re: Newbie: How to I extract word
Message-Id: <dfaafecd.0407020812.2a2e9d1c@posting.google.com>

Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote in message news:<cc308c$1nt$1@nntp.fujitsu-siemens.com>...
> Dale Henderson wrote:
> >>>>>>"GM" == GM  <geedotmuth@castcom.net> writes:
> > 
> > 
> >     GM> Mav wrote:
> >     >> Hi, there I got string like: $string= "------ Build started:
> >     >> Project: Myproject, Config: Debug ABC ------"; I would like
> >     >> print out only anything in between "Project:" to ",", in this
> >     >> case it is "Myproject" in perl.  Any idea?  Thanks, M
> > 
> >     GM> The following assumes you have no whitespace in your project
> >     GM> names:
> > 
> >     GM> my $project = $string =~ /Project: (\S+),/;
> >      
> >     The following makes no such assumption:
> >      
> >      my $project = $string =~ /Project: ([^,]+),/;
> 
> Nitpicking: That's not what Mav wrote and it's not even correct:
> 
> my $project;
> ($project = $string) =~ s/.*Project:([^,]+),.*/$1/;
> 
> At least with Perl v5.8.1
> without the parentheses around the assignment, the value of $project is 1
> 
> with the "my", I get "Can't declare scalar assignment in "my" at - line 
> 2, near ") =~""
> without the substitution, I get the entire string,
> without the .*'s, I get another string.
> 
> You can also specify "non-greedyness":
> ($project = $string) =~ s/.*Project:(.*?),.*/$1/;

I tried it, and it seems it doesn't work, I need to do the following(silly way)

#orgianl string
$string= "------ Build started: Project: Myproject, Config: Debug ABC ------"; 

#Get the "MyProject" index
$w = rindex($string,",");       
$b = rindex($string,"t: ");         
      
if ($w > $b) {
    $projName = substr($_,$b+2,$w-$b-2);  #get "Myproject" out
    print "$projName\n";
}

Is that a better way?
Thanks,
Mav


------------------------------

Date: 2 Jul 2004 08:33:03 -0700
From: grghoward@email.com (Greg Howard)
Subject: OLE Automation: question about Word SaveAs
Message-Id: <db1f050e.0407020733.7ff6582f@posting.google.com>

I am trying to work on a project where I have to open a Word document
and convert it back to WordPerfect 5.1 for DOS.  I have found a
machine that has not had the Word XP SP3 installed, so I can still do
the SaveAs command, but when I save as WP Word will pop a message box
asking me to confirm that some formatting may be lost and do I want to
continue.  Before I try to automate this process any further can
anyone guide to a place where I can turn off this confirmation
message?

Any help would be greatly appreciated.
Greg Howard
greg dot howard at (removethisnospam dot) med-tech dot net


------------------------------

Date: Fri, 2 Jul 2004 12:30:53 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: OLE Automation: question about Word SaveAs
Message-Id: <_4gFc.195771$207.1929851@news20.bellglobal.com>


"Greg Howard" <grghoward@email.com> wrote in message
news:db1f050e.0407020733.7ff6582f@posting.google.com...
> I am trying to work on a project where I have to open a Word document
> and convert it back to WordPerfect 5.1 for DOS.  I have found a
> machine that has not had the Word XP SP3 installed, so I can still do
> the SaveAs command, but when I save as WP Word will pop a message box
> asking me to confirm that some formatting may be lost and do I want to
> continue.  Before I try to automate this process any further can
> anyone guide to a place where I can turn off this confirmation
> message?
>

Have you tried setting the DisplayAlerts property on the Word object you
create? There is no way to suppress all error messages, though, so no
guarantees it will work:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;259971

Matt




------------------------------

Date: 2 Jul 2004 16:27:17 -0000
From: "Honey" <Maren.Kuhlmey@t-com.net>
Subject: please visit my website!
Message-Id: <L9UNPRXJ38170.7689467593@anonymous.poster>

Someone is reaching out for you, but you’re not there. 

What would you say if they called on you now 

And said “Please love me or I'll be gone.” 

Click below and find out who that person is… 

http://amomentlikethisagain.com/confirm/?oc=50797674




------------------------------

Date: Fri, 02 Jul 2004 12:18:55 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Request for comments on a JPEG metadata Perl module
Message-Id: <cc3ck1$88p$1@nntp.fujitsu-siemens.com>

Martin Herrmann wrote:
> Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote in message ne=
ws:<cc16et$oc5$1@nntp.fujitsu-siemens.com>...
>=20
>>GreenLight wrote:
>>
>>>Stefano Bettelli <stefano bettelli@yahoo.fr> wrote in message news:<pa=
n
>>
>>.2004.06.26.17.57.26.885135@yahoo.fr>...
>>
>>
>>>I guess that I should read the information regarding the JPEG format
>>>to get the answer, but maybe you know this: would it be possible to
>>>add segments of information to the file that were of my own design? I
>>>would like to add some flags to each photo that would show that I have=

>>>completed cataloging it.
>>
>>It depends. Obviously the standard is designed such that any applicatio=
n=20
>>
>>can skip those tags that it doesn't know. However, you cannot guarantee=
=20
>>that all software is written properly.
>=20
>=20
> I'm sure that this approach will cause nothing but trouble. There are
> so many picture applications which e.g. will only handle the first
> comment segment and throw away the rest ...

If they throw away the rest, that would be fine, but some applications=20
will: "Unknown tag XXXX found in blabla.jpg, terminating".

>>Then I have .alb files which describe what photos belong together and I=
=20
>=20
>=20
> What are .alb files?

Photo _alb_ums, a personal text file format that describes which=20
pictures make up an album and should be included in the web pages=20
generated (they specify background, title, subtitle and picture ranges).

> I'm not exacly sure, that I understand everything you wrote, but it
> seems to me, that most of this (including the html export, handling of
> EXIF infos and thumbnails) can be done with Mapivi
> (http://mapivi.de.vu).

Although I often prefer software that I have written myself (it does=20
_exactly_ what I want/need), I'll have a look.

Thanks.

--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



------------------------------

Date: Fri, 02 Jul 2004 17:25:35 +0200
From: Stefano Bettelli <bettelli@cpan.org>
Subject: Re: Request for comments on a JPEG metadata Perl module
Message-Id: <pan.2004.07.02.15.25.35.190938@cpan.org>

Hi Gisle,

Il giorno Thu, 01 Jul 2004 09:18:44 -0700, Gisle Aas scrisse:
> Could you name what existing Perl libraries you have
> looked at and why they don't satisfy you?

the libraries and scripts which I looked at are listed in the
perldoc manpage of the module, together with a description and
my comments: "ExifTool" and "Image::ExifTool" by Phil Harvey,
"Image::IPTCInfo" by Josh Carter, "JPEG::JFIF" by Marcin
Krzyzanowski, "Image::Exif" by Sergey Prozhogin and "exiftags"
by Eric M. Johnston, "Image::Info" and "Image::TIFF" by you,
"exif" by Martin Krzywinski and "exifdump.py" by Thierry Bousch,
"exifprobe" by Duane H. Hesser, "libexif" by Lutz Müller, 
"jpegrdf" by Norman Walsh  and "OpenExif" by Eastman Kodak
Company [some of these are not written in Perl].

> I'm the author of Image::Info which seems to already do a lot
> of the same as you try to do.  One difference is that I don't
> plan to make Image::Info able to update the meta info. I think
> that would complicate the module too much and I don't have
> that need personally.

Actually, one of my goals is to be able to modify and rewrite
to disk almost all information I parse from APP* segments.
I read your library, but modifying it with this goal in mind
is not an easy task (not easier than starting from scratch, at
least). One other point is that the goal of your library is to
read a set of common tags from various graphic formats, while
I want to read/modify all tags from a specific graphic format
(namely JPEG, and maybe TIFF in the future).

What I could not see is how to integrate the "all" both on the
"format axis" and on the "tag axis". Do you think that there is
a possibility of integrating the two modules?

Bye,
			Stefano 


------------------------------

Date: Fri, 02 Jul 2004 17:32:18 +0200
From: Stefano Bettelli <bettelli@cpan.org>
Subject: Re: Request for comments on a JPEG metadata Perl module
Message-Id: <pan.2004.07.02.15.32.17.706490@cpan.org>

Hi,

Il giorno Thu, 01 Jul 2004 06:34:25 -0700, GreenLight scrisse:
> I have been wanting to create a catalog of my photos
> for quite some time.

this is exactly my problem :-). I believe that in order to 
manage a catalogue with little complication, one should be
able to enter his comments/additional info directly into the
image, and then use a perl script to generate dynamic web
pages with the required fields.

For the first task, I think that a winning combination is a
specialised library capable of parsing/modifying the JPEG
structure together with a GUI program allowing you to interact
with your photos more easily. Maybe you could have a look at
the following program:

	http://herrmanns-stern.de/software/mapivi/mapivi.shtml

Bye,
			Stefano



------------------------------

Date: Fri, 02 Jul 2004 12:15:16 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: shouldnt this evaluate in a scalar context???
Message-Id: <2kkr07F3grvjU1@uni-berlin.de>

John W. Krahn wrote:
> Gunnar Hjalmarsson wrote:
>> How about this as 'the ultimate solution' to this problem:
>> 
>>     print "YEA!!" if @a == grep defined, @h{@a};
> 
> That compares the hash keys in @a to the hash values in @h{@a}
> which is probably not what the OP wants.

The OP said: "What I was trying to do is see if all the keys in a
array (list,whatever) exist (not in the 'exists()' scence) in a hash."

I noticed that you suggested:

     print "YEA!!" if @a == grep exists $h{$_}, @a;

but considering OP's problem description I found it reasonable to
assume that he meant to check that the hash contains defined values
for all the keys in @a.

Only OP can tell who is right. :)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: 2 Jul 2004 09:46:01 -0700
From: dutone@hotmail.com (dutone)
Subject: Re: shouldnt this evaluate in a scalar context???
Message-Id: <7d56a4da.0407020846.456b2ed4@posting.google.com>

Thanks for all the input everyone <:|


------------------------------

Date: Fri, 2 Jul 2004 13:26:48 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: tern an hebrew string into unicode
Message-Id: <cc3nqn$lfv$1@sparta.btinternet.com>

dana livni wrote:
> i gess you right, i need to convert the text in order to send it in a
> get request - in the format of the www.vivvisimo.com site.

Thats a parked domain, maybe you mean www.vivisimo.com?

> i think that all the %d7 meen that this is hebrow and that the second
> pare symbol the specific letter.

In Unicode, Hebrew glyphs are in the range 0590-05FF

You originally said
 >> the string &#1491;&#1504;&#1492;

Decimal 1491 is Hex 05D3 which is the Unicode code-point for Hebrew 
letter DALET. Presumably this is the first letter of "Dana" in Hebrew. 
http://www.unicode.org/charts/

> i'm not sure witch encoding is it. 
> i meant to send the real string (my name - dana) but google site
> encoded it.

Does vivisimo accept Unicode? I thought most sites expected ISO-8859-1 
(Latin 1). Which does not include Hebrew characters AFAIK.

> if there any function that get a string and the encode for use and
> retearnd a string of two pares :
> 1. symbol the languge
> 2. symbol the specific letter.
> like in my example, i will find the encoding i'm looking for.

Does such an encoding exist? A pair of 8-bit bytes would allow 256 
languages of 256 glyphs. There must be more than 256 languages in 
Unicode and most of them have more than 256 glyphs. So such an encoding 
could not represent more than a small subset of Unicode.

http://www.marsengineering.com/charCodeConverter.html


------------------------------

Date: Fri, 2 Jul 2004 16:59:10 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: tern an hebrew string into unicode
Message-Id: <Pine.LNX.4.53.0407021647550.22922@ppepc56.ph.gla.ac.uk>

On Fri, 2 Jul 2004, Ian Wilson wrote:

> dana livni wrote:
> > i gess you right, i need to convert the text in order to send it in a
> > get request - in the format of the www.vivvisimo.com site.
>
> Thats a parked domain, maybe you mean www.vivisimo.com?
>
> > i think that all the %d7 meen that this is hebrow and that the second
> > pare symbol the specific letter.

I worried about the fact that I didn't understand exactly what the
questioner was trying to achieve, so I was reluctant to try to answer
the question, even if I might have some of the relevant expertise.

> In Unicode, Hebrew glyphs are in the range 0590-05FF
>
> You originally said
>  >> the string &#1491;&#1504;&#1492;
>
> Decimal 1491 is Hex 05D3 which is the Unicode code-point for Hebrew
> letter DALET. Presumably this is the first letter of "Dana" in Hebrew.
> http://www.unicode.org/charts/

Looking good so far.

> Does vivisimo accept Unicode? I thought most sites expected ISO-8859-1
> (Latin 1). Which does not include Hebrew characters AFAIK.

This is the point at which your reply lost credibility for me, I'm
afraid.  If you don't know that for sure, I'm puzzled that you thought
it helpful to try to offer an answer.

> > if there any function that get a string and the encode for use and
> > retearnd a string of two pares :
> > 1. symbol the languge
> > 2. symbol the specific letter.
> > like in my example, i will find the encoding i'm looking for.
>
> Does such an encoding exist? A pair of 8-bit bytes would allow 256
> languages of 256 glyphs.

I'm not sure where you're heading here.  Seems to be devising a
problem for which there have long since been solutions.

Current Perl versions have a natural way of representing Unicode
internally; and natural ways of turning it into other useful
representations (could be iso-8859-8; could be HTML &#number;
representations which the questioner evidently already knows about;
etc.) if utf-8 coding is somehow not appropriate.

But I still don't feel confident that I know what the original poster
wanted to achieve, so I couldn't offer a practical answer to their
questions yet, not with any degree of confidence.

> There must be more than 256 languages in Unicode

Unicode doesn't really "do" languages, except in the context of
disambiguating unified CJK characters.  Greek (language) is still
Greek (language) even when transcribed into Latin characters; English
(language) is still Engrish (language) when transcribed into Japanese
writing.  Unicode represents *writing systems*, not languages.

have fun


------------------------------

Date: 2 Jul 2004 10:12:11 -0700
From: cji_work@yahoo.com (Charlie)
Subject: threads and getlocaltime
Message-Id: <1dc70d61.0407020912.78d2613@posting.google.com>

Hi folks, 

In one of my perl code, I am trying to get the local time in mseconds.
The module I am using are from CPAN, Time::Format. It works fine in
the regular code, but if I create some threads inside the code and
have the $time() being called in the threads, it causes the segment
fault.

So the question I have is does anyone know other api that I can use,
which give me the local time in mseconds and is thread safe ?


regards, 


Charlie.


------------------------------

Date: Fri, 02 Jul 2004 11:07:24 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: undefined subroutine that is defined?  mob_perl / perl 5.8.4 issue?
Message-Id: <cc3c4t$1oi$1@news.freedom2surf.net>

In article <0PGdnW4f_rVzH3ndRVn_iw@comcast.com>, "Dan Burke"
<dburke210@comcast.net> wrote:
> I tried specifying the package name, and it still didn't work :( I
> double checked that the pm file is used in that file, and I checked that
> it is in %INC.  But, I tried to call other sub's from that file and it
> bombed with the same error.  Most odd.  I hate being so stumped like
> this.  Dan.
> 

Something else I've just thought of: Is the package returning a true
value? ie is there a "1;" line at the end of it? I suspect so cos I've
seen this error reported specifically. If I were you, at this point I'd
try writing a trivial offline script which uses this file, and then try and
get this file running next as a cgi, then under mod_perl. Hopefully this
will narrow down where the error is occurring. One trick I use is to
introduce deliberate errors in certain places just to make sure that what
I think is happening is actually happening. 

HTH
Rich


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6760
***************************************


home help back first fref pref prev next nref lref last post