Perl issue posting to HTTP (SOLVED)

Booting, installing, newbie
Message
Author
AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

Perl issue posting to HTTP (SOLVED)

#1 Post by AdrianH »

Question on using perl within puppy, I have used a perl script provided by a sms gateway proiver, but have no success in accessing the sms gateway.

They say my request is never arriving and to check my server/router etc.

The PC can browse to the location or around the net fine, so from that I am assuming I do not have any router issues

I get no compile or other errors when the script is run, just HTTP error returned on the command line.

Do I have to set permissions for perl to allow it to access HTTP, I am running from console as root?

The basic perl script is here:

Code: Select all

#!/usr/bin/perl -T             

use strict;                                                                                                                                                                
use LWP::UserAgent;
use HTTP::Request::Common;

# Txtlocal login details 
my $uname = 'adrian@something.com'; 
my $pword = 'aapsswordl';  
 
# Configuration details  
my $test = "0"; # Set to 1 for testing   
my $info = "0"; # Flag to switch on/off debug information. 
 
# Data for text message
my $from = "Home Alarm"; 
my $selectednums = "44123456789";
    # A comma separated list of mobile numbers 
    # with international dialling codes.
    # Each number must be PURELY numeric.
my $message = "This is a test message, no panic just let me know you recieved it. Adrian"; # Text message content 
my $ua = LWP::UserAgent->new();  

my $res = $ua->request 
(   
 POST 'http://www.txtlocal.com/sendsmspost.php',
 Content_Type  => 'application/x-www-form-urlencoded', 
 Content       => [ 'from'       => $from,
                    'uname'    => $uname,
                    'pword'    => $pword, 
                    'info'      => $info,
                    'test'      => $test,
                    'selectednums'=> $selectednums,
                    'message'    => $message
                  ] 
); 
 
if ($res->is_error) { die "HTTP Error\n"; }
print "Response:\n\n" . $res->content . "\n\n"; 

All I get in response is HTTP Error, but no explanation, the tech person at the gateway says it is never arriving and has run the script locally and it works.

So all is pointing at the PC, trying to think of a way to capture what it is sending but again stuck on that. wondering if I could sort of redirect output to a file?

I will admit to having to install manually perl URI, perl HTTP and another as they were not listed in the package manager.

Cheers

Adrian

Edited due to being crap post
Last edited by AdrianH on Wed 06 Nov 2013, 22:17, edited 1 time in total.

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#2 Post by AdrianH »

I have experimented by copying the perl script over to my Suse box and placing in my home directory
/home/adrian/psms1 runs the script and I get a message back from the sms gateway and my phone gets a text message.

So the problem is definitely with my puppy box.

My manual install of missing perl modules must be wrong or it is possibly a permissions problem.Stuck on the first problem as many of the perl modules I could not locate with the install manager.

Adrian

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#3 Post by mikeb »

perl on puppy is extremely cut down... probably best to start from scratch with say a package from ubuntu, debian or slackware and forget what puppy has.

mike

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#4 Post by 01micko »

mikeb is right about the default perl installation, there is only enough there to get pplog and cups working. There is more however on the devx. Load that up and see if it solves your issue but failing that follow mikeb's advice and install perl from the slackware repo.
Puppy Linux Blog - contact me for access

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#5 Post by AdrianH »

:cry:

Hi Mike and 01micko

I manually installed perl URI, LWP, Time and possibly HTTP directores by copying across from the Suse box to puppy directories last night well into the early hours. None of that lot is recognised by the check dependences program

I think the HTML directory was the only one I could get from puppy package manager even when searching all repositories.

So stuck on how to go any further, should I be installing another repository deleting all perl and starting again?

I have approx 39 Meg free space left

Adrian

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#6 Post by 01micko »

Hmmm.. the Suse idea may not have been a good one as there would likely be version differences. Perl is fussy in my experience.

You will have to clean up your save file, or if you have a back up restore that. Install the full perl-5.16.1-i486-1.txz from your local mirror, probably slackware.org.uk would do (http://slackware.org.uk/slackware/slack ... ackware/d/). It has URI, LWP, Time, HTTP and everything else included. The package is ~14M compressed, and as perl is scripted that will expand quite a bit, so I would make sure there is around 100M free space in the save file.

Good luck!
Puppy Linux Blog - contact me for access

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#7 Post by AdrianH »

Hmmm, not finding my slackosave file, I believe it saves back to the flashdish so anything just takes up space, max space left on drive is 47 meg, so not a good thing, the pc has a max of 256 Meg flash disk on module and 512 Meg ram.

Will have to look at a cut down install to remove things like write, draw paint etc.

Or get a bigger module

Adrian

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#8 Post by mikeb »

Perhaps some space friendly way of converting the package to an sfs might be a way around this.... ie extract to a hard drive and make the sfs from there....you would end up with a file the size of the txz and no save space needed.

I assume the company only offer a perl script...perl is nice its just a tad awkard on puppy.

mike

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#9 Post by AdrianH »

There are
PHP
ASP
C#
VB .Net
VBA
Java
Python
Perl
Ruby
Delphi

API's

Perl was the first I looked at because, I had perl installed as default, just checking package manager and python is also installed, I will see what issues I have with running that.

I appreciate that puppy is a very light distro, that is why I am able to use it on such a low power device, just did not know It would cause me so many problems when trying to do something different.

I will get there.

Cheers

Adrian

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#10 Post by 01micko »

Ha.. python will suffer the same, it is too cut down and mostly on the devx.

Here is a perl sfs, load it and try it http://www.01micko.com/packages/perl-5. ... extras.sfs ~16M file size

checksum

The perl sfs includes:

Code: Select all

libwww-perl-6.05-i486-1_SBo.tgz
Net-SSLeay-1.55-i486-1_SBo.tgz
perl-5.16.1-i486-1.txz
perl-encode-locale-1.03-i486-1_SBo.tgz
perl-file-listing-6.04-i486-1_SBo.tgz
perl-html-parser-3.71-i486-1_SBo.tgz
perl-html-tagset-3.20-i486-1_SBo.tgz
perl-http-cookies-6.01-i486-1_SBo.tgz
perl-http-daemon-6.01-i486-1_SBo.tgz
perl-http-date-6.02-i486-1_SBo.tgz
perl-http-message-6.06-i486-1_SBo.tgz
perl-http-negotiate-6.01-i486-1_SBo.tgz
perl-IO-HTML-0.04-i486-1_SBo.tgz
perl-IO-Socket-SSL-1.76-i486-1_SBo.tgz
perl-lwp-mediatypes-6.02-i486-1_SBo.tgz
perl-LWP-Protocol-https-6.03-i486-1_SBo.tgz
perl-Mozilla-CA-20130114-i486-1_SBo.tgz
perl-net-http-6.06-i486-1_SBo.tgz
perl-Net-LibIDN-0.12-i486-1_SBo.tgz
perl-www-robotrules-6.02-i486-1_SBo.tgz
EDIT: out of your list only perl or python would be light enough, some of the others (eg VB) are windows only, java, php and such would just be too much headache (as if perl isn't enough :) )
Puppy Linux Blog - contact me for access

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#11 Post by AdrianH »

Yep although the package manager says python is installed it is only a few libaries and I would need 76 Megs to install so no go

I have to ask the question as I am so dum on this, but what do I do with the file, please.
how do I use it without expanding to full size if a type of zip and can I use without X?

Perhaps it helps if you know what I like to do in spare time.
http://www.tamarisktechnicals.com/pages/roadster.html

Adrian

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#12 Post by 01micko »

If you have 17M spare on your stick download the file out side of your save file.

If your save file takes up the entire stick then download it to "/".

No need to unpack it, it is a "module" that can be loaded.

Outside of X you must run :

Code: Select all

sfs_load /path/to/perl-5.16.1-i486-plus_extras.sfs
..where "/path/to" will be
A) "/intrd/mnt/dev_save/" (or you can try "/mnt/home" which is a symlink) if you saved outside the save file or
B) "/" if your install takes the entire partition.

Sorry I'm not sure if that will be persistent across reboots, you'll soon find out. If it's not just add that line to your /etc/rc.d/rc.local file.

----------

Shame tasmod isn't around (forum member, Rob Lane, you may know him) as he built cars too.
Puppy Linux Blog - contact me for access

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#13 Post by AdrianH »

I am just going for a usb bootflash custom install that should give me another 20 meg, (fingers crossed) free space.

