Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Closed Thread
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 September 24th, 2005, 02:23 AM
Duminas Duminas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 44 Duminas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 48 m
Reputation Power: 9
Redirection after other output

The effect I am trying to achieve is something similar to the following. Print a header (HTML header, like doctype, title, and other constants), and then print a form. If the person fails at entering the proper data into said form, redirect them somewhere. If they do right, redirect them somewhere else.

Now, before we continue, this redirection should not use a form action. I know that in PHP I could do something very easily with code like:
PHP Code:
function redirect($page){ header("Location: $page"); } 

And I could call this anywhere on the page, assuming I had output bufferring enabled.

Now, in Perl, I cannot find anything that can do this, at all. No modules, no functions--nothing.

I can very easily go:
perl Code:
Original - perl Code
  1. #!/usr/bin/perl -w
  2. print "Location: page_to_travel_to\n\n"; exit();
But as you can tell, compared to the PHP example which can work anywhere, this method, which can only work if there is absolutely nothing else output at all, is very very limited, and comparatively useless.

If this is impossible in Perl, that just doesn't make any sense at all to me; if anyone knows and this is the case, care to explain why, exactly?
Thanks for any help again, guys.

Yes, I searched. Couldn't find anything fully relevant.

Reply With Quote
  #2  
Old September 24th, 2005, 02:52 AM
Tedward Tedward is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Edmonton, Alberta, Canada
Posts: 55 Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 23 h 39 m 8 sec
Reputation Power: 7
Send a message via ICQ to Tedward Send a message via AIM to Tedward Send a message via MSN to Tedward Send a message via Yahoo to Tedward
I suppose I should also point out, &SwapBuffer; must be called before any output is sent, and &ResumeBuffer; can be called any time after MyRedirect();, either immediately after or just before the script exits. I'd imagine the sooner the better though, especially if the page is large, as the more information that gets sent to the custom buffer, the more information needs to be re-read and sent back to the original buffer.

perl Code:
Original - perl Code
  1. #!/usr/bin/perl
  2.  
  3.     #Swap the normal buffer to custom buffer
  4. &SwapBuffer;
  5.  
  6. print("Content-type: text/html\n\n");
  7. print "Text";
  8.  
  9.     #Put in Location: header.. can be changed something else
  10.     #as well, if you don't actually want a location header.
  11.     #You probably also want this in some sort of if statement,
  12.     #to make sure you really want to do it.
  13.     #Note: Overwrites any text already sent as needed.
  14. MyRedirect("http://www.google.ca");
  15.  
  16. print "More Text";
  17.  
  18.     #Swap back to normal buffer, and spit it all out
  19. &ResumeBuffer;
  20.  
  21. sub SwapBuffer{
  22.  $file=rand(9999999999999999999999999);
  23.  open(NEWSTDOUT, ">$file");
  24.  select(NEWSTDOUT);
  25. }
  26.  
  27. sub ResumeBuffer{
  28.  select(STDOUT);
  29.  close(NEWSTDOUT);
  30.  open(NEWSTDOUT, "$file");
  31.  while(<NEWSTDOUT>){ print; }
  32.  close(NEWSTDOUT);
  33.  unlink("$file");
  34. }
  35.  
  36. sub MyRedirect{
  37.  $url=$_[0];
  38.  seek(NEWSTDOUT, 0, 0);
  39.  print("Location: $url\n\n");
  40.  seek(NEWSTDOUT, 0, 2);
  41. }
Comments on this post
Duminas agrees: &lt;3 Ted for the win.

Reply With Quote
  #3  
Old September 24th, 2005, 08:38 AM
techcode's Avatar
techcode techcode is offline
Guru Meditation
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Amsterdam
Posts: 1,302 techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 2260 Folding Title: Novice Folder
Time spent in forums: 5 Days 34 m 49 sec
Reputation Power: 362
Send a message via Yahoo to techcode
@Duminas:

That's because you need to print a header (Content-type: text/html\n\n) from Perl script - so ussualy scripts that you can find everywhere do that as first thing Unless you do that Web server ussualy complains ...

