Win32::IE::Image - Mimic L<WWW::Mechanize::Image>


Win32-IE-Mechanize documentation Contained in the Win32-IE-Mechanize distribution.

Index


Code Index:

NAME Win32::IE::Image

Top

Win32::IE::Image - Mimic WWW::Mechanize::Image

SYNOPSIS

Top

    use Win32::OLE;
    use Win32::IE::Image;

    my $agent = Win32::OLE->new( 'InternetExplorer.Application' );
    $agent->Navigate( $uri );

    # extract the images and wrap them as Win32::IE::Image
    my $doc = $agent->Document;
    my @images;
    for ( my $i=0; $i < $doc->images->lenght; $i++ ) {
        push @images, Win32::IE::Image->new( $doc->images( $i ) );
    }

    # print the information from the images:
    foreach my $img ( @images ) {
        printf "%s as %s\n", $img->url, $img->alt||"";
    }

DESCRIPTION

Top

The Win32::IE::Image object is a thin wrapper around the DOM-object supplied by the InternetExplorer.Application. It is implemented as a blessed reference to the Win32::OLE-DOM object.

METHODS

Top

Win32::IE::Image->new( $element )

Create a new object, that implements url, base, tag, height, width, alt and name

$image->url

Return the SRC attribute from the IMG tag.

$image->tag

Return 'IMG' for images.

$image->width

Return the value width attrubite.

$image->height

Return the value height attrubite.

$image->alt

Return the value alt attrubite.

COPYRIGHT AND LICENSE

Top


Win32-IE-Mechanize documentation Contained in the Win32-IE-Mechanize distribution.
package Win32::IE::Image;
use strict;
use warnings;

# $Id: Image.pm 233 2005-01-09 19:09:55Z abeltje $
use vars qw( $VERSION );
$VERSION = '0.002';

sub new {
    my $class = shift;

    bless \( my $self = shift ), $class;
}

sub url {
    my $self = ${ $_[0] };
    return $self->{SRC};
}

sub tag {
    my $self = ${ $_[0] };
    return $self->{TAGNAME};
}

sub width {
    my $self = ${ $_[0] };
    return $self->{WIDTH};
}

sub height {
    my $self = ${ $_[0] };
    return $self->{HEIGHT};
}

sub alt {
    my $self = ${ $_[0] };
    return $self->{ALT};
}