I will then install this on the internal PC flash using the universal installer.

I should have space to install your sfs file in /

So if I read your message correctly, stick the following line in rc.local

sfs_load /perl-5.16.1-i486-plus_extras.sfs



The computer has no usb sticks fitted normally.

i will be giving it a try with in the next 30 mins then heading for sleep.

Thanks for your assistance

Adrian

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#14 Post by 01micko »

AdrianH wrote:I am just going for a usb bootflash custom install that should give me another 20 meg, (fingers crossed) free space.
Not sure what you mean there, and how does that give you more space?
AdrianH wrote:I will then install this on the internal PC flash using the universal installer.
So... you intend to boot off usb and then install to internal flash? How big is the internal flash?
AdrianH wrote:I should have space to install your sfs file in /
Be aware this only works if the save file takes up the entire partition (as mentioned in the save file dialog at first shutdown). If you have a fixed size save file that almost takes the entire partition then that isn't the same. You can check with these commands:

Code: Select all

. /etc/rc.d/PUPSTATE
echo $PUPMODE
If it's 7 you can save to "/", if it's 13 then it must go out side the savefile, the root of the media usually.
AdrianH wrote:So if I read your message correctly, stick the following line in rc.local

sfs_load /perl-5.16.1-i486-plus_extras.sfs
Yes depending upon the above test.


AdrianH wrote:The computer has no usb sticks fitted normally.

i will be giving it a try with in the next 30 mins then heading for sleep.

Thanks for your assistance

Adrian
Again, good luck!
Puppy Linux Blog - contact me for access

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#15 Post by AdrianH »

01micko wrote: Not sure what you mean there, and how does that give you more space?
I have made a custom iso, without a lot of packages, such as the office type applications games etc. The sfs file seems to be smaller on the iso.
I have to install a bootable system on to a usb stick from that ISO then run up the pc with that, then install into internal flash. The thin client PC has no cd drive etc just usb portsl

01micko wrote: So... you intend to boot off usb and then install to internal flash? How big is the internal flash?

The internal flash is a mere 256 meg

01micko wrote: Be aware this only works if the save file takes up the entire partition (as mentioned in the save file dialog at first shutdown). If you have a fixed size save file that almost takes the entire partition then that isn't the same. You can check with these commands:

Code: Select all

. /etc/rc.d/PUPSTATE
echo $PUPMODE
If it's 7 you can save to "/", if it's 13 then it must go out side the savefile, the root of the media usually..
When I finish the install, the internal flash is sda1 and it save any settings back to sda1 internal ide flash drive, but will check as you say before I save the sfs file

01micko wrote:Again, good luck!
Thanks again for all the assistance

Adrian

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#16 Post by mikeb »

Tis fun
Outside of X you must run :
Code:
sfs_load /path/to/perl-5.16.1-i486-plus_extras.sfs
really ..it won't run in X ?!

Python on puppy is interesting too...I have a 7MB sfs of 2.7 if you still stuck. (version 3 scripts might not work on it..they made life awkward.
Can't help with perl...I just run slax for that.

mike

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#17 Post by 01micko »

mikeb wrote:Tis fun
Outside of X you must run :
Code:
sfs_load /path/to/perl-5.16.1-i486-plus_extras.sfs
really ..it won't run in X ?!
Twist on words Mike? :)

-

AdrianH, a thought did occur to me that you could try ThinSlacko, you wont sacrifice anything in updates (they're mostly all X dependent) and it has the same ssh functionality as 5.6, in a 123M iso image. Just depends if the later kernel likes your hardware.

You could even do a manual remaster and add the perl sfs I posted.
Puppy Linux Blog - contact me for access

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#18 Post by mikeb »

No twists...are you saying load...
ah ok got it.....

When outside of x you run.........

I have no brain at times.. yesterday I read sda4 as ext4....

I compile and hack at the other end of the day :D

mike

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#19 Post by 01micko »

I have no brain at times.. yesterday I read sda4 as ext4....
Yep, know the feeling :)
Puppy Linux Blog - contact me for access

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#20 Post by AdrianH »

mico

I have tried a couple of installs with later kernals and they do not install.

My processor does not support PAE, so all installs or the backward compatible ones.

I will press on after food in a little while.

Adrian

Post Reply