Discussion:
FVWM: FvwmPerl Preprocessing
mimosinnet
2013-05-07 12:35:15 UTC
Permalink
I being am unable to get the "FvwmPerl -p file" working. This is what I
have in my .xinitrc:

exec fvwm -c "Module FvwmPerl --preprocess /home/mimosinnet/.fvwm/config"

(I have also tried eval).

It correctly reads the configuration file, but it does not recognise the
token, throwing this error:

[FVWM][__execute_function]: <<ERROR>> No such command '%{'

This has been discussed in the list:

http://www.mail-archive.com/***@lists.math.uh.edu/msg09164.html

But I am not clear on what is the right configuration.

The long story is that I have just tried the aweseome window manager.
Despite the nice defaults, it looks like most of the configuration could
be mimicked by FVWM. The main difference is the possibility of using the
lua language the configuration file. I just remembered that FVWM can
preprocess perl expressions written in the configuration file, and
wonder about this possibility in, for example, using foreach loops.

Cheers!
--
Mimosinnet
Linux User: #463211
41:24:51N (41.4141) 2:11:24E (2.1902)

Ningún Lugar
Activisme Cultural per a la Transformació Social
http://generatech.org/ningunlugar

Fractalitats en Investigació Crítica
Investigació Crítica per a la Transformació Social
http://psicologiasocial.uab.es/fic
Thomas Adam
2013-05-07 14:55:02 UTC
Permalink
Post by mimosinnet
[FVWM][__execute_function]: <<ERROR>> No such command '%{'
But I am not clear on what is the right configuration.
We need to see your config file before any of this makes sense.

-- Thomas Adam
mimosinnet
2013-05-09 13:40:12 UTC
Permalink
Post by Thomas Adam
Post by mimosinnet
[FVWM][__execute_function]: <<ERROR>> No such command '%{'
But I am not clear on what is the right configuration.
We need to see your config file before any of this makes sense.
Thanks for the message. Just for testing it, I have just created this
configuration file...,

~/.fvwm/config.pl
--------------------
key i A C Exec exec xmessage -nearmouse "No preprocesing"
%{ $b = "Preprocessing"; $a = "key i A S Exec exec xmessage -nearmouse $b"; $a }%

%{
@a = ("KP_Home", "KP_Up", "KP_Prior", "KP_Left", "KP_Begin", "KP_Right", "KP_End", "KP_Down", "KP_Next" );
$i = 0;
$b = "";
foreach (@a ) {
$b = $b . "Key $_ A N Exec exec xmessage -nearmouse $i \n";
$i = $i +1;
}
$b
}%
--------------------

Executed with:

eval 'fvwm -c "Module FvwmPerl --preprocess /home/mimosinnet/.fvwm/config.pl"'

And it works! :-D :-)

Thanks! You pointed to the right direction. I was directly making
changes in my huge fvwm configuration instead of trying to find a
"test".

I am a happy bunny with a new toy to play with.

Cheers!
--
Mimosinnet
Linux User: #463211
41:24:51N (41.4141) 2:11:24E (2.1902)

Ningún Lugar
Activisme Cultural per a la Transformació Social
http://generatech.org/ningunlugar

Fractalitats en Investigació Crítica
Investigació Crítica per a la Transformació Social
http://psicologiasocial.uab.es/fic
Thomas Adam
2013-05-09 13:53:09 UTC
Permalink
Post by mimosinnet
~/.fvwm/config.pl
--------------------
key i A C Exec exec xmessage -nearmouse "No preprocesing"
%{ $b = "Preprocessing"; $a = "key i A S Exec exec xmessage -nearmouse $b"; $a }%
%{
@a = ("KP_Home", "KP_Up", "KP_Prior", "KP_Left", "KP_Begin", "KP_Right", "KP_End", "KP_Down", "KP_Next" );
I appreciate this is likely in the examples, but the use of @a/@b and
$a/$b should be discouraged because these are special variables in
perl which are used for block-level commands like sort/map/grep.
Post by mimosinnet
$i = 0;
$b = "";
$b = $b . "Key $_ A N Exec exec xmessage -nearmouse $i \n";
$i = $i +1;
}
$b
You can get the same effect by doing:

$i = 0; $foo = join ("\n", map { "Key $_ A N Exec exec foo -nearmouse
" . $i++ } @a );
$foo

-- Thomas Adam
mimosinnet
2013-05-09 18:45:14 UTC
Permalink
<code>
Post by Thomas Adam
$a/$b should be discouraged because these are special variables in
perl which are used for block-level commands like sort/map/grep.
Post by mimosinnet
$i = 0;
$b = "";
$b = $b . "Key $_ A N Exec exec xmessage -nearmouse $i \n";
$i = $i +1;
}
$b
$i = 0; $foo = join ("\n", map { "Key $_ A N Exec exec foo -nearmouse
$foo
Looks like there is still lots to learn! I will get acquainted with the
map and join. Meanwhile, I have updated the information in the fvwm
forums:

- http://www.fvwmforums.org/phpBB3/viewtopic.php?f=33&t=2970&p=14185#p14185
- And mentioned in the awesome wiki about the possibilities of Perl
preprocessing:
http://awesome.naquadah.org/wiki/Keybindings_and_numeric_pad#Having_all_together_in_few_lines_of_code.21.21

Thanks!
--
Mimosinnet
Linux User: #463211
41:24:51N (41.4141) 2:11:24E (2.1902)

Ningún Lugar
Activisme Cultural per a la Transformació Social
http://generatech.org/ningunlugar

Fractalitats en Investigació Crítica
Investigació Crítica per a la Transformació Social
http://psicologiasocial.uab.es/fic
Loading...