Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 4th, 2000, 07:15 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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

Reply With Quote
  #2  
Old October 6th, 2000, 12:51 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: What about Attachments!

http://www.stonehenge.com/merlyn/WebTechniques/col46.html
maybe?

Reply With Quote
  #3  
Old October 6th, 2000, 01:47 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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.

Reply With Quote
  #4  
Old October 8th, 2000, 04:05 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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.

Reply With Quote
  #5  
Old October 9th, 2000, 04:08 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: What about Attachments!

Thanks

I'll look into it

Reply With Quote
  #6  
Old October 15th, 2000, 10:22 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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.

Reply With Quote
  #7  
Old October 15th, 2000, 10:26 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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.

Reply With Quote
  #8  
Old November 2nd, 2000, 03:45 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: or die()

Its happening man.

Reply With Quote
  #9  
Old April 6th, 2001, 11:48 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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?

Reply With Quote
  #10  
Old August 2nd, 2001, 04:09 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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.

Reply With Quote
  #11  
Old August 6th, 2001, 07:06 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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

Reply With Quote
  #12  
Old September 24th, 2001, 01:43 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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?

Reply With Quote
  #13  
Old January 28th, 2002, 06:21 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Reply With Quote
  #14  
Old February 1st, 2002, 02:33 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
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.

Reply With Quote
  #15  
Old February 22nd, 2002, 03:51 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > Perl 101 (part 8) - Putting It To The Test

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap