Win32::IEFavorites::Item - Internet Explorer's Favorites item


Win32-IEFavorites documentation Contained in the Win32-IEFavorites distribution.

Index


Code Index:

NAME

Top

Win32::IEFavorites::Item - Internet Explorer's Favorites item

SYNOPSIS

Top

  use Win32::IEFavorites;

  my @items = Win32::IEFavorites->find;

  foreach my $item (@items) {
    print $item->url,"\n";
    print $item->modified->ymd,"\n";
  }

METHODS

Top

new

Creates an object.

path

Returns the path of the shortcut.

url

Returns the url of the shortcut.

modified

Returns a DateTime object for the modified time of the shortcut.

iconfile

Returns the icon file of the shortcut.

iconindex

Returns the icon index of the shortcut.

AUTHOR

Top

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Top


Win32-IEFavorites documentation Contained in the Win32-IEFavorites distribution.

package Win32::IEFavorites::Item;

use strict;
use warnings;

our $VERSION = '0.02';

use Config::IniFiles;
use Win32::IEFavorites::DateTime;

sub new {
  my ($class, $path) = @_;

  bless {
    path     => $path,
    cached   => 0,
    datetime => undef,
  }, $class;
}

sub _value {
  my ($self, $type) = @_;
  $self->_load unless $self->{cached};

  $self->{$type};
}

sub _load {
  my $self = shift;
  my $ini  = Config::IniFiles->new( -file => $self->{path} );
  foreach my $type (qw/URL Modified IconFile IconIndex/) {
    $self->{lc($type)} = $ini->val('InternetShortcut',$type) || '';
  }
  $self->{cached} = 1;
}

sub path      { $_[0]->{path}; }
sub url       { $_[0]->_value('url'); }
sub iconfile  { $_[0]->_value('iconfile'); }
sub iconindex { $_[0]->_value('iconindex'); }

sub modified  {
  my $self     = shift;
  unless ($self->{datetime}) {
    my $modified = $self->_value('modified');
    $self->{datetime} = Win32::IEFavorites::DateTime->new($modified);
  }
  $self->{datetime};
}

1;
__END__