Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Replacing parts of a string

by arturo (Vicar)
on Apr 11, 2003 at 14:52 UTC ( #249901=note: print w/ replies, xml ) Need Help??


in reply to Replacing parts of a string

OK, this will not enhance your regex-fu, and it may not be the most efficient (in terms of runtime resource allocation) solution, but it's a dead easy one to use, and very efficient in terms of programmer-hours spent on the problem. Following up on jasonk's suggestion, you don't even need it to be the case that the script doing the parsing is calendarview.pl. Simply feed the query string to a CGI.pm object and let it do the parsing for you:

#!/usr/bin/perl + use CGI; use strict; use warnings; # note you want everything after the ? my $querystring='loginid=102138&month=04&year=2003&student_id=&user_ty +pe=TUTOR&CalendarName=102138Academic&framename=top.index_main&session +_number=618280744437303'; + my $q = CGI->new($querystring); + foreach my $p ( $q->param() ) { print "Parameter $p : " . $q->param($p) . "\n"; } +

If not P, what? Q maybe?
"Sidney Morgenbesser"


Comment on Re: Replacing parts of a string
Download Code
Re: Re: Replacing parts of a string
by aquarium (Curate) on Apr 12, 2003 at 10:14 UTC
    ditto...use CGI.pm or similar--or be at the peril of code injection inside URLs. You should also use taint...and check (with a simple regex) that the parameters you receive are alphanumeric only (no quotes etc.) Chris

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://249901]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-09-03 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls