No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
24 Posted Topics
you can use a regex to check the incomming posting comments againts a list of words. This is a quick and dirty example. #!/usr/bin/perl use strict; use warnings; my @Blocked_Words = <DATA>; my $Incomming_Comments = "the Fat rat ate the bat and come and join the Hippie's"; my $check = …
Look in to the module WWW::Mechanize use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->get("http://url"); my $site = $mech->content; #site saved as html you can also you the module to log you in the site and do things...
you'll either have to store the form contents in cookies, sessions or in hidden form feilds and since you only have 3 questions the hidden will be the less work and faster.. as far as jumping back and forth you need to add an element to the url script.pl?current=quest1&next=quest2 then …
For one thing the array starts a index 0 (zero) so your looping threw one that doesn't exist. Also you need to use the modules strict and warnings to catch more problems... #its really 4 #change the for ($i=0; $i <= 4; $i++){ } for my $each (@sessions){ #..change $sessions[$i] …
I think it might be easier to use this module.. [Excel::Writer::XLSX](http://search.cpan.org/~jmcnamara/Excel-Writer-XLSX-0.51/lib/Excel/Writer/XLSX.pm) This has alot of functions already....
DBD::mysql is a driver that allows you to work with a mysql server and DBI module depends on that driver module...
[CODE] my $ip = 'this once was a cat name 204.158.156 but was 69'; $ip =~ /(\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3})/g; print $1; [/CODE]
[CODE] # START Perl script # get the URL for the Web page that called this script $calling_page = $ENV{'HTTP_REFERER'}; # when the browser is Netscape, the referrer can contain the # and anchor name: REMOVE IT! (eg. http://clf-nsi/w3c.htm#clf) if($calling_page =~ /\(/\w\/)index\.shtml/) { # only take the first part up …
[CODE] #chdir("/ras-events/Emanuila/edrs/") or die "Couldn't open directory"; opendir (DIR, "./ras-events/Emanuila/edrs/") or die "Couldn't open directory"; my @files = readdir(DIR); closedir DIR; $xml = new XML::Simple; foreach my $file (@files) { next unless $file =~ /\w+\.xml/; my $data = $xml->XMLin("/ras-events/Emanuila/edrs/$file"); print STDOUT "$file\n"; print Dumper($data); print STDOUT "Volume: $data->{edrs}->[0]->{edr}->[0]->{volume}\n"; } [/CODE]
[code] print "content-type: text/html\n\n"; [/code] add to the top of your scripts
[QUOTE=pavan146;1045433]hey can any1 pls tl me hw to work on cgi pgms on windows..m new to ds language,facin a prob durin connectin perl prog throu browser...hw to do dat[/QUOTE] you need a web server like apache running to interact with.
Is the very first line (#!/usr/bin/perl) pointing to the correct folder where perl is stored on the server? in the first couple of lines of the script there should be a line like [code] print "content-type: text/html\n\n"; [/code] if not add it
[CODE] my (@words1,@words2,@words3); open file, "/dir/to/file.db"; while (my $line = <file>){ next if $line =~ /^./; #this isnt the best way todo this but should work my ($word1,$word2,$word3) = split(/ /,$line); push @words1, $word1; push @words2, $word2; push @words3, $word3; } [/CODE] try that.....
you can use session cookies, or you can log there ip. I would just use session cookies, and if the person doesnt accept cookies then dont allow them to view page, or something like that.
[code] #!/usr/bin/perl -w use Tk; use strict; my $mw = MainWindow->new; fill_window($mw, 'Main'); my $top1 = $mw->Toplevel; fill_window($top1, 'First top-level'); my $top2 = $mw->Toplevel; fill_window($top2, 'Second top-level'); MainLoop; sub fill_window { my ($window, $header) = @_; $window->Label(-text => $header)->pack; $window->Button( -text => 'close', -command => [$window => 'destroy'] )->pack(-side => …
well from what i can see is that $_ is a default set variable, but in your case its not being set by perl anywhere b/c you set all your variables up. you'll might need to rethink your code layout if you want to access the $_ variable. [code] while …
you can try this: open the file, slurp it all in at once and use eval to execute the code.
add this [code] if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; } [/code] this was taken from the cpan site on this module.
look in to this module. [URL="http://search.cpan.org/~ash/TryCatch-1.001001/lib/TryCatch.pm"]TryCatch.PM[/URL]
[code] $string =~ /FT\s*CDS\s*\w+\(join\(.+\)\)/; [/code] try this, it isnt tested.
to save data pasted back from sub like that you must save them. [code] my $saved = $Enable->GetField("LINE",\$Line}); [/code] that will captured anything that is returned back from the sub.
try added this above your commented out foreach loop. [QUOTE] my $cgi = new CGI::Simple; [/QUOTE] then replace [QUOTE] my $fieldsearch =param('fieldsearch'); my $fieldvalue = param('fieldvalue'); [/QUOTE] with [QUOTE] my $fieldsearch =$cgi->param('fieldsearch'); my $fieldvalue = $cgi->param('fieldvalue'); [/QUOTE]
try print $res->content; rather then print $res->as_string. The only thing is that, if the post successful then it will retrieve the contents of that whole page as source code (HTML format). you can save the ref. to a string if need be.
The End.
wickedxter