Skip to content

Commit e9ab492

Browse files
committed
create-file.pl
1 parent e98e3f4 commit e9ab492

File tree

3 files changed

+44
-7
lines changed

3 files changed

+44
-7
lines changed

resources/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150

151151
<div class="row">
152152
<a class="btn btn-primary" href="select_file.dialog" role="button">Open File</a>
153-
<a class="btn btn-primary" href="new_file_name.dialog" role="button">New File</a>
153+
<a class="btn btn-primary" href="new_file.dialog" role="button">New File</a>
154154
<a class="btn btn-primary" href="select_files.dialog">Open Multiple Files</a>
155155
<a class="btn btn-primary" href="select_directory.dialog">Open Directory</a>
156156
</div>

resources/app/peb-demo.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ open_directory.stdoutFunction = function (stdout) {
3232
displayTestResult('open-directory', stdout);
3333
}
3434

35+
var create_file = {};
36+
create_file.scriptRelativePath = 'perl-scripts/create-file.pl';
37+
create_file.stdoutFunction = function (stdout) {
38+
displayTestResult('new-file', stdout);
39+
}
40+
3541
var perl_info = {};
3642
perl_info.scriptRelativePath = 'perl-scripts/perl-info.pl';
3743
perl_info.stdoutFunction = function (stdout) {
@@ -59,13 +65,16 @@ select_file.receiverFunction = function (fileName) {
5965
form.submit();
6066
}
6167

62-
var new_file_name = {};
63-
new_file_name.type = 'new-file-name';
64-
new_file_name.receiverFunction = function (fileName) {
68+
var new_file = {};
69+
new_file.type = 'new-file-name';
70+
new_file.receiverFunction = function (fileName) {
71+
create_file.inputData = fileName;
6572
clearTestData();
66-
var pre = document.createElement("pre");
67-
pre.innerHTML = 'New file name: ' + fileName;
68-
document.getElementById('tests').appendChild(pre);
73+
74+
var form = document.createElement('form');
75+
form.setAttribute('action', 'create_file.script');
76+
document.body.appendChild(form);
77+
form.submit();
6978
}
7079

7180
var select_files = {};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/perl
2+
3+
# Perl Executing Browser Demo
4+
5+
# This program is free software;
6+
# you can redistribute it and/or modify it under the terms of the
7+
# GNU Lesser General Public License,
8+
# as published by the Free Software Foundation;
9+
# either version 3 of the License, or (at your option) any later version.
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY;
12+
# without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE.
14+
# Dimitar D. Mitov, 2013 - 2019
15+
# Valcho Nedelchev, 2014 - 2016
16+
# https://github.com/ddmitov/perl-executing-browser
17+
18+
use strict;
19+
use warnings;
20+
21+
my $filename = <STDIN>;
22+
chomp $filename;
23+
24+
open my $filehandle, '>>', $filename or warn "Unable to create $!";
25+
print $filehandle "Pel Executing Browser Demo Test File";
26+
close $filehandle;
27+
28+
print "$filename is successfully created.";

0 commit comments

Comments
 (0)