Anyway, when you get to the point where you will use some templating (such as HTML::Template), some module for validating form input (such as Data::FormValidator) and maybe even some framework (such as CGI::Application) you will forget about those little things and conentrate on the problem itself.

@Tedward:

That is the craziest solution I have ever seen I mean ok - with Perl TMTOWTDI. But I would never even think of something like that. Somehow to me it's quite logical thinking :

1. Get form data
2. Validate it
3. If OK print header and whatever
3. If NOT OK print redirection header

Eitherway, both your and mine solutions are not how it's done in real world. Data::FormValidator gives you nice output to be combined with HTML::Template so you print out the same form, but add error messages next to fields that have errors.
Of course, you use something like HTML::FillInForm to "fill" the input back to the form before you return it back.

http://search.cpan.org/~purdy/Data-...tor/Tutorial.pm

Here is a snipet from a project that I'm working on. It's using CGI::Application framework.


perl Code:
Original - perl Code
  1. sub registration : Runmode {
  2.     my $self = shift;
  3.     my $form = $self->query_vars();
  4.    
  5.     ########### Validate form data against the profile ###########
  6.     require Data::FormValidator;
  7.     my $DFV = Data::FormValidator->new();
  8.     my $CHECK = $DFV->check($form, $self->registration_profile);
  9.    
  10.     return $self->registration_error( $CHECK->msgs() )
  11.     if ($CHECK->has_invalid() || $CHECK->has_missing());
  12.    
  13.    
  14.     ########### Check if there is a user with such email ###########
  15.    
  16.     my $res = $self->param('DB')->execute(
  17.               sql => 'SELECT * FROM customers WHERE email = ?',
  18.               method => 'fetchrow_hashref',
  19.               data => [$form->{email}]);
  20.    
  21.     return $self->registration_error({err_email => '<font color="red"><b>* User with that email already exists.<b></font>'})
  22.     if (defined $res->{id});
  23.    
  24.    
  25.     ########### No errors if we got this far save it ###########
  26.    
  27.     $form->{password} = $self->encrypt_password($form->{password});
  28.    
  29.     # Finaly add it ...
  30.     $self->param('DB')->insert(table  => 'customers',
  31.                          data   => $form);
  32.    
  33.     # Send the notification email
  34.     my $email = $self->load_tmpl('/Email/user_registred.txt');
  35.     $email->param($form);
  36.        
  37.     $self->email_send(subject   => 'New user registred.',
  38.                       text      => $email->output());
  39.    
  40.     return $self->registration_ok();   
  41. }
  42.  
  43. sub registration_ok {
  44.     my $self = shift;
  45.     my $form = $self->query_vars();
  46.    
  47.     ##### Set it's session params like he just loged in
  48.     $self->session->param('logged-in', 1);
  49.     $self->session->param('email', $form->{email});
  50.    
  51.     ##### Print out the page saying you are registred.
  52.     my $template = $self->load_tmpl('/Customer/registration_ok.dwt');
  53.     return $template->output();
  54. }
  55.  
  56. sub registration_error {
  57.     my ($self, $errors) = @_;
  58.     my $form = $self->query_vars();
  59.    
  60.     my $template = $self->load_tmpl('/Customer/registration_form.dwt');
  61.     $template->param(%{$errors});
  62.  
  63.     require HTML::Defaultify;
  64.     return HTML::Defaultify::defaultify($template->output(),
  65.                                         $form, 'registration');
  66. }
  67.  
  68. sub registration_profile {
  69.     return
  70.     ({
  71.        required     => [qw(email email2 password password2)],
  72.        
  73.        constraints  => {email   => 'email', email2  => 'email'},
  74.        
  75.        msgs => {prefix     => 'err_',
  76.                 missing    => 'Please enter this field. It is required.',
  77.                 invalid    => 'Please enter this field in right format'}
  78.     });
  79. }
__________________
www.booking.com is hiring Perl developers!
Work along some of the biggest names in Perl community. Live in Amsterdam - relocation assistance is provided (paperwork/visa and financial) for you and your family members - for details send me an message


Last edited by techcode : September 24th, 2005 at 08:42 AM.

Reply With Quote
  #4  
Old September 24th, 2005, 10:46 AM
fireartist fireartist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 131 fireartist User rank is Corporal (100 - 500 Reputation Level)fireartist User rank is Corporal (100 - 500 Reputation Level)fireartist User rank is Corporal (100 - 500 Reputation Level)fireartist User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 27 m 27 sec
Reputation Power: 8
Tedward's solution is horrible!
You generate a random filename and don't even check whether it already exists before stomping on it. You don't check whether the open() call succeeds.

This isn't a deficiency in perl, it's a bad design practice that php perpetuates.
The real error is that you're sending out a content-type header before you know whether you really should be. As techcode rightly suggests, check your input, then you can decide what type of header to send.

Reply With Quote
  #5  
Old September 24th, 2005, 02:28 PM
Tedward Tedward is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Edmonton, Alberta, Canada
Posts: 55 Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 23 h 39 m 8 sec
Reputation Power: 7
Send a message via ICQ to Tedward Send a message via AIM to Tedward Send a message via MSN to Tedward Send a message via Yahoo to Tedward
"You generate a random filename and don't even check whether it already exists before stomping on it. You don't check whether the open() call succeeds."

Considering the size of the random number, and considering the amount of time the file will be in existance, it's pretty safe to assume. You are right however, that you should check for that kind of thing. However, he didnt ask how to open files, he asked how to send a different type of header. I left it up to him to add any little checks he wants done.

"The real error is that you're sending out a content-type header before you know whether you really should be."

Say you're writing an addon to a forum. Say, you need to check to make sure the person is logged in before you can proceed to figure out what header to send. What if the only way to check to see if theyre logged in is to include the main forum files. What if those send output automatically? That's quite common, and you don't always have the option of killing it. In cases like that, you need to be able to modify what's already been sent. Quite simple, with my script. Just swap the buffer before calling the forum script, then call it, and figure out what needs to be done.

It may not be the best way to do things, but in some cases, it may be the only practical way.

ps. you forgot to complain that I didnt use -w and my()

Reply With Quote
  #6  
Old September 24th, 2005, 04:53 PM
Duminas Duminas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 44 Duminas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 48 m
Reputation Power: 9
@fireartist:
I'm really bad at math, but I know for certain that the chance of having a filename collision with 25 numbers generating the filename is minute; and as this is something I intend to use in a small capacity (about 1200 people plowing through it over the course of a couple hours), there is no real need for anything else.

Also, I used the form as an example. Sometimes I will not have a form to be checking. Should have clarified that prior, but don't be so quick to assume it'll be done one, and only one way.

"Bad design practice?" Care to explain that?

@techcode:
Thanks. I'll look into those modules (I'm trying to keep it as module-free as I can at this point, since it will run on various servers that might not have all these modules installed, or the capability to install them). And I already use HTML::Template--guess I better get used to the FormValidator~

Cheers.

Reply With Quote
  #7  
Old September 24th, 2005, 05:04 PM
Tedward Tedward is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Edmonton, Alberta, Canada
Posts: 55 Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 23 h 39 m 8 sec
Reputation Power: 7
Send a message via ICQ to Tedward Send a message via AIM to Tedward Send a message via MSN to Tedward Send a message via Yahoo to Tedward
Slight modification. Since you're using a redirect header, you shouldn't need anything else outputted. So, change sub MyRedirect to:

perl Code:
Original - perl Code
  1. sub MyRedirect{
  2.  $url=$_[0];
  3.  select(STDOUT);
  4.  close(NEWSTDOUT);
  5.  unlink("$file");
  6.  print("Location: $url\n\n");
  7.  exit(1);
  8. }


And then only call ResumeBuffer() if you don't actually redirect. Example:

