?

Log in

No account? Create an account

Previous Entry | Next Entry

Perl: JLJ

weather: sunny/cloudy
mood: amused

WOOHOO!!! I got it working. It was just a matter of ironing out minor Windoes things. =D

[Tuesday, May 21, 2002 - 1811h]

Okay, this wasn't actually posted with JLJ 2.3, but it actually connected to LJ for me and added itself to my "Clients used:" list, so I felt the need to explain =D

JLJ was meant to be used with some kind of UNIX or Linux. I was running it on NT2000 with ActivePerl. It should work the nearly same way. I tweaked the things I knew about, but I guess the things I don't know about were out of whack.

It barfed on submit_form_to_server()...

C:\jlj>jlj.pl
[new]/offline?
Welcome, Bride of The First House.
Subject? Perl: jlj
Enter body of text. use a '.' on a line by itself to end.

Testing with jlj 2.3
.
[send]/postpone/queue/delete?
Welcome, Bride of The First House.
ERROR: Was not able to send message. (Client error: Missing required argument(s))

JLJ version 2.3 2002-April-02
Scott "Jerry" Lawrence jlj@umlautllama.com
http:// jerronimo. livejournal. com
http:// www.cis. rit.edu/~jerry/Software/perl/#jlj

C:\jlj>

[Update - 1833h]

Oh, how very interesting... I see why it's failing. Sorta. An LJ entry must have a value in the EVENT thing. EVENT comes from the var $body which is completely missing. So, of course, LJ laughs and tells me to go away. And, SUBJECT is also missing.

[Update - 2223h]

jerronimo wrote:
although, i think i know what might be the problem... it's probably looking for files lile ~yourusername/.jlj/queue/file where on your pc, those files do not exist at all.

Oh okay, yeah, that jives with what I found ... $fullbody was null just before being sent off. And when I was running it, I kept refreshing the /.jlj/queue directory, but nothing showed up.

I'll probably pick at it in the next little while =)

[Update - Wednesday, May 22, 1050h]

WHEEEEEEE!!! I got it. =D Some documentation:

1. .livejournal.rc can live anywhere as long as the HOME environment variable is defined and pointing to it. To define an environment variable:

a. Right-click on "My Computer" and go to "Properties".
b. Go to the "Advanced" tab.
c. Click on "Environment Variables".
d. Add a new System Variable (Variable Name = "HOME"; Variable Value = C:\path\to\.livejournal.rc\file).

I don't think you have to mess with the "base dir" setting in .livejournal.rc because it's not used it anyway.

2. Windows filenames cannot contain certain characters... ':' being one of them =) It was failing on creating $tempfilename, but not telling anyone =P I took the colons out of Line 1517.

3. Windows paths use '\' as the directory separator. So, everywhere that you build the directory paths, I had to change '/' to '\\' (I just changed them where I saw them, I don't know if I got them all).

And this should work on Win9x-2K with the default installation of ActivePerl.

An odd thing I noticed though... it seems to ignore the "Security:" setting in .livejournal.rc. I have it set to "Public" (that's the first one in the list and I even tried deleting the others). But my entries all get posted as "Private".

Oh! And I just discovered that we can have stuff sticking out of the <lj-cut> tags now =) =) =) Thanks ntang!! =)


Comments

( 9 comments — Leave a comment )
badkarma_05
May. 22nd, 2002 11:02 am (UTC)
Is that like the fairy tale of The Princess And The Pea?
bride
May. 22nd, 2002 11:03 am (UTC)
Re:
Kinda, yeah =)
green_paper
May. 22nd, 2002 12:33 pm (UTC)
Ugh, that stuff reminds me of my computer science days... Except in your case, you figured out what was wrong and WHY it was wrong. (For me, it was usually "I changed it to this and now it works. Don't ask me why though.")
dcm_wong
May. 23rd, 2002 01:45 am (UTC)
3. Windows paths use '\' as the directory separator. So, everywhere that you build the directory paths, I had to change '/' to '\\' (I just changed them where I saw them, I don't know if I got them all).

why not write a script to change every '/' that remotely resembles a directory indicator to '\'??

Have you tried to use PerlBuilder to make the perl file an executable instead of running the interpretor every time on Win? it's frustrating sometimes, not being able to use command line args like *.*
bride
May. 23rd, 2002 09:34 am (UTC)
Re:
why not write a script to change every '/' that remotely resembles a directory indicator to '\'??

Because 1) not all '/'s in the script are directory separators. Some things were supposed to be forward slashes; 2) I wouldn't have needed to write an extra script to do it, I'd just do a regexp string replacement in vi.

Have you tried to use PerlBuilder to make the perl file an executable instead of running the interpretor every time on Win? it's frustrating sometimes, not being able to use command line args like *.*

Making an executable would require an extra compile step... every time I make a small tweak, I have to recompile. It's less of a bother to just run the script.

I'm not sure how much easier that would have been. It's simple enough that it's all in one script, so I don't need *.* at all.
dcm_wong
May. 23rd, 2002 10:18 am (UTC)
Re:
yea, that's why I said "remotely resembles"
bride
May. 23rd, 2002 10:21 am (UTC)
Re:
yea, that's why I said "remotely resembles"

Take a look at the script and you'll see what I mean.
dcm_wong
May. 23rd, 2002 12:01 pm (UTC)
Re:
i was just teasing with my previous posts... :P

can't "tar gz" in windoze to read the script... my linux partition has been collecting dust since I redid the machine some months ago. plus I need a faster connection to get the newer versions (running redhat 7.0 now)

before reading it I thought the "j" would stand for java.

perhaps I should start writing my own client too... may be not.

thanks for letting me waste your time :)
qmrq
Sep. 8th, 2004 12:22 pm (UTC)
Re:
A pretty girl who uses vi. *swoons* *dies*
( 9 comments — Leave a comment )

Profile

eLouai
bride
The Bride of the First House

Latest Month

March 2015
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031