473,516 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with code conversion from php to perl

1 New Member
i am trying to convert a code of php to perl


in php we use $_cookie[cookiename] to retrieve cookie value


i have to do the same in perl


i have got the cookie some how , but i dont know how to access its value , i tried 3 days banging my head but in vain


second i want to open a URL with the socket im using this code


sub plFetchAlertValue($)
{

my ($userId) = @_;

use IO::Socket;




my $query = "http://dev.iventster.com/pl/publisherCmd.php?cmd=hasAlert&userId=$userId";

my @url = split(/.com/, $query);

my $host="$url[0].com";

my $path=$url[1];

my $timeout = 5;






my $sock = new IO::Socket::INET (LocalHost =>$host,LocalPort =>80,Proto => 'TCP',Timeout =>$timeout);

die "couldnt connect $!" unless $sock;



but it give the message

(couldnt connect Address already in use) i tried the ip address in $host as 192.168.1.100 and 127.0.0.1 too ,but the same result


would some one guide me to this prblms
Jan 18 '07 #1
2 1460
KevinADC
4,059 Recognized Expert Specialist
as far as the cookie goes:

http://perldoc.perl.org/CGI/Cookie.html

or if you are already doing some CGI stuff you may want to use the CGI module to do all the CGI stuff:

http://perldoc.perl.org/CGI.html
Jan 18 '07 #2
KevinADC
4,059 Recognized Expert Specialist
as for the rest your question, all I can suggest is you read the corresponding documentation for the module(s):

http://perldoc.perl.org/index-modules-I.html

but it does look like you have loaded the IO::Socket module but try and create a new object of the IO::Socket::INET class. But read the docs, I have little experience with those modules.
Jan 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
18313
by: Spamtrap | last post by:
I only work in Perl occasionaly, and have been searching for a solution for a conversion, and everything I found seems much too complex. All I need to do is take a simple text file and copy it, however some specific lines are in fact in UTF8 as printed garbagy characters and they need to be converted to Unicode, so that the new text file...
16
637
by: ^_^ | last post by:
conversion from: a="a"; to a=0x????; If there are many unicode strings to convert, how can I do batch-conversion?
3
1326
by: Tim Chase | last post by:
Are there existing "quiet" conversion functions? Kin of int() and float()? My aim would be to call a function that would guarntee that the result was of the defined type, choosing sensible defaults if needed. Example problems include: int("3.14") int(None) int(__builtins__)
3
3823
by: Andrew Robert | last post by:
Hey everyone, Maybe you can see something I don't. I need to convert a working piece of perl code to python. The perl code is: sub ParseTrig {
7
3249
by: dtecmeister | last post by:
Looking to see how many people could use this kind of tool. I've got several large databases I've developed in Access with MySQL as the back-end. I've started using Linux instead of windows and the only thing I can't migrate is my Access databases. I'm looking to export them in a standard file format, then provide convert functionality...
8
3770
by: anupam79 | last post by:
Hi guys, Can anyone help me convert a csv file into the above format i am looking out for a line by line conversion with the help of perl scripting. With Regards, Anupam
9
4835
by: humaid | last post by:
hi guys,i have this problem.first let me show you the so far code #!/user/bin/perl while ($a = <STDIN>) { if ($a =~ tr/A-Z/a-z/) { print "$a\n"; }
4
1666
by: ashashi87 | last post by:
I'm extremely new to perl. I decided to pick it up recently and was writing some elementary code just to get the hang of things. In doing so I've come across a stumbling block for which I couldn't find a solution on google. I am working on a program to convert a string to its binary representation. I'm picking an inefficient way to do this...
3
4156
by: andrewkl | last post by:
hi, I have the following Perl code that inserts a string to an Oracle DB via a stored procedure: #!/usr/local/bin/perl ## Perl v5.8.6 built for sun4-solaris use strict; BEGIN { $ENV{'TNS_ADMIN'} = '/auto/engweb/oracle/sqlnet'; $ENV{'ORACLE_HOME'} = '/usr/packages/dbdoracle/9.2.0'; }
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.