Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Cross platform location for SQLite databases?

by muzakfetch (Scribe)
on May 26, 2009 at 16:36 UTC ( [id://766252]=perlquestion: print w/replies, xml ) Need Help??

muzakfetch has asked for the wisdom of the Perl Monks concerning the following question:

I'm implementing SSO to a third party authentication engine in Perl.

After finishing the proof of concept, I found that I have a need to cache some local information to improve performance. SQLite seems to be the natural choice, but where to store the database? "/tmp" or "C:\Windows\temp" run the risk of being destroyed during reboots.

Does anyone have a location that they prefer when running cross platform?

Does there exist a module out there that will solve my problem?

Thanks!

  • Comment on Cross platform location for SQLite databases?

Replies are listed 'Best First'.
Re: Cross platform location for SQLite databases?
by shmem (Chancellor) on May 26, 2009 at 17:01 UTC

    The best cross-platform store for SSO authentication is a Kerberos database. Mostly, you can rely on the particular kerberos ticket cache implemetation of the underlying OS. But alas, Kerberos authentication is not quite evolved at CPAN (last time I looked was some months ago.) So you would have to rely on OS dependent tools for each platform, possibly involving LDAP.

    That's all I venture to say, since your task description bears many open questions...

      Thanks, shmem but using these technologies requires authentication on it's own. Most of what I need to store is just simple metadata that requires no security. Therefore, Kerberos and LDAP are a little overkill for my needs.

      What I am truly looking for is a module that identifies the OS, and then chooses an appropriate location for storing metadata. Depending on context and privileges, this can be in the user's profile directory, or if running as a privileged user, in "/var" or "C:\Windows\something" (sorry not a windows geek).

      Perhaps this doesn't exist, and I should just write my own :-)

        Therefore, Kerberos and LDAP are a little overkill for my needs.

        Why overkill? Bot are centralized stores with a well defined protocol. Querying the platform, selecting the storage location depending on the result and implementing the do-abouts for each looks more like overkill. And, "requires no security" ? That's almost always wrong ;-)

        ...module that identifies the OS...

        No need for a module: $^O

        see perldoc perlvar.

Re: Cross platform location for SQLite databases?
by bart (Canon) on May 26, 2009 at 18:26 UTC
    Perhaps you can make use of this CPAN module:
    File::HomeDir
    Find your home and other directories, on any platform
Re: Cross platform location for SQLite databases?
by CountZero (Bishop) on May 26, 2009 at 19:12 UTC
    Have a look at File::ShareDir too: it gives you a place where you can put your "extra" bits and pieces.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://766252]
Approved by wfsp
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found