CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
I don't get frm test file, what I really expect. What is wrong?

 



digioleg54
User

Apr 25, 2017, 12:53 PM

Post #1 of 3 (641 views)
I don't get frm test file, what I really expect. What is wrong? Can't Post

I have the following code for CGI

Code
#!/usr/bin/dwebenv perl 

#use lib "/vhosts/dw18637/lib/web/";
use strict;
use warnings;
use DBI;
use DBD::Oracle;
use Spreadsheet::ParseExcel;
use File::Basename;
#use ReportTypes::RptReq qw(fru_process_failrpt fru_run_report);
#use ReportTypes::SD qw(sd_flds_all);
my($lib_path,$data_path);
BEGIN{
$lib_path=$ENV{'DWEB_SITE_PATH'};
$data_path=$ENV{'DWEB_SITE_CGI_DATADIR'};
}
use lib $lib_path.'/lib/web';

print "Content-type: text/html\n\n";


my $fullpath=$lib_path."/cgi-bin/test.pl";
my ($filename, $dirs, $suffix) = fileparse($fullpath);
print "$filename $dirs $suffix\n";

When I run it get the following print

Code
test.pl /vhosts/dw18637/cgi-bin/

which is correct, but what I expect is the suffix, which don't receive.
and I want to get name as

Code
test


Is the any problem is the code?

Thanks


FishMonger
Veteran / Moderator

Apr 25, 2017, 1:25 PM

Post #2 of 3 (636 views)
Re: [digioleg54] I don't get frm test file, what I really expect. What is wrong? [In reply to] Can't Post

You need to specify the suffix in the fileparse() function to split it off of the filename.

Code
my ($filename, $dirs, $suffix) = fileparse($fullpath, qr/\.[^.]*/);



digioleg54
User

Apr 25, 2017, 1:27 PM

Post #3 of 3 (633 views)
Re: [FishMonger] I don't get frm test file, what I really expect. What is wrong? [In reply to] Can't Post

perfect.
Thanks so much

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives