On Wed, 2002-07-10 at 09:01, Matija Papec wrote:
> 
> How to refresh/redraw gtk-perl window? I have one script that shows
> movie listing and when one item is selected via remote, 'system'
> invokes mplayer which leaves main gtk window blank after it finishes?
> :)

Perl 5.6.x is not threaded, so anything that blocks (like system) will
keep the gui from updating.  To launch another app you should fork and
then exec the other app without waiting your the child to die.

> 
> ----------------------------------------------------------------------
> I want to make function which should return file handle:
> 
> F = LockFile('/some/file', 0);
> .
> .
> close(F);
> 
> ######
> sub LockFile {
>   my($file, $pos) = @_;
>   local *DAT;
> 
>   open DAT, "+<$file";
>   #flock and seek to $pos
>   .
>   .
>   return(*DAT); # or should be return(DAT)?
> }
> 
> Is this kind of using file handles encouraging?

You are probably better served by using the IO::File module.  See
perldoc IO::File for more information.

> 
> ----------------------------------------------------------------------
> Is there a way to use 'format' where I could write to scalars instead
> to file handles?(usefull when cgi sends mail and shows same content in
> the browser)

I assume you are referring to the write function and formats.  I believe
there is a way to get at the Perl variables used to do the formating,
but that is ugly (see perldoc perlvar for more info).  Is there a reason
you are not using sprintf (see perldoc -f sprintf)?

> 
> ----------------------------------------------------------------------
> How to match complex repeating patterns, i.e. I want to match
> (\d{6}.*?\t) ten times and read values of the last three?

Here is one way:

<code>
#!/usr/bin/perl -w
use strict;

my $string = "ab cd ef gh ijkl mn op qr st uv wx yz";

my @matches;

for my $i (0..9) {
        last unless $string =~ /(\w+)/g;
        $matches[$i] = $1;
}

my @I_care_about_these = @matches[-3,-2,-1];

#note, if there are less than three matches 
#we will get a warning here
print "@I_care_about_these\n";
</code>

This should print out "qr st uv\n"


> 
> ----------------------------------------------------------------------
> This is SQL(mySql) question but hopefully there is some simple
> solution to it. Table look like:
> 
> NAME |   EMAIL
> ------------------------
> dave | [EMAIL PROTECTED]
> john | [EMAIL PROTECTED]
> mary | [EMAIL PROTECTED]
> 
> I want to extract john's EMAIL using 'john236' as a search string. 
> Unfortunately RLIKE doesn't work here
> 
> SELECT EMAIL from Table WHERE NAME RLIKE 'john236';
> and
> 
> SELECT EMAIL from Table WHERE 'john236' RLIKE NAME;
> is not recognized as a valid sql query. :!

Can't help you here since RLIKE is not ANSI SQL.

> 
> --
> Matija
 
-- 
Today is Sweetmorn the 45th day of Confusion in the YOLD 3168
Hail Eris!

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to