in reply to Hacking a source filter into the #! line

The filter only gets the source that follows the use statement (whether inserted by -M or present in the source), so you can simply use
#!/usr/bin/perl use yX; ...

For example,

$ cat yX.pm package yX; use Filter::Simple sub { tr/n-za-mN-ZA-M/a-zA-Z/; }; 1;
$ cat a.pl #!/usr/bin/perl use yX; cevag("Uryyb, Jbeyq!\a");
$ a.pl Hello, World!

Replies are listed 'Best First'.
Re^2: Hacking a source filter into the #! line
by dcmertens (Scribe) on Jul 24, 2014 at 17:23 UTC
    For some reason my reply didn't post. The problem with this approach is that LyX expects the very first non-hash-commented line to be "\lyxformat 474" (or some other number). The only lines that I can modify without breaking LyX's ability to load the document are the #-comment lines, so I need some way to instruct Perl to do something within that line. Thus, #! fun. :-)