Though I personally take a different route, probably the easiest way is to create a new project on the website, leave the option "Initialize repository with a README" or similar enabled, and then do a git clone to get that repository onto the local machine, and then start working in this new directory, pushing changes up to the server as desired.
You know, haukex, I might read your posts ten times and still get something from them. I finally cottoned on to the whole git clone deal, and I'm able to move forward:
$ git clone https://github.com/haukex/webperl.wiki.git wiki
Cloning into 'wiki'...
remote: Enumerating objects: 64, done.
remote: Total 64 (delta 0), reused 0 (delta 0), pack-reused 64
Unpacking objects: 100% (64/64), done.
$ ls
1.example.config.txt 1.txt 2.txt 4.getopt.pl 5.git.sh wiki
1.git.sh 2.git.sh 3.git.sh 5.getopt.pl README.md
$ cd wiki
$ ls
Building-WebPerl.md _Footer.md Perl6.md Using-Web
+Perl.md
FAQ.md Home.md Post-your-Examples-Here.md
$ cat Using-WebPerl.md
These are **supplemental** notes on using WebPerl.
Please see the main documentation at **<https://webperl.zero-g.net/usi
+ng.html>**.
- Nothing here yet.
$ pwd
/home/pi/Documents/curate/perlmonks/trans/trans/trans/wiki
$ ls
Building-WebPerl.md _Footer.md Perl6.md Using-Web
+Perl.md
FAQ.md Home.md Post-your-Examples-Here.md
$ git clone --branch gh-pages https://github.com/haukex/webperl.git pa
+ges
Cloning into 'pages'...
remote: Enumerating objects: 1106, done.
remote: Total 1106 (delta 0), reused 0 (delta 0), pack-reused 1106
Receiving objects: 100% (1106/1106), 6.15 MiB | 2.48 MiB/s, done.
Resolving deltas: 100% (711/711), done.
$ ls
Building-WebPerl.md _Footer.md pages Post-your-Examples-Here.md
FAQ.md Home.md Perl6.md Using-WebPerl.md
$ cd pages/
$ ls
building.md favicon.ico legal.md regex.html
CNAME HD_WebPerl_GPW_2019_Slides.pdf _misc using.md
_config.yml HD_WebPerl_Riga_2019_Slides.pdf notes.md webperl.png
democode index.md perl6.md
$
Q1) How do I clone the rpi repo that I visit so much and now can't find?
I hadn't been in a position to follow webperl main page when you rolled it out. I remember that I had some crummy hosting arrangement at the time that didn't allow me to have sudo privileges, so I couldn't replicate much of any of it. Well, now is the dead of winter, and I have my perl feet under me now. I'm confident that if I typed:
plackup webperl.psgi
, your software would snap to attention and be ready for contact. So I have executed the cpanfile that was:
# $ cpanm --installdeps .
requires 'Cpanel::JSON::XS';
requires 'Plack';
requires 'Plack::Middleware::CrossOrigin';
requires 'Plack::Middleware::Auth::Digest';
Q2) Is Plack the solution for my upload question?
I'm concerned that I see the date of 2009 at stackoverflow thread on psgi and advent.plackperl, but I'm hoping that means that it is well-seasoned rather than obsolete. I am encouraged to see the name Miyagawa on it. One comment from these sources:
I'm new in PSGI too, but zilion things now are much easier as before in my apache/mod_perl era.
try write some apps with it and will find than Plack is like the first sex - now you didn't understand that you could live without it.
ps: If was here something like "Perl Oscar", will sure nominating MyiagavaSan. :)
That's kind of the way I feel about:
cpanm --installdeps .
Again, thanks for your writeup....
Gruss aus Amiland,
| [reply] [d/l] [select] |
Q1) How do I clone the rpi repo that I visit so much and now can't find?
My Raspberry Pi notes used to be in my "hgpstools" repository, and a few older notes are still there, but I've moved my main and most current Raspberry Pi notes to a separate repository, which is mirrored to GitHub: git clone https://github.com/haukex/raspinotes.git
Q2) Is Plack the solution for my upload question?
Plack is somewhat lower-level, but still relevant, and though I haven't used it myself for this purpose, it is one way to handle file uploads. I would still recommend Mojolicious instead - I don't understand your previous comments about it: "... deployment size and simplicity is relevant. I don't need a lot of software here." Mojo isn't all too big, and only has very few non-core dependencies, so it really isn't that big of a deal, and what you get in exchange is a really good framework.
| [reply] [d/l] |
Well, CGI.pm is indeed pretty ancient (see also for modern alternatives), but its documentation does show that as an example of how to handle the upload. BTW, your code example appears to be missing strict and warnings, proper open usage, and a binmode (or '>:raw' layer in the open) on the filehandle.
Thx, haukex, I finally got some results after digesting forum comments properly. I didn't mean for the CGI code for more than a motivating counterexample of what not to do:
use strict;
use warnings;
use CGI;
# create a CGI object (query) for use
my $q = CGI->new;
my $fh = $q->upload('file_field');
This would be syntactic perl for backwards compatibility, but perl malpractice in 2023 for a variety of reasons. I think this tells an interesting story: CGI::Alternatives. Let's consider alternatives:
What about something like CGI::Carp? Is this not in the contemporary core?
I'd like to work up examples with Dancer2 and either of Miyagawa's PSGI or Plack, if anyone has anything to share from these mods.
Personally, I prefer Mojolicious. Its tutorial includes an example, and on my scratchpad I have linked quite a few of my Mojo examples.
I've gone with Mojo before, but I consider it the full buffet and more than I want, since I won't be using 99% of it, and deployment size and simplicity is relevant. I don't need a lot of software here. I need a few lines from the right software, and I'd like to judge by side by side comparison.
If your ssh -T git@gitlab.com works on the same machine, then that's really strange and would indicate a problem with your network configuration or some other strange thing is going on. Though this is definitely worth debugging, I just wanted to take this oppertunity to say that I usually recommend the https protocol for all git remotes, as my experience has been it's easier to set up, especially in combination with e.g. git-credential-cache.
Yes, so I broke through on the gitlab front at long last. (See below)
Though I personally take a different route, probably the easiest way is to create a new project on the website, leave the option "Initialize repository with a README" or similar enabled, and then do a git clone to get that repository onto the local machine, and then start working in this new directory, pushing changes up to the server as desired
Ok, I'll consider that approach. I'm gonna post some output, but I won't have a ginormous source post, because I have it hosted by gitlab, so I don't have to shove it code tags: yay!
./5.getopt.pl --infile /home/fritz/Desktop/1.hauke.txt --outfile /home/fritz/Desktop/1.hauke_trans.txt --lang DE
/home/fritz/Desktop/1.hauke.txt, /home/fritz/Desktop/1.hauke_trans.txt, DE, 0
Thank you for the comments and helpful source. I felt like a ship lost at sea without a host because I had unmoored myself from American tech giants. I tried to sign up for gitlab and showed up instead at the server that haukex's employer uses, because I'm there so often to get the details on configuring an rpi. I was refused entrance, and I thought, "gosh, I've never been refused entrance to anything in Berlin ever. Is this a new balkanization of the net?" No. It's me showing up in the wrong place, disoriented by Charybdis, blinded by Scylla....
Ich danke Ihnen für die Kommentare und die hilfreiche Quelle. Ich fühlte mich wie ein Schiff, das ohne Host auf See verloren gegangen ist, weil ich mich von den amerikanischen Tech-Giganten losgesagt hatte. Ich habe versucht, mich bei Gitlab anzumelden und bin stattdessen auf dem Server aufgetaucht, den haukex's Arbeitgeber benutzt, weil ich so oft dort bin, um die Details zur Konfiguration einer rpi zu erfahren. Mir wurde der Zutritt verweigert, und ich dachte: "Meine Güte, mir wurde in Berlin noch nie der Zutritt zu irgendetwas verweigert. Ist das eine neue Balkanisierung des Netzes?" Nein. Ich bin nur am falschen Ort aufgetaucht, verwirrt von Charybdis, geblendet von Scylla....
...
So lot's of changes with hosting situations, and I found it much better to use Getopt::Long and the command line to input the data rather than have it instantiated in a sub. I'm super rusty with the module building parts that I just couldn't even start with that. Now that I have a place to host source code again, maybe this is the type of thing I should work up again.
So viele Änderungen mit Hosting-Situationen, und ich fand es viel besser, Getopt::Long und die Befehlszeile zu verwenden, um die Daten einzugeben, anstatt es in einem Sub instanziiert haben. Ich bin super rostig mit dem Modul Gebäude Teile, die ich einfach nicht einmal mit, dass beginnen konnte. Jetzt, wo ich wieder einen Ort habe, an dem ich den Quellcode hosten kann, ist das vielleicht die Art von Sache, an der ich wieder arbeiten sollte.
...
It was a comedy of many errors to migrate from github to gitlab, but I think I'm finally getting in there with a secure ssh connection. So many hosting situations have changed this year in particular. I hope no one owns stock in Twitter right now. Wouldn't it be nice if the word "tweet" were returned to the birds?
Es war eine Komödie mit vielen Fehlern, von github zu gitlab zu migrieren, aber ich glaube, ich komme endlich mit einer sicheren ssh-Verbindung hinein. Vor allem in diesem Jahr haben sich so viele Hosting-Situationen geändert. Ich hoffe, dass im Moment niemand Aktien von Twitter besitzt. Wäre es nicht schön, wenn das Wort "tweet" zu den Vögeln zurückkehren würde?
./5.getopt.pl : done, success.
fritz@laptop:~/Documents/repo1$
Source is trans script. I also have example.config, which shows the proper form for the config (with appropriate redaction this time):
[deepl]
url=https://api-free.deepl.com/v2/translate
key=redacted
So, yay, progress with hosting but fishing for CGI alternative code.
Gruss aus Amiland,
| [reply] [d/l] [select] |
What about something like CGI::Carp? Is this not in the contemporary core?
$ corelist CGI::Carp
Data for 2022-12-20
CGI::Carp was first released with perl 5.004, deprecated (will be CPAN
+-only) in v5.19.7 and removed from v5.21.0
$
So that's a pretty definitive "no".
Note that none of the other alternatives you have mentioned are in core either, which is fine by me. Just download what you want to use and then use it - don't worry about what is bundled in.
| [reply] [d/l] |
| [reply] |