title: Mojolicious and Passwd::Unix
body: <p>I'm trying to return the list of Unix users on this perl script. I'm using the Mojolicious framework with Passwd::Unix.</p>
  
  <p>References:</p>
  
  <ul>
  <li>Mojolicious (<a href="http://metacpan.org/pod/Mojolicious" rel="nofollow noreferrer">http://metacpan.org/pod/Mojolicious</a>)</li>
  <li>Passwd::Unix (<a href="http://metacpan.org/pod/Passwd::Unix" rel="nofollow noreferrer">http://metacpan.org/pod/Passwd::Unix</a>)</li>
  </ul>
  
  <p>That's my code:</p>
  
  <p><strong>test.pl</strong></p>
  
  <pre><code>#!/usr/bin/env perl
  use Mojolicious::Lite;
  use Passwd::Unix;
  
  # Instance
  my $pu = Passwd::Unix-&gt;new();
  
  get '/' =&gt; sub {
    my $self = shift;
    my $users = $pu-&gt;users;
  
    $self-&gt;stash(
      users =&gt; $users
    );
  } =&gt; 'test';
  
  app-&gt;start;
  
  __DATA__
  
  @@ test.html.ep
  &lt;ul&gt;
    &lt;% foreach my $user ($users) { %&gt;
    &lt;li&gt;&lt;%= $user %&gt;&lt;/li&gt;
    &lt;% } %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>But instead of returning users, it prints only the total number of users.</p>
  
  <p><img src="https://i.stack.imgur.com/xsQPJ.jpg" alt="Test file"></p>