edit_file patch

John Berthels jjberthels at gmail.com
Mon Aug 13 09:09:09 UTC 2007


Hi Brad,

Thanks for the commit bit and general thumbs-up on the patch.

On 11/08/07, Brad Fitzpatrick <brad at danga.com> wrote:
>
> Looks good.  Just this part scares me a bit in the POD docs:
>
> -  $mogc->new_file($key, $class, $opts_hashref)
>
> That's no longer an allow calling convention?  I'd hope so.
>
> Fix that (the code or the docs) and feel free to commit.

I'm probably missing something, but I don't think the current code
permits that anyway (and doesn't seem to have done for a long time, if
ever).

new_file handles args like this:

sub new_file {
    my MogileFS::Client $self = shift;
    return undef if $self->{readonly};

    my ($key, $class, $bytes, $opts) = @_;
    $bytes += 0;
    $opts ||= {};

which doesn't seem to honour $opts unless $bytes is specified (and
seems to end up with a crazy value for $bytes if we call ->(key,
class, {opts}). What does a hashref evaluate to in a numeric context,
anyway?)

The only usage of opts I can see in the mog tree is in
examples/mogilefs-dav.pl:89, which specifies the size.

If you want, I can add a "if (ref $bytes && ref $bytes eq 'HASH')"
test to the code to allow this calling convention, but if I've read it
right, no (working) code can be doing this at the moment.

thanks again,

jb


More information about the mogilefs mailing list