Return Value of get_file_data

Brandon Barkley brandon at cafeid.com
Wed Aug 9 18:02:04 UTC 2006


This may be a result of my ignorance of perl, but I ran the following 
code on a simple server setup:

use MogileFS;

my $mogfs = MogileFS->new(domain => 'testdomain',hosts  => [ 
'192.168.1.4:6001' ]);
die "Unable to initialize MogileFS object.\n" unless $mogfs;

my $filecontents = 'foo foo';

print $filecontents."\n";

my $fh = $mogfs->new_file("testkey", "testclass");
die "Unable to allocate filehandle.\n" unless $fh;
$fh->print($filecontents);
die "Unable to save file to MogileFS.\n" unless $fh->close;

my $filecontents2 = $mogfs->get_file_data("testkey");

print $filecontents2."\n";

my @paths = $mogfs->get_paths("testkey",true);

print @paths;

The results were:
brandon at stromgarde:~$ perl test.pl
foo foo
SCALAR(0x8316d24)
http://192.168.1.4:7500/dev1/0/000/000/0000000032.fid

When I located the file in question and catted it, I got 'foo foo' as 
the contents. Is there any reason why I am getting this SCALAR return 
rather than a proper string return from get_file_data? Do I need to 
typecast it in some way?


More information about the mogilefs mailing list