Thanks for the clarification, =).

I was thinking of a file as something that exists on the server, rather than 
something that exists as an object.
That is, when I created a Mojo::Asset::File I didn't view it as a file, if it 
hadn't been saved as a file to the server, using move_to.
So is_file checks if a Mojo::Asset is a Mojo::Asset::File.

=) Many Thanks,

Yours,
Andrew.


  ----- Original Message ----- 
  From: Justin Hawkins 
  To: [email protected] 
  Sent: Wednesday, May 27, 2015 2:46 AM
  Subject: Re: [Mojolicious] is_file




    On 27 May 2015, at 8:47 am, Andrew <[email protected]> 
wrote:


    So I'm left scratching my head - what does is_file actually do, if it
    doesn't check if a file exists?




  A Mojo::Asset::File is always a file, as the name implies, thus it always 
returns true.


  If you have a Mojo::Asset, you can use is_file to find out if it is a file 
(as opposed to it being perhaps a Mojo::Asset::Memory object).


  if (! $asset->is_file) {
    $asset->move_to(‘/some/other/file.txt’);
  }


  - Justin

  -- 
  You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected].
  To post to this group, send email to [email protected].
  Visit this group at http://groups.google.com/group/mojolicious.
  For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to