1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Perl のライブラリーがインストールされているか確認するプログラム

Last updated at Posted at 2020-06-15

Perl のライブラリーがインストールされているか確認するサンプルプログラムです。
Raspberry Pi で確認しました。

Jcode

jcode_check.pl
# !/usr/bin/perl
#
use Jcode;

$val1 = Jcode->new("秋葉原UDX")->utf8;
print "$val1\n";

$val2 = Jcode->new("秋葉原UDX","utf8")->utf8;
print "$val2\n";

$val3 = Jcode->new("秋葉原")->utf8;
print "$val3\n";

実行結果

$ ./jcode_check.pl 
遘玖痩蜴欟DX
秋葉原UDX
秋葉原

Image::Magick

image_magick_check.pl
# ! /usr/bin/perl
#  
use Image::Magick;
 
$filename = "sample01.jpg";
my $image = Image::Magick->new;
$image->Read("$filename");

my ($width, $height) = $image->Get('width', 'height'); 

print "width = " . $width . "\n";
print "height = " . $height . "\n";

undef $image; 
exit();

実行結果

$ ./image_magick_check.pl 
width = 270
height = 180

LWP::Simple

lwp_simple01.pl
# ! /usr/bin/perl

use LWP::Simple;
 $content = get("https://ekzemplaro.org/");
 die "Couldn't get it!" unless defined $content;

 print $content;

実行結果

$ ./lwp_simple01.pl 
Wide character in print at ./lwp_simple01.pl line 7.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="Pragma" content="no-cache" />
(省略)

Raspbian でのライブラリーのインストール方法

sudo apt install libjcode-pm-perl
sudo apt install libimage-magick-perl
sudo apt install libwww-perl
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?