The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Other
> Development Articles
|
Perl 101 (part 8) - Putting It To The Test
Discuss Perl 101 (part 8) - Putting It To The Test in the Development Articles forum on Dev Shed. Perl 101 (part 8) - Putting It To The Test Development Articles forum discussing articles and tutorials located at http://www.devshed.com. See what our authors have created for your viewing pleasure.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 4th, 2000, 07:15 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
What about Attachments!
I am running around the net like a Carl Lewis, trying to find an easy perl sciprt to allow a file to be emailed. How do you do THAT!
K
|

October 6th, 2000, 12:51 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: What about Attachments!
http://www.stonehenge.com/merlyn/WebTechniques/col46.html
maybe?
|

October 6th, 2000, 01:47 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Counter
Opening a file is a high overhead operation (in processing time.) Much more efficient to open in read write mode:
<CODE>
open(FH,"+<$FileName);
$Counter = <FH>;
chomp($Counter);
$Counter++;
seek(FH,0,0);
truncate(FH,0);
print FH "$Count\n";
close (FH);
</CODE>
Also, on an active site, you want lock the file or else there is a chance someone else could accidently reset the counter to zero.
|

October 8th, 2000, 04:05 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
or die()
It is always good practice to add a die() statment when opening a file.
An example:
<!-- Code -->
<p><pre><font color=#008000><xmp>
open(IN,$file) or die "Cannot open $file: $!";
</xmp></font></pre><p>
<!-- Code -->
$! contains the reason why the file wasn't opened.
|

October 9th, 2000, 04:08 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: What about Attachments!
Thanks
I'll look into it
|

October 15th, 2000, 10:22 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
How?
Hello.
I am really new to PERL and want to know where to put all of the code. What I mean is where do I paste the CGI bit and the HTML bit etc...
Also after I have cut & pasted the code into my HTML doc, do I have to type any more code or variables into it?
Thanks for your help.
Clueless.
|

October 15th, 2000, 10:26 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
How?
Hello.
I am really new to PERL and want to know where to put all of the code. What I mean is where do I paste the CGI bit and the HTML bit etc... (in what order).
Also after I have cut & pasted the code into my HTML doc, do I have to type any more code or variables into it?
Thanks for your help.
Clueless.
|

November 2nd, 2000, 03:45 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: or die()
Its happening man.
|

April 6th, 2001, 11:48 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Garbage Characters
I was able to get this program up and running w/o any problems, but any punctuation left in the comments field is converted into ASCII. Any way around this?
|

August 2nd, 2001, 04:09 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Counter
This has been a very enjoyable series. I haven't written this much code in years!
How is locking done? That indeed is important. I had to abandon my old counter because it would reset often -- that was why.
|

August 6th, 2001, 07:06 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Counter
<CODE>
open(FILE,"+<$FileName");
flock(FILE,2);
open read update and write back
flock(FILE,8)
</CODE>
one caveat, only works on Unix systems.
Urb
|

September 24th, 2001, 01:43 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Field checking
How do you set it up so it checks to make sure all the fields were entered and have valid information?
|

January 28th, 2002, 06:21 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|

February 1st, 2002, 02:33 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Confused!
hey!
Well the tutorial was good and i must say very informative. I have C/C++ knoledge and I am working a s an intern for a firm. IT needed me to read Perl tutorial which i did and it wwas very informative.
The only thing which is baffling me or i am still confused is about what is CGI script and whats the use of it with webpages where should we have these things. I mean all was going well till this CGI script and all. I don't get whole of it.
Thankx
Jawad.
|

February 22nd, 2002, 03:51 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|