PerlでSeleniumを使う

2021年9月23日 Perl
ppmの件からの続き。

以下より chrome driverを入手して、所定の場所に格納しておく。
https://chromedriver.chromium.org/downloads
※バージョンを合わせないと動かないので注意

格納後、環境変数にpathを通しておかないとエラーになるので通しておくこと。

実行用のサンプルコードは下記を参照。
#!C:Perl64inperl.exe
use strict;
use warnings;
use Selenium::Chrome;

# driver instances
my $driver = Selenium::Chrome->new();

# open google top page
$driver->get(’https://www.google.com’);

print $driver->get_title() . " ";

# close chrome driver
$driver->shutdown_binary();

exit;

ちょっとツールを作りたくて、久しぶりにppmを起動しようとしたら、いつものパッケージ選択画面じゃなかった。どうやらバージョンアップで仕様が変わったらしい。
以下やったことのメモ。

1.ActiveState のサイトにログインする(アカウントが無ければ新規に作成する)
https://www.activestate.com/products/perl/downloads/
※これと同アカウントでppmでログインできる

2.必要なモジュールを検索する
Configuration タブで AddPackages を押下する。
パッケージ検索画面になるので、対象のパッケージを検索してaddを押下する。
(今回は Selenium::Remote::Driver とした)
選択したパッケージが緑色になったら、右上のDoneを押下する。
右上のCommit Changesを押下する。

# Build Status FAILED となったので再度色々確認していたら、Perlのバージョン設定が誤っていたので再選択した

3.インストーラをダウンロードする
Build Status が COMPLETE となったら、ビルドされた .exeまたは.msiをダウンロードする。(自分の場合はアンインストール→インストールした)

▼参考サイト
https://nandaka.net/archives/1066

Perl7

2020年6月27日 Perl
いつの間にかPerl7が発表されていた。
https://www.perl.com/article/announcing-perl-7/

Perl6の時はとても時間がかかっていた気がするが、今回はどうなんだろう。
最近JavaばかりでPerl書いてないなぁ…

Padre

2015年10月31日 Perl コメント (2)
少し前に彼女から「こんなPerlの統合開発環境があるよ」と情報が入り、実際に使ってみた。以前はEclipseも使っていたけど特に設定しなくても中々使いやすかったりするので、Perlを書く時にはこれを使うのもアリ。

▼Padre
http://padre.perlide.org/

Eclipse Perl Integration

2015年5月30日 Perl
Eclipse Perl Integration
Eclipse Perl Integration
【Eclipse Perl Integration】 メモ
自己学習用に環境構築を行ったのでメモ。

使用するもの
・ActivePerl
・Eclipse
・PadWalker

【ActivePerlをインストール】
http://www.activestate.com/activeperl/downloads

【Eclipseをインストール】
http://mergedoc.osdn.jp/

【PadWalkerをインストール】
※自分は添付画像1の様にppm経由でインストールした

【Eclipse Perl Integrationをインストール】
・Eclipseを起動
・メニューバーの「ヘルプ」→「新規ソフトウェアのインストール」を選択
・「追加」ボタン押下で追加設定を開く
・「名前」欄に「EPIC」、「ロケーション」に「http://e-p-i-c.sf.net/updates」を指定
・「EPIC メイン・コンポーネント」にチェックを入れて「次へ」押下
・インストーラ画面で「EPIC」がある事を確認して「次へ」押下
・「使用条件の条項に同意します」を選択してから「完了」を押下
・上記作業後にインストールが行われるのでEclipseを再起動

【実行環境の設定】
・「ウィンドウ」→「設定」から「Perl EPIC」を選択し「Perl 実行可能ファイル」の欄に自分の端末内の「perl.exe」を指定(大抵は「C:Perlinperl.exe」か「C:Perl64inperl.exe」になる)、「OK」を押下

【プロジェクトの作成】
・メニューバーの「新規」→「その他」を押下
・「Perl」を選択して「Perlプロジェクト」を選択、「次へ」押下
・Perlプロジェクト作成画面でプロジェクト名(何でもよい)を指定し「完了」押下
・画面左の「ナビゲーター」欄に作成したプロジェクトができるので、「作成したプロジェクト名」を選択して右クリック「新規」→「ファイル」を選択
・適当なファイル名(拡張子.pl)を指定

【実行してみる】
・適当なスクリプトを作成し、実行(緑の再生ボタン)する(添付画像2を参照)



参考サイト
▼[ActivePerl]eclipseにPerl開発環境(EPIC)を構築する
http://www.brainchild.co.jp/blog/develop/2010/09/activeperl3.html

▼スクリプト言語をサポートするEclipseプラグイン
http://www.atmarkit.co.jp/ait/articles/0602/25/news013.html

Perlエディタ

2015年5月30日 Perl
Perlエディタ
Perlエディタ
私的メモ
【Perlを始めよう!】
ダウンロード:http://homepage3.nifty.com/aokura/
・環境設定
メニューバーの「コマンド」→「環境設定」
使用するPerlの選択画面にある「Perlの所在を指定してください。」で自分の端末内にある「perl.exeの場所を指定」(大抵はC:PerlinかC:Perl64in)
・スクリプト実行
適当なスクリプトファイルを作成して保存
画面上部の赤字!を押下で実行

【サクラエディタ】
ダウンロード:http://osdn.jp/projects/sfnet_sakura-editor/
・入力補完機能を使う
一度入力してあるものを入力補完可能。(ctrl + space で入力補完)
添付画像では既に使用している「$str1」と「$str2」が候補として現れる。


Perl DBIメモ

2015年3月18日 Perl
$ENV{’ORACLE_HOME’} = "/usr/local/oracle";
$db = DBI->connect("DBI:Oracle:SID", "USERNAME", "Password");

SIDはtnsnames.oraを参照する。

DBI:Oracle

2013年4月9日 Perl
Perlを使用してDB(Oracle)に接続する際に、一々処理を書くのが面倒だったので設定ファイルを外部化させた上で容易に接続出来るようにサブルーチンを作成した。

メイン処理
#!/usr/bin/perl
use strict;
use warnings;
use DBI;

my $config_file = qq|./config.ini|;
my $dbh = &DB_Connect($config_file);

メインはこうした上で、下記のサブルーチンには設定ファイルを渡す。
サブルーチン
sub DB_Connect{
  my %Config_Hash =();
  my $return = qq||;
  if(-f $_[0]){
    open(FH,$_[0]);
    while(){
      chomp($_);
      my ($key,$value) = split(/=/,$_);
      $Config_Hash{’HOST’} = $value if($key eq ’HOST’);
      $Config_Hash{’PORT’} = $value if($key eq ’PORT’);
      $Config_Hash{’SID’} = $value if($key eq ’SID’);
      $Config_Hash{’SERVICE_NAME’} = $value if($key eq ’SERVICE_NAME’);
      $Config_Hash{’UserID’} = $value if($key eq ’UserID’);
      $Config_Hash{’Password’} = $value if($key eq ’Password’);
    }
    close(FH);
    $return = DBI->connect(qq|DBI:Oracle:HOST=$Config_Hash{’HOST’};PORT=$Config_Hash{’PORT’};SID=$Config_Hash{’SID’};SERVICE_NAME=$Config_Hash{’SERVICE_NAME’}|,qq|$Config_Hash{’UserID’}|,qq|$Config_Hash{’Password’}|);
    if(!defined($return)){
      $return = Error(qq|DB connection failed.| . qq|$DBI::errstr|);
    }
  }else{
    $return = qq|File $_[0] not found.|;
  }
  return $return;
}

設定ファイルは以下の通り。
config.ini の内容
HOST=[Host]
PORT=[Port Number]
SID=[SID]
SERVICE_NAME=[service name]
UserID=[User ID]
Password=[Pssword]

具体的には下記の通り―
設定ファイルの例
HOST=127.0.0.1
PORT=1521
SID=ORCL
SERVICE_NAME=my_service_name
UserID=user_name
Password=passwd

これでメインの $dbh にはデータベース・ハンドルが返ってくるので、後は実際に処理を記述すればいい。

Crypt::CBC

2013年2月22日 Perl コメント (2)
Crypt::CBC のメモ
Crypt::Blowfish と Crypt::CBC を使用。使う際は事前に用意しておく必要アリ。
ppm install --force Crypt::Blowfish
ppm install --force Crypt::CBC

#!/usr/bin/perl
use strict;
use warnings;
use Crypt::CBC;

my $content = qq||;

open(FH,"[plane_file]");
while(){ $content .= $_; }
close(FH);

my $key = ’crypt key’;# key
my $cipher = new Crypt::CBC($key,’Blowfish’);

$cipher->start(’encrypting’);
$content = $cipher->crypt($content);
$cipher->finish();
open(FH,"> [crypt_file]");
print FH $content;
close(FH);
exit;

$cipher->start(’encrypting’);
$content = $cipher->crypt($content);
$cipher->finish();
この箇所は
$cipher->encrypt("$content");
の方が分かり易いか。

複合化する場合は
$cipher->start(’decrypting’);
$content = $cipher->crypt($content);
$cipher->finish();

または
$cipher->decrypt("$content");

とする。

DNのバックアップ

2012年11月26日 Perl
DNのバックアップをローカルに取る。
これをcrontabで毎日自動実行すればバックアップが取得できる。
#!/user/bin/perl
use strict;
use warnings;
use LWP::UserAgent;

my $UserAgent = LWP::UserAgent->new;
# TimeOut
$UserAgent->timeout(8);

# Proxy
=pod
my $http_proxy = "[server]:[port]";
$ENV{HTTP_PROXY} = $http_proxy;
$ENV{HTTPS_PROXY} = $http_proxy;
$UserAgent->protocols_allowed(undef);
$UserAgent->env_proxy;
=cut

# Test URL
my $response = $UserAgent->get(’[URL]’);

if($response->is_success){
  my @array_time = localtime(time);
  $array_time[3] = sprintf("%02d",$array_time[3]);
  $array_time[4] = sprintf("%02d",$array_time[4] + 1);
  $array_time[5] = sprintf("%04d",$array_time[5] + 1900);  
  my $content = $response->content;
  open(FH,">> $array_time[5]$array_time[4]$array_time[3].html");
  print FH $content;
  close(FH);
}else{
  die $response->status_line;
}

exit;

プロキシ設定が必要な場合はプロキシ設定箇所のコメントアウトを除外してサーバIPとポート番号を指定する。あとはURLを自分のDNのURLに置き換えればOK。

DBI Fetch

2012年9月10日 Perl
# DBIを使用する時のメモ
#/usr/bin/perl
use DBI;

my $sql = qq|select value1 , value 2, value3 |;
  $sql .= qq|from table_name |;
  $sql .= qq|where value1 = :1 |;
  $sql .= qq|and value2 = :2 |;

my $sth = $dbh->prepare($sql);
  $sth->bind_param(1,$param1);
  $sth->bind_param(2,$param2);
  $sth->execute;

my @array = ();
my $var = $sth->fetchall_arrayref();
foreach(@$var){
  #push(@array,@$_);
  $value1 = $$_[0];
  $value2 = $$_[1];
  $value3 = $$_[2];
  push(@array,qq|$value1,$value2,$value3|);
}

exit;

ファイルをまとめる
下層ファイルを特定ディレクトリに集めるスクリプトを書いてみた。
画像収集とかで複数のディレクトリに分散して置かれてしまったファイルを同一ディレクトリに移動させつつ一意の番号で名称変更をする。
#!C:/Perl/bin/perl.exe
use strict;
use warnings;
use File::Copy;

# 移動元対象ディレクトリを指定
my $dir = q|C:/dummy|;
# 移動先ディレクトリ指定
my $mv_dir = q|C:/all_image|;

# 再帰的にファイル検索して一時ファイルに出力
my $tmp_file = q|./tmp|;
system("dir $dir /s /b > $tmp_file");

# 一時ファイルから読み込み -> 配列に格納
my @array_list = ();
open(FH,"$tmp_file") or die;
while(){
  $_ =~ s/[
]//g;
  push(@array_list,$_);
}
close(FH);
# 一時ファイル削除
unlink($tmp_file);

# 指定拡張子のみフィルタ
@array_list = grep(/(.jpg)$|(.png)$/,@array_list);

# 既存値を初期値として代入 -> 既存値が存在しない場合は 0 から開始
my $cnt = 0;
opendir(DIR,"$mv_dir") or die;
my @array_dir = readdir(DIR);
closedir(DIR);
@array_dir = grep(/(.jpg)$|(.png)$/,@array_dir);
# 昇順ソート
@array_dir = sort {$a cmp $b} @array_dir;
foreach(@array_dir){
  my $fn = $` if(/.[^.]+$/,$_);
  $cnt = $fn if($fn);
}

# ファイルをリネームして移動 -> シリアル番号 + 拡張子
foreach(@array_list){
  $cnt = sprintf("%05d",$cnt);
  my $ex = $& if(/.[^.]+$/,$_);
  move("$_","$mv_dir$cnt$ex");
  $cnt++;
}

exit;

最近麻雀で10連敗したり経費を踏み倒されてたりしてイライラしたので遊んでみた。
#!C:Perlinperl.exe
use strict;
use warnings;
use LWP::Useragent;
use HTTP::Request;
use Win32::GUI();
use Win32::Clipboard;

my $Clip = Win32::Clipboard();

# Create Window
my $Window = new Win32::GUI::Window(
 -name => ’Window’,
 -title => ’Sequentialer’,
 -accel => my $acc,
 -post => [400,300],
 -size => [400,300],
);
# Add Label
my $Label_Version = $Window->AddLabel(
 -name => ’Version’,
 -text => ’ver 1.10’,
 -align => ’left’,
 -top => 5,
 -left => 5,
 -width => 50,
 -height => 18,
);
my $Label_URL = $Window->AddLabel(
 -name => ’Label_URL’,
 -text => ’URL’,
 -align => ’left’,
 -top => 25,
 -left => 5,
 -width => 50,
 -height => 18,
);
my $Label_Extension = $Window->AddLabel(
 -name => ’Label Extension’,
 -text => ’Extension’,
 -align => ’left’,
 -top => 45,
 -left => 5,
 -width => 50,
 -height => 18,
);
my $Label_Header = $Window->AddLabel(
 -name => ’Label Header’,
 -text => ’Add 00’,
 -align => ’left’,
 -top => 44,
 -left => 136,
 -whdth => 50,
 -height => 18,
);
my $Label_Fooder = $Window->AddLabel(
 -name => ’Label Fooder’,
 -text => ’Add 99’,
 -align => ’left’,
 -top => 44,
 -left => 196,
 -width => 50,
 -height => 18,
);
my $Label_Hex = $Window->AddLabel(
 -name => ’Label_Hex’,
 -text => ’Hex(16)’,
 -align => ’left’,
 -top => 44,
 -left => 256,
 -height => 18,
);
my $Label_Result = $Window->AddLabel(
 -name => ’Label_Reault’,
 -text => ’Result’,
 -align => ’left’,
 -top => 63,
 -left => 5,
 -width => 50,
 -height => 18,
);
my $Label_Proxy = $Window->AddLabel(
 -name => ’Label_Proxy’,
 -text => ’Proxy’,
 -align => ’left’,
 -top => 63,
 -left => 135,
 -width => 50,
 -height => 18,
);
# Add Button
my $Button_Paste = $Window->AddButton(
 -name => ’Button_Paste’,
 -title => ’Paste’,
 -top => 20,
 -left => 323,
 -width => 60,
 -height => 18,
);
my $Button_Create = $Window->AddButton(
 -name => ’Button_Create’,
 -title => ’Create’,
 -top => 40,
 -left => 323,
 -width => 60,
 -height => 18,
);
my $Button_Copy = $Window->AddButton(
 -name => ’Button_Copy’,
 -title => ’Copy’,
 -top => 60,
 -left => 323,
 -width => 60,
 -height => 18,
);
# Add TextField
my $Textfield_URL = $Window->AddTextfield(
 -name => ’TextfieldURL’,
 -top => 21,
 -left => 60,
 -width => 240,
 -height => 18,
 -multiline => 0,
);
my $Textfield_Extension = $Window->AddTextfield(
 -name => ’TextfieldExtension’,
 -top => 41,
 -left => 60,
 -width => 50,
 -height => 18,
 -multiline => 0,
);
my $Textfield_Result = $Window->AddTextfield(
 -name => ’Textfield_Result’,
 -top => 80,
 -left => 5,
 -width => 380,
 -height => 180,
 -multiline => 1,
 -vscroll => 1,
);
# AddCheckBox
my $CheckBox_Header = $Window->AddCheckbox(
 -name => ’CheckBox_Header’,
 -top => 42,
 -left => 120,
 -width => 15,
 -height => 15,
 -checked => 0,
);
my $CheckBox_Footer = $Window->AddCheckbox(
 -name => ’CheckBox_Footer’,
 -top => 42,
 -left => 180,
 -width => 15,
 -height => 15,
 -checked => 0,
);
my $CheckBox_Hex = $Window->AddCheckbox(
 -name => ’CheckBox_Hex’,
 -top => 42,
 -left => 240,
 -width => 15,
 -height => 15,
 -checked => 0,
);
my $CheckBox_Proxy = $Window->AddCheckbox(
 -name => ’CheckBox_Proxy’,
 -top => 62,
 -left => 120,
 -width => 15,
 -height => 15,
 -checked => 0,
);

&Message_Label(’’);

# Display Window
$Window->Show;
$Window->Dialog;

exit;

# Clipboard_Paste
sub Button_Paste_Click{
 $Textfield_URL->Text($Clip->Get());
}
# Clipboard_Create
sub Button_Create_Click{
 my $Temp_URL = $Textfield_URL->Text();
 my $Temp_Extension = $Textfield_Extension->Text();
 my $Temp_Header = $CheckBox_Header->GetCheck();
 my $Temp_Footer= $CheckBox_Footer->GetCheck();
 my $Temp_Hex = $CheckBox_Hex->GetCheck();
 my ($Result,$Base);
 if($Temp_URL){
  my @URL = split(///,$Temp_URL);
  if($Temp_Hex){
   my($Number,$Extension) = split(/./,pop(@URL));
   if(($Number)and($Extension)and($Number =~ m/_/)){
    $Extension = $Temp_Extension if($Temp_Extension);
    my($XNum,$YNum) = split(/_/,$Number);
    if($XNum !~ m/[^0-9]/){
     foreach(@URL){ $Base .= "$_/"; }
     my $Cnt = 1 - $Temp_Header;
     my $Nax = hex($YNum);
     while(1){
      my ($Num,$LNum,$HNum) = (’’,’’,’’);
      for(my $ZCnt=0;$ZCntrequest($request);
  if($res->is_success){
   my $content = $res->content;
   $outfile = &Replace($outfile);
   open(FH, "> $directory$outfile");
   binmode FH;
   print FH "$content";
   close(FH);
   $filenum_ok++;
  }else{
   $filenum_ng++;
  }
  sleep($waittime);
  &Message_Label(’’);
  &Message_Label("Data acquiring ... $filenum_ok/$filenum_all");
 }
 &Message_Label(’’);
 &Message_Label("Complete ! $filenum_ok/$filenum_all") if($filenum_ng == 0);
 &Message_Label("Complete ! $filenum_ok/$filenum_all NG File $filenum_ng") if($filenum_ng != 0);
}

# Clipboard_Copy
sub Button_Copy_Click{
 $Clip->Set($Textfield_Result->Text());
}

# Word replace for windows filename
sub Replace{
 my $word = $_[0];
 $word =~ s//¥/g;
 $word =~ s/////g;
 $word =~ s/*/*/g;
 $word =~ s/:/:/g;
 $word =~ s/?/?/g;
 $word =~ s//>/g;
 $word =~ s/"/”/g;
 $word =~ s/|/|/g;
 return($word);
}

# Create Message
sub Message_Label{
 my $Message = $_[0];
 $Message = ’ ’ unless($Message);
 my $Label_Message = $Window->AddLabel(
  -name => ’Message’,
  -text => "$Message",
  -align => ’left’,
  -top => 5,
  -left => 60,
  -width => 200,
  -height => 17,
 );
 $Window->Update();
}

今日も今日とて抜け道探し。

~この前に何かの処理
my @array = (’04001’,’4001’,’03001’,’5001’);
my %hash = ();
foreach(@array){
  $hash{"$_"}++;
}
my @error = ();
foreach(sort keys %hash){
  push(@error,$_) if($hash{"$_"} > 1);
}
これ以降何かの処理~

同一数の多重化チェック。2つ以上ならエラーとしてみなす。
途中で桁合わせ(つまりsprintf)していなかったせいで多重化チェックが働いていない罠。
この場合は配列の"数値"としては同じだが、 04001 と 4001 のチェックがスルーされる。
しかもこの処理の後に表示する前にsprintfされていたから表記上は発見出来ず、見つけるまでに時間がかかってしまった。大いに反省。
# オブラートに包んだ内容だけど、詳しく書くとアレなので省略
# 追記:@error配列にmyが無かった


初春や助手ならこんな事無いんだろうけどなぁ…

過去日付

2012年2月17日 Perl
最近この手のことを書いていなかったので。
過去日付を連続して YYYY/MM/DD 形式で取得する。

#!/usr/local/bin/perl
use strict;
use warnings;

my @array = ();
# 1週間分取得
for(-6..0){
  my $a = &GetDate($_);
  push(@array,$a);
}
# 表示確認
foreach(@array){
  print "$_
";
}
exit;

# 日付を引数にして YYYY/MM/DD形式で返す
sub GetDate{
  my $date = $_[0] * 24 * 60 * 60;
  my @time = localtime(time + $date);
  $time[3] = sprintf("%02d",$time[3]);
  $time[4] = sprintf("%02d",$time[4]+=1);
  $time[5] = sprintf("%04d",$time[5]+=1900);
  return "$time[5]/$time[4]/$time[3]";
}

Apacheのログ出力を画面に出すモノを書いてみた。
サーバに端末から入って tail -f [path] しなくてもいいようにしたもの。
設定ファイルを外部に持たせているので簡単に使える。
内容については設定ファイルに書いてあるのでそちらをどうぞ。

ダウンロードは下記からどうぞ。
http://www16.atpages.jp/library4/cgi-bin/apachelogs.zip

※自由に改変して再配布して下さい。お役に立てたら幸いです。
# MTG風 正規表現

$_ =~ s/私は軽いけれど、私は暗い/私は光、私は闇/g;
$_ =~ s/大始祖/大祖始/g;
$_ =~ s/スクラジムンダール/スラクジムンダール/g;
$_ =~ s/無造作/無作為/g;

システムリリース直後の本番稼働日はトラブルが付物。
あちらこちらで色々問題が出るなぁ…

作ってみたけどこんなんだっけ?
即席だから微妙…

http://www16.atpages.jp/library4/cgi-bin/test.cgi


#!/usr/local/bin/perl
use strict;
use warnings;

my $host_name = &GetHost($ENV{’REMOTE_ADDR’});

print "Content-type: text/html; charset=utf-8";
print qq|ip address is $ENV{’REMOTE_ADDR’}|;
print qq|host name is $host_name|;

exit;

sub GetHost{
 my($ip) = @_;
 my @addr = split(/./,$ip);
 $ip = pack("C4",$addr[0],$addr[1],$addr[2],$addr[3]);
 my($host_name) = gethostbyaddr($ip,2);
 return $host_name;
}


#!/usr/bin/perl

use strict;
use warnings;

my $base_name = ’./dummy’;

# Start Rename.
# Read base directory files.
my @file = &Function_Read_Directory($base_name);

# Rename files to file update time.
foreach(@file){
  # File found image file.
  my $fn = qq|$base_name/$_|;
  if((-f qq|$fn|)and($_ =~ m/(.jpg$)|(.jpeg$)|(.png$)|(.bmp$)/gi)){
    # Get file update time.
    my($sec,$min,$hour,$day,$mon,$year) = localtime((stat($fn))[9]);
    # Conversion random number.
    my $int = sprintf("%05d",rand(int(10000)));
    # Conversion update time.
    my $update_time = sprintf("%04d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$day,$hour,$min,$sec);
    # Temp rename target file. // extension no change.
    if($fn =~ m/(.*).(.*)/g){
      rename($fn,qq|$base_name/$update_time$int.$2|);
    }
  }
}

# Read base directory files.
@file = ();
@file = &Function_Read_Directory($base_name);

my $cnt = 0;
foreach(@file){
  # File found image file.
  my $fn = qq|$base_name/$_|;
  if((-f qq|$fn|)and($_ =~ m/(.jpg$)|(.jpeg$)|(.png$)|(.bmp$)/gi)){
    # Conversion count.
    $cnt = sprintf("%05d",$cnt);
    # Commit rename target file. // extension no change.
    rename($fn,qq|$base_name/$cnt.$2|) if($fn =~ m/(.*).(.*)/g);
    # Add count
    $cnt++;
  }
}

# Read directory.
sub Function_Read_Directory{
  # Read directory.
  opendir(DIR,qq|$_[0]|) or die;
  my @dir = readdir(DIR);
  closedir(DIR);
  # Sort descending order.
  my @sort_dir = sort {$a cmp $b} @dir;
  return @sort_dir;
}

exit;

# どうもインデントがおかしいのでタブを全角に変換して記載
# 時刻整形の箇所が2行になっているが、本来は同一行

最新の日記 一覧

<<  2025年4月  >>
303112345
6789101112
13141516171819
20212223242526
27282930123

お気に入り日記の更新

この日記について

日記内を検索