perl

Making SOAP call using Perl's SOAP::Lite and a WSDL file

I want to make a SOAP call to a local web service. The web service is defined via a WSDL file (see below). I want to use Perl and SOAP::Lite. I tried this: use strict ; use warnings ; use SOAP::Lite ; my $endpoint = qq{http://example.com:2222/orawsv/PS_API/ACCOUNT_WS} ; my $tns = 'http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS' ; ...

.NET equivalent to Perl regular expressions

I need to convert a Perl script to VB.NET. I have managed almost the entire conversion, but some Perl (seemingly simple) regex are causing an headache. Can someone suggest me .NET equivalent of the following perl regex: 1) $letter =~ s/Users //,; $letter =~ s/Mailboxes //,; if($letter =~ m/$first_char/i){ 2) unless($storegroup =~ /...

How can I extract the desired nodes from this XML file using Perl and XPath?

After executing a XPath expression for extracting all year and value elements associated with death rates from a XML DB file, I want to take each node from the node list and find the year node, print that, find the value node, and print that all separately. The problem is that the output does not show anything. The XML content looks li...

From interpeted to native code: "dynamic" languages compiler support

First, I am aware that dynamic languages is a term used mainly by a vendor; I am using it just to have a container word to include languages like Perl (a favorite of mine), Python, Tcl, Ruby, PHP and so on. They are interpreted but I am interested here to refer to languages featuring strong capability to support the programmer efficiency...

Why isn't DBIx::Class::Schema::Loader creating my classes?

I am trying to generate static schemas using DBIx::Class in Perl. The command shown below outputs a Schema.pm and no other files. Any idea what I'm doing wrong, or how to to debug this? U:\wohlfarj\Software\PARS>perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:.\lib -e "make_schema_at('PARS::Schema',{debug=>1},['dbi:ODBC:P...

mechanize for Java

Hi, I was wondering if there is something like Perl's/Python's mechanize for Java. Thanks! ...

How can I limit Perl's split function?

I have trying this: $string ="Group: ALL:ALL:Good"; @str2 = split (/:/,':',2); print "@str2"; I am looking in $str[0] = Group and $str[1]= ALL:ALL:Good. It not working. What would be issue? ...

How can I extract just the elements I want from a Perl array?

Hey I'm wondering how I can get this code to work. Basically I want to keep the lines of $filename as long as they contain the $user in the path: open STDERR, ">/dev/null"; $filename=`find -H /home | grep $file`; @filenames = split(/\n/, $filename); for $i (@filenames) { if ($i =~ m/$user/) { ...

Why do all of these methods of accessing an array work?

It seems to me that some of these should fail, but they all output what they are supposed to: $, = "\n"; %test = ( "one" => ["one_0", "one_1"], "two" => ["two_0", "two_1"] ); print @{$test{"one"}}[0], @{$test{"one"}}->[0], $test{"two"}->[0], $test{"one"}[1]; Why is this? ...

What are the best practices for error handling in Perl?

I'm learning Perl, and in a lot of the examples I see errors are handled like this open FILE, "file.txt" or die $!; Is die in the middle of a script really the best way to deal with an error? ...

Does JavaScript have an equivalent to Perl's DESTROY method?

Is there any method that is called or event that is dispatched right before an Element is cleaned up by the JavaScript garbage collector? In Perl I would write: package MyObj; sub new {bless {}} sub DESTROY {print "cleaning up @_\n"} and then later: { my $obj = MyObj->new; # do something with obj } # scope ends, and ass...

Why is Perl's IO::Socket::SSL->new() failing?

When I execute this line: $client = IO::Socket::SSL->new("pilot-payflopro.paypal.com:443"); my IO::Socket::SSL::errstr() is configuration error failederror:00000000:lib(0):func(0):reason(0) my $! is 'invalid argument' Has anyone run into this before? ...

How can I write output to a new external file with Perl?

Maybe I am searching with the wrong keywords or this is a very basic question but I cannot find the answer to my question. I am having trouble writing the result of my whois command to a new external file. My code is below. It takes $readfilename, which is a file name which has a list of IPs, and $writefilename, which is the destination...

How can I send multiple images in a server push Perl CGI program?

I am a beginner in Perl CGI etc. I was experimenting with server-push concept with a piece of Perl code. It is supposed to send a jpeg image to the client every three seconds. Unfortunately nothing seems to work. Can somebody help identify the problem? Here is the code: use strict; # turn off io buffering $|=1; print "Content-type: mu...

Is it possible for a Perl subroutine to force its caller to return?

If I have Perl module like package X; and an object like my $x = X->new (); Inside X.pm, I write an error handler for $x called handle_error, and I call it sub check_size { if ($x->{size} > 1000) { $x->handle_error (); return; } } Is there any way to make handle_error force the return from its c...

Why doesn't Perl's Try::Tiny's try/catch give me the same results as eval?

Why doesn't the subroutine with try/catch give me the same results as the eval-version does? #!/usr/bin/env perl use warnings; use strict; use 5.012; use Try::Tiny; sub shell_command_1 { my $command = shift; my $timeout_alarm = shift; my @array; eval { local $SIG{ALRM} = sub { die "timeout '$command'\n" }; ...

What is an alternative for split in Perl?

My file contains a: b d: e f: a:b:c g: a b c d f:g:h h: d d:dd:d J: g,j How can I parse this file into lefthand side values into one array and right hand side to another array? I tried with split, but I am not able to get it back. I want to store them into hash. ...

Why does my Perl CGI script cause a 500 internal server error?

I get a 500 internal server error when I try to run the code below in a web server which supports perl: #! /usr/bin/perl use LWP; my $ua = LWP::UserAgent->new; $ua->agent("TestApp/0.1 "); $ua->env_proxy(); my $req = HTTP::Request->new(POST => 'http://www.google.com/loc/json'); $req->content_type('application/jsonrequest'); $req->con...

Is there any use for Bash scripting anymore?

I just finished my second year as a university CS student, so my "real-world" knowledge is lacking. I learned Java my first year, continued with Java and picked up C and simple Bash scripting my second. This summer I'm trying to learn Perl (God help me). I've dabbled with Python a bit in the past. My question is, now that we have ve...

How can I make Perl and Python print each line of the program being executed?

I know that "bash -x script.sh" will execute script printing each line before actual execution. How to make perl and python interpreters do the same? ...