[plug] Perl 'tie' equivalent for Linux files (not a Perl question)

Luke Dudney plug at apophis.net
Thu Oct 10 17:24:31 WST 2002


John Usher (Maptek) wrote:

>I know this is an very late reply, but have you had a look at
>lufs.sourceforge.net?
>
>...John...
>
>-----Original Message-----
>From: ryan at is.as.geeky.as [mailto:ryan at is.as.geeky.as] 
>Sent: Friday, 4 October 2002 3:39 PM
>To: plug at plug.linux.org.au
>Subject: [plug] Perl 'tie' equivalent for Linux files (not a Perl
>question)
>
>
>Those of you familiar with the tie command in Perl might understand what
>I
>want to do.  It is the only thing I can think of to compare it to ...
>well
>that and database triggers.
>
>I want to 'tie' a script to a system file so that whenever that file is
>accessed the script is run and dumps its output into that file giving
>the
>impression the file is by all other means static.
>
>=================================================
>Example - we'll call this magical file 'thefile':
>
>thefile could be linked to a script - lets make it easy and use
>/bin/date as
>the script
>
>So I'd expect to see
>
>$ cat thefile
>Fri Oct  4 15:17:45 WST 2002
>
>and in some mystery place there is some sort of magical 'thefile ->(<-)
>/bin/date' link.
>=================================================
>
>Sure I could just symlink it to the script and run ./thefile but i need
>thefile to present itself to all applications as a static text file.
>
>The actual use of this is I want to be able to refer to a system file as
>an
>ordinary file but actually have it contain a current database schema
>dump
>that would be updated (via the script) every time the file was accessed.
>I
>can see that defining 'accessed' could be a hard thing ... and I can
>also
>see all of you frowning and wondering what the hell I'm trying to do it
>like
>that for :)
>
>An alternative to look at it another way would be to set up a cron
>script
>running every second to dump the schema to the file - that would
>essentially
>achieve a similar result.  The theory of it seems similar to triggers in
>databases too if that helps anyone.  Perhaps by using a 'special'
>filesystem
>ala /proc this can be done?
>
>Is there any such way or workaround to achieve this kind of thing?  If
>not,
>then my question is also still answered.
>
>Thanks for reading  :)
>
>Ryan
>
>  
>
man fifo




More information about the plug mailing list