"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:

> my $args = shift
Subroutine:
sub new
  {
  my $class = shift;
  my $self = bless {}, $class;

my $args = shift;
  $self->{file} = $args->{file};
  $self->{is_reversed} = $args->{reversed} ? 1 : 0;
  $self->_read_file($self->{file});
  $self->{filtered} = {};                       # no filtered items yet
  $self->{is_filtered} = 0;                     # unfiltered

  if (defined $args->{views})
    {
    $self->{viewfile} = $args->{views};
    $self->{lockfile} = $args->{lockfile};
    $self->read_counters();
    if (ref($args->{inc}) eq 'ARRAY')
      {
      $self->update_counters( @{$args->{inc}} );
      }
    $self->unlock();
    }

  $self->{sortmethod} = $args->{sort} || 'id';
  if ($self->{sortmethod} !~ /^(id|shot|ascore|oscore|aview|uview|rel)$/)
    {
    # hm, unsupported sort method fallback to "id"
    $self->{sortmethod} = 'id';
    }
  $self->{sort} = \&{'_sort_by_' . $self->{sortmethod}};

  $self->{item_list} = 
    [ sort { &{$self->{sort}}($self,$a,$b) } keys %{$self->{table}} ];

  # if reversed
  $self->{item_list} = [ reverse @{$self->{item_list}} ]
    if $self->{is_reversed};
  $self;
  }


I guess you mean to add the dumper code after the subroutine?

Adding it there gives this error:

Global symbol "$args" requires explicit package name at lib/Database.pm line 83.
Compilation failed in require at ./gen_images line 17.
BEGIN failed--compilation aborted at ./gen_images line 17.

If you meant after the line:
my $args = shift

Then it gives:

Use of uninitialized value in split at ./gen_images line 39.
Output path is '/var/www/locahost/htdocs/photo/data/'
$VAR1 = {
          'file' => undef
        };
Use of uninitialized value in open at lib/Database.pm line 221.
Use of uninitialized value in concatenation (.) or string at lib/Database.pm 
line 221.
Cannot read database : No such file or directory at lib/Database.pm line 221


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to