Skip to main content

Posts

Showing posts with the label perl

building SOAP object in perl to call a web service

Follows an example perl script snippet structure to build SOAP object to call a web service Use the required library use SOAP::Lite +trace => 'debug'; Define the SOAP object my $soap = SOAP::Lite                    -> uri('http://localhost:1325/WSImpl/')                    -> on_action( sub { return '"http://www.example.com/ws/MaterialService:updateMaterialIn"' } )                    -> proxy('http://localhost:1325/WSImpl/MaterialService.asmx')                    -> on_fault(sub { my($soap, $res) = @_;              die ref $res ? $res->faultdetail : $soap->transport-...

Perl: Read Text Files and Filter Data

Perl is the language for text manipulation. Its designed in a way, to handle the data in whatever the format, and process out the data into the desired format. Lets see some text processing examples from an external text file. Step One: Open a text file for reading,  #!/usr/bin/perl  open (FILE, 'data.txt');  while ( ) {    chomp;    print $_;  }  close (FILE);  exit;

Display the list of installed packages on perl

Lets say that you are using the external vendor's hosted environment or somehow you don't know the inner things on your perl installations. how do you check the installed packages on the server using perl script? I came through the same scenario when i intended to use CGI::Cookie Package. I was unable to check the package availability. then found the following script on web after some search and filter. when applied on my site, I got the full list of installed packages use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) { my $version = $instmod->version($module) || "Version Not Found"; print "$module — $version "; } This piece of code returns the list of packages and their versions on the system.

perl : viewing pdf file out of web folder

How to view a pdf file on your web page? If the pdf file parked in a web folder like /cgi-bin/files/example.pdf, you can easily show it in a page using the following code <embed src="/cgi-bin/files/example.pdf#toolbar=0&navpanes=1&scrollbar=0" width="100%" height="500"> so the page will show the pdf file embedded on the web page like the following but lets say that, the pdf file is not accessible on web page, that means its parked out of web directory for the sake of security. then how to get the file viewed on the web page? I did the following thing to achieve showing the pdf file out of web directory for testing. created a tempfile handler within web directory use File::Temp qw/ tempfile /; use File::Copy; use File::Basename; my($fh, $fname) = tempfile('TEMP_XXXX', SUFFIX => '.pdf', DIR =>'d:/Inetpub/cgi-bin/temp/'); copied the file to the temp file copy("d:/files/example.pdf","$fname") or d...