tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ A "getc()" problem

Problems with PERL and Locking? ▻

Arguments to tie()

In article <DMs1H7.B5M@sun2.iusb.indiana.edu>,
Don Marti Jr. <dmarti1@sun1.iusb.edu> wrote:
>Looking at the entry for tie in the Perl 5 man perlfunc, I don't
>understand what the last 2 arguments are for:

As it says, "Any additional arguments are passed to the "new" method
of the class".  What's appropriate for an NDBM_File isn't appropriate
for a GDBM_File.

>Can anyone fill me in on what the arguments mean or give me a pointer
>to a good example of how to use tie()?

It all depends on the class you are tying to.  Here's an example
for GDBM_File.

    tie %h, GDBM_File, "db", GDBM_WRITER|GDBM_WRCREAT, 0644
            or die "tie failed: $!\n";

As you can see, the 4th and 5th arguments to tie correspond to the
3rd and 4th arguments to gdbm_open, as specified by gdbm(3).

Tim.
--
Tim Goodwin   | "I just noticed that a SUN SLC takes longer to
UUnet PIPEX   | get to its boot prompt than it takes to build
Cambridge, UK | its [ Plan 9 ] kernel." -- Phil Winterbottom

Original headers:

Path: wave.news.pipex.net!pipex!tim
From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl.misc
Subject: Re: Arguments to tie()
Date: 15 Feb 1996 17:21:43 GMT
Organization: Unipalm PIPEX
Message-ID: <4fvq37$ca5@wave.news.pipex.net>
References: <DMs1H7.B5M@sun2.iusb.indiana.edu>

△ comp.lang.perl △

◅ A "getc()" problem

Problems with PERL and Locking? ▻