aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 54fd7b1901fe15eb6dfc862155cd67ce212d6d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# KISSmo Perl Pastebin

KISSmo Perl is a lightweight and efficient pastebin application built with Mojolicious. This guide provides comprehensive instructions for setting up and running the application, including troubleshooting common dependency issues on various operating systems.

---

## Table of Contents

* [Features](#features)
* [Setting Up and Running KISSmo Perl](#setting-up-and-running-kissmo-perl)
    * [Step 1: Install Required Modules](#step-1-install-required-modules)
    * [Step 2: Create the SQLite Database](#step-2-create-the-sqlite-database)
    * [Step 3: Run the Perl Script](#step-3-run-the-perl-script)
    * [Step 4: Access the Application](#step-4-access-the-application)
    * [Step 5: Test the Application](#step-5-test-the-application)
    * [Step 6: Accessing Raw Paste Data](#step-6-accessing-raw-paste-data)
* [Troubleshooting Common Perl Module Issues](#troubleshooting-common-perl-module-issues)
* [Release Notes](#release-notes)
* [Demo](#demo)

---

## Features

* Simple and efficient paste management.
* Uses SQLite for data storage.
* Web interface for creating and viewing pastes.
* Raw paste data access.

---

## Setting Up and Running KISSmo Perl

This guide assumes you're using a Unix-like system (e.g., Linux, \*BSD, or macOS) and have Perl installed.

### Step 1: Install Required Modules

Before running the code, you need to install the necessary Perl modules. The recommended approach is to use your operating system's package manager, as this ensures proper integration and dependency management.

**General Fallback (Using `cpanm`):**

If your distribution's packages are unavailable or outdated, you can use **cpanminus**. First, ensure `cpanminus` is installed:

```bash
sudo cpan App::cpanminus # Or `sudo apt install cpanminus`, `sudo apk add perl-app-cpanminus`, etc.

```

Then, install the modules:

Bash

```
sudo cpanm Mojolicious DBI File::Slurp DBD::SQLite

```

**Operating System Specific Instructions:**

----------

#### Debian (and Ubuntu, Pop!_OS, Mint, etc.)

Bash

```
sudo apt update
sudo apt install libmojolicious-perl libdbi-perl libfile-slurp-perl libdbd-sqlite3-perl

```

----------

#### Alpine Linux

Bash

```
sudo apk update
sudo apk add perl perl-mojolicious perl-dbi perl-file-slurp perl-dbd-sqlite

```

----------

#### OpenBSD

```
doas pkg_add perl-Mojolicious perl-DBI perl-File-Slurp perl-DBD-SQLite

```

----------

#### Arch Linux (and Manjaro, EndeavourOS, etc.)

```
sudo pacman -Sy
sudo pacman -S perl-mojolicious perl-dbi perl-file-slurp perl-dbd-sqlite

```

----------

### Step 2: Create the SQLite Database

The application uses an SQLite database to store pastes. Create an empty SQLite database file named `pastes.db` and a directory for pastes in the same directory as your Perl script.

```
touch pastes.db && mkdir pastes

```

### Step 3: Run the Perl Script

Once you've installed the modules and created the database file, navigate to the directory containing your script and execute the following command:

```
perl paste.pl daemon -m production -l http://0.0.0.0:7878

```

This command starts the Mojolicious application as a daemon process, listening on all network interfaces on port `7878`. You should see output similar to:

```
[Sun Jun 23 12:34:56 2023] [info] Listening at "http://<your_server_ip>:7878"

```

### Step 4: Access the Application

Open a web browser and visit `http://<your_server_ip>:7878` to access the application. Replace `<your_server_ip>` with the actual IP address or hostname of the machine running the script. You should be presented with a web page featuring a text area for content input.

### Step 5: Test the Application

To test the application, enter some content into the text area and click the "**Create paste**" button. The application will generate a unique ID for the paste and display its details.

### Step 6: Accessing Raw Paste Data

To view the raw content of a paste, navigate to its detail page and click the "**RAW**" button.

----------

## Troubleshooting Common Perl Module Issues

If you encounter errors like `Can't locate Mojolicious/Lite.pm in @INC`, `Can't locate DBI.pm in @INC`, `Can't locate File/Slurp.pm in @INC`, or `install_driver(SQLite) failed: Can't locate DBD/SQLite.pm in @INC`, it means the required Perl modules aren't found in your system's Perl library paths.

These issues are typically resolved by installing the missing modules. Refer to **Step 1: Install Required Modules** and use the instructions specific to your operating system. Ensure you're installing the correct package names as provided for Debian, Alpine, OpenBSD, or Arch Linux. If your system's package manager doesn't provide the module, or you need a specific version, **cpanminus** is a reliable alternative.

----------

## Release Notes

For detailed information about the latest version, KISSmo 1.1.9, please refer to the official release notes:

[https://git.hax.al/KISSmoPerl/tag/?h=v1.9](https://git.hax.al/KISSmoPerl/tag/?h=v1.9)

----------

## Demo

Experience KISSmo Perl in action:

[https://paste.hax.al/](https://paste.hax.al/)