Return Value of get_file_data

Brandon Barkley brandon at
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  => [ 
'' ]);
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;
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
foo foo

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