Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Filesys::Smbclient and DBD::XBase

by Merlin8001 (Novice)
on Mar 30, 2004 at 21:16 UTC ( [id://341102]=perlquestion: print w/replies, xml ) Need Help??

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

I'm trying to use DBD::XBase to read a file using a filehandle from Filesys::Smbclient.
I've gotten this far:
#!/user/bin/perl use Filesys::SmbClient; use XBase; my $smb = new Filesys::SmbClient(username=> "MYUSER", password=> "**********", workgroup=> "LAZYGROUP"); my $smbfilehandle = $smb->open("smb://myserver/myshare/databases/readt +histable.dbf"); XBase::Base::SEEK_VIA_READ(0); my $thistable = new XBase("-", 'fh' => $smbfilehandle, 'ignorememo' => + 1); $thistable->dump_records("fs" => " | ", "rs" => " <-+\n", "fields" => [ "location", "filename" ]); $smb->closedir($thistable);
I get this error:
Can't call method "autoflush" without a package or objectt reference a +t /usr/lib/perl5/vendor_perl/5.8.1/XBase/Base.pm line 106.

the problem seems to be that the filehandle for SmbClient doesn't have an autoflush function
the docs for Filesys::Smbclient mention using tie() but I'm having trouble figuring out if that's something related to my problem.
suggestions?

Replies are listed 'Best First'.
Re: Filesys::Smbclient and DBD::XBase
by meredith (Friar) on Mar 30, 2004 at 22:26 UTC

    The OP and I worked on this one on IRC... Our main problems were these:

    • $smbfilehandle isn't a "real" filehandle, it's a number that SmbClient uses to track its open files
    • XBase uses the value of the 'fh' parameter like an object, so we need an IO::Handle for this
    • Filesys::SmbClient doesn't provide a tied object like when using IO::Handle, so we must either use special read calls, or only builtins
    • It's possible to make a subclass for XBase that knows how to work with SmbClient, but that's quite a bit of work.
    I think using mounted locations is the simplest solution, but in case any monk has an idea... it would be appreciated.



    mhoward - at - hattmoward.org

      Had something like this pop up last week trying to read a remote file-based 'database'. We ended up going the most expedient route by just bringing over the files ( < 100k, total). SMB w/XBase we left for a time when we had time.

      I know it's not a solution to your problem, but it does work (if a tad on the inelegant side).

      Well, that's my $.02 worth. No, for refunds you'll have to check our customer service department.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found