perl Code:
Original - perl Code
  1. if($wantToRedirect){
  2.  MyRedirect("http://www.google.ca");
  3. } else{
  4.  &ResumeBuffer;
  5. }


Now I'm not actually positive if Perl will bother sending any output after a redirect header, or if it does, if browsers will wait around to see it after it's gotten the redirect header, but these changes should help prevent that either way. It will also save a few milliseconds taken to re-read and print the buffer if it isn't actually needed.

Reply With Quote
  #8  
Old September 24th, 2005, 07:22 PM
techcode's Avatar
techcode techcode is offline
Guru Meditation
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Amsterdam
Posts: 1,302 techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)techcode User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 2260 Folding Title: Novice Folder
Time spent in forums: 5 Days 34 m 49 sec
Reputation Power: 362
Send a message via Yahoo to techcode
Quote:
Thanks. I'll look into those modules (I'm trying to keep it as module-free as I can at this point, since it will run on various servers that might not have all these modules installed, or the capability to install them). And I already use HTML::Template--guess I better get used to the FormValidator~


All modules that I wrote are pure Perl - which means I just copy them to the server I'm installing my application to - and it works That's what I like most about it.

Quote:
"Bad design practice?" Care to explain that?


I care. The whole idea behing PHP is bad because it untill recently forced you to mix php and html code. And when you start writing a bit more complex applications you will see yourself why that is not the happiest solution. Especialy if there is another person included that will do design.

Of course PHP folks realised the problems (as many others did) so they came up with templating.

Also, I believe mysql functions are built-in inside php, that's another bad thing. I also saw people saying they dont want to use PEAR because it starts to look like CPAN - like that's a bad thing :?:

Don't know what _fireartist_ tougth about it - would also like to hear.

Reply With Quote
  #9  
Old September 26th, 2005, 06:10 AM
fireartist fireartist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 131 fireartist User rank is Corporal (100 - 500 Reputation Level)fireartist User rank is Corporal (100 - 500 Reputation Level)fireartist User rank is Corporal (100 - 500 Reputation Level)fireartist User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 27 m 27 sec
Reputation Power: 8
I agree with techcode.
A "good design practice" for a program that allows plugins, would have different hooks for different stages of the server response.
Each plugin would register itself for different hooks.
So, if a plugin may need to send a redirect header, it would register with a hook that would be called very early on, before normal headers are sent.

Bad design practice?
A buffer is intended to allow data to be sent across the network in optimal sized chunks. In just the same way a harddrive buffer allows the physical disk to write a lot of data at the same time, rather than staying busy making lots of short writes.
A buffer shouldn't be able to be undone.

Also, regarding random filenames, I think it's a lot easier to say
Code:
use Temp::File;

my $fh = Temp::File->new;

Quote: "return name and handle of a temporary file safely"
docs

Reply With Quote
  #10  
Old September 26th, 2005, 12:48 PM
Tedward Tedward is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Edmonton, Alberta, Canada
Posts: 55 Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 23 h 39 m 8 sec
Reputation Power: 7
Send a message via ICQ to Tedward Send a message via AIM to Tedward Send a message via MSN to Tedward Send a message via Yahoo to Tedward
"A buffer is intended to allow data to be sent across the network in optimal sized chunks. In just the same way a harddrive buffer allows the physical disk to write a lot of data at the same time, rather than staying busy making lots of short writes.
A buffer shouldn't be able to be undone."

Unless you tell your script to send all output as it happens ($|++, it isnt sent until the entire script is finished. So, when you modify the buffer, it shouldnt have any negative side effects, as when the entire script finishes it should still break down the buffer to these optimal sized chunks, modified or not.

And for your random file idea above, I agree with that if it works. As I said earlier though, my code wasnt an example on how to open a file, it was an example on how to change your headers

Reply With Quote
  #11  
Old September 27th, 2005, 12:20 AM
Duminas Duminas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 44 Duminas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 48 m
Reputation Power: 9
Quote:
I care. The whole idea behing PHP is bad because it untill recently forced you to mix php and html code. And when you start writing a bit more complex applications you will see yourself why that is not the happiest solution. Especialy if there is another person included that will do design.
That designer reference is exactly why I almost immediately started Perl with HTML::Template. The other way I was considering (which is how I did it in PHP) is with a heredoc, and that is... not pleasant, to say the least (my syntax highlighting also goes wonky if I have HTML embedded in PHP/Perl files).

And I still don't quite get why sending redirect headers like this seems to be so frowned upon (fireartist's comments seem to portray this), but I digress.

Oh, and script execution timing breaks if I use Ted's solution under mod_perl, but whatever. Works fine otherwise.

Reply With Quote
  #12  
Old September 27th, 2005, 12:52 AM
mlh2003's Avatar
mlh2003 mlh2003 is offline
Y? Y!?
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2003
Location: Brisbane, Australia
Posts: 1,573 mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 23 m 56 sec
Reputation Power: 46
My 2c worth: USE THE CGI MODULE!!!

For simple redirection and header manipulation, there's nothing easier than using the CGI module:
perl Code:
Original - perl Code
  1. use CGI;
  2. my $q=CGI->new;
  3.  
  4. # Get form data (using the CGI module) and validate
  5.  
  6. if ($valid) {
  7.     $url = '/path/to/new/url.html';
  8. }
  9. else {
  10.     # Invalid form data entered.  Send to error page.
  11.     $url = '/path/to/error.html';
  12. }
  13. print redirect($new_url); # Do the redirection
  14.  

That's all there is to it. Read the CGI docs for more information on redirection headers. And remember, don't print any HTTP headers if you intend to do redirects.

As techcode mentioned, if you use a framework such as CGI::Application, then there's no need to think about how to do redirections - it is all taken care of by the application module. It works seamlessly with most templating packages such as HTML::Template and can be used for simple or advanced projects.
__________________
print join'',(reverse sort map{/\d([a-z])\d/}split/\W/,'$5l6@314&60f%3h4#moo^1m2'),(map{/\d(\d)/}grep/\w\d/,reverse split/\W/,'a2&2b#9i*30%42'),(unpack"AA",(chr(0b110000).chr(0b110011)));

Last edited by mlh2003 : September 27th, 2005 at 01:35 AM.

Reply With Quote
  #13  
Old September 27th, 2005, 02:36 AM
Tedward Tedward is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Edmonton, Alberta, Canada
Posts: 55 Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 23 h 39 m 8 sec
Reputation Power: 7
Send a message via ICQ to Tedward Send a message via AIM to Tedward Send a message via MSN to Tedward Send a message via Yahoo to Tedward
Even using CGI.PM (which doesnt really make redirection any easier, unless you don't know what you're doing...), I highly doubt you can send the redirect command after other headers have been sent.

Reply With Quote
  #14  
Old September 27th, 2005, 02:46 AM
mlh2003's Avatar
mlh2003 mlh2003 is offline
Y? Y!?
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2003
Location: Brisbane, Australia
Posts: 1,573 mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level)mlh2003 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 23 m 56 sec
Reputation Power: 46
Quote:
Originally Posted by Tedward
Even using CGI.PM (which doesnt really make redirection any easier, unless you don't know what you're doing...), I highly doubt you can send the redirect command after other headers have been sent.

Maybe I'm missing something that seems so important to some - why would you want to print a HTTP header, then do a redirect?

If you're talking about META redirection, then do it in HTML.

Reply With Quote
  #15  
Old September 27th, 2005, 02:49 AM
Tedward Tedward is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: Edmonton, Alberta, Canada
Posts: 55 Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level)Tedward User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 23 h 39 m 8 sec
Reputation Power: 7
Send a message via ICQ to Tedward Send a message via AIM to Tedward Send a message via MSN to Tedward Send a message via Yahoo to Tedward
Read my second post in this thread, it has a possible scenario where my script would come in handy.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Redirection after other output


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 - 2012, Jelsoft Enterprises Ltd.

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