Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Perl RE question
Terence
Hi all,
Now I have the code:
my $flat_file = $ENV{'PATH_INFO'};
if ($flat_file =~ m!^.*/([^/]+)$!) {
$flat_file = $1;
}
I would like to as a few questions.
First, does $ENV{'PATH_INFO'} is a build-in function of TeamSite? What content will store in $flat_file ????
Second, What's the meaning of the Regular expression???What the pattern does the regular expression looking for????
Thank you very much.
Find more posts tagged with
Comments
Terence
Also I would like to ask,
what the meaning of
"->"
my $cgi = TeamSite::CGI_lite->new();
$cgi->parse_data();
and what is new()??? Is it a build-in function?
Since I cannot found out there is a subroutine called new() in the program.
Thank you very much.
kaalraa
I strongly recommend to read on the Learning Perl in 21 days. Also for more information on Interwoven you need to join the educational series by Interwoven itself.
- ak's
jbonifaci
Terence,
Q: First, does $ENV{'PATH_INFO'} is a build-in function of TeamSite?
A: Why don't you do a little research and find out what this is? Open a perl book or simply do a search on google.
Q: What content will store in $flat_file ????
A: Why don't you try printing it out and see?
Q: Second, What's the meaning of the Regular expression???What the pattern does the regular expression looking for????
A: Why don't you open a perl and/or regex book and read what each of the symbols mean? There are also many regex tutorials on the web for free. Google is your friend.
Q: what the meaning of "->"
A: Once again, open a perl book and/or use google.
Q: my $cgi = TeamSite::CGI_lite->new();
what is new()???
A: I'll be a little more helpful here. perldoc TeamSite::CGI_lite.
~Jeff
nipper
my $flat_file = $ENV{'PATH_INFO'};
open (LOG, "/tmp/temp.txt") || die ("cannot open /tmp/temp.txt");
print LOG "PATH is $flat_file \n";
if ($flat_file =~ m!^.*/([^/]+)$!) {
$flat_file = $1;
print LOG "now PATH is $flat_file \n";
}
I will be slightly more helpful than Jeff, esp if this is a CGI (from your other post I think it is). So regular print
statements won't help.
Assuming Unix. should create a file /tmp/temp.txt
jbonifaci
I'm fairly certain I know exactly which file it is. It is the visual format callout cgi. But the questions being asked are obviously being asked because the poster knows nothing about perl. They are simple questions that could be answered very easily with a little research on the users part. Now, if the question were just about the regex, I would probably have answered, as regex's are difficult to understand for some people. But with all of the other questions added in, I don't want to teach perl.
~Jeff
gzevin
why are you so certain that this was visual format callout cgi?
could be anything.. IMO, it's not a 'visual format', but rather some templating callout CGI example...
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
jbonifaci
Only because I've seen the exact same code in the cgi-callout version of visual formatter at a few clients. And anyone would be crazy to copy code from that script to another
. The reason I remember those lines of code is because they are/were so ugly,
.
~Jeff
gzevin
I think they come from the IWOV example of a cgi callout
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
jbonifaci
Haha, well, that explains it. I always write my stuff from scratch and I definitely don't use examples like that,
. The first thing I did when I saw the clients visual format callout like that, was rewrite it,
.
~Jeff
gzevin
well, I don't.. I do *recycle*...
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
jbonifaci
Well, you obviously don't recycle smilies, in your last three posts you went from
to
to
...
To be honest, I do recycle some code, but only if I wrote it. Normally when you go to a client, there isn't much worth recycling, if anything.
~Jeff
gzevin
When I go to the client, I do recycle my previous code library.. which is huge by now...
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Terence
Thank you all of your help.
And I'm sorry that since it is my first time to learn Perl.
So my PC havn't setup the environment yet for me to run Perl programme.
Thank you very much.
jbonifaci
Well, I'd just like to point out one thing based on your last post. The majority, if not all, of your development work for TeamSite should be happening on the TeamSite server, not on your PC. Meaning, you should be running/testing your scripts on the TeamSite server, not on your PC. TeamSite ships with a special version of perl called iwperl, along with many custom modules. There will also be many things your scripts may have to interact with that they do not have access to from your PC. Therefore, you should be requesting access to do development work on the TeamSite server, not on your own PC.
Now, if your goal is to just learn perl, with nothing specific to TeamSite, then you can go ahead and do this on your PC. But if you want to learn perl as it specifically pertains to TeamSite, more than likely you won't be able to accomplish this on your PC.
~Jeff
Terence
To Jeff,
Thank your for your advice.
Actually, what I need to do is write perl program in TeamSite 6.5.
mainly for data capture section and workflow process.
And I will ask for the permission to access TeamSite server asap.
Thank you for your help.