and it works fine within perl because i have every perl script of mine that needs counting to call my perl module. for example from my index.pl i usepackage MyCounter; use strict; use Exporter 'import'; our @EXPORT = qw/counter/; # functions to export by default sub counter { my ($pagename, $db, $host) = @_; ($pagename) = ($pagename =~ m{([^/\\]+?)(?:\.[^/\\.]+)?$}); #======= Insert or Update pagecounter appropriately, then display i +t ======== eval { # Just ignore errors if the record already exists $db->do('INSERT INTO counters (pagename, pagecounter) VALUES (?, + 0)', undef, $pagename); }; $db->do('UPDATE counters SET pagecounter = pagecounter + 1 WHERE pa +gename = ?', undef, $pagename) unless( $host eq 'webmaster' ); my ($counter) = $db->selectrow_array('SELECT pagecounter FROM count +ers WHERE pagename = ?', undef, $pagename); return $counter; } 1;
Now the problem is how IF i can do the same thing, that is call the handmade perl module within from my every php script that need counting.use MyCounter; #i declare the usage of MyCounter .... .... $counter = counter( $0, $db, $host ); #i call my module
So please enlight me if this thing can happen and how to call it. All i want to do after the calling of the perl module is to print the counter for the specific page, thats all!
In reply to Can i call a handmade perl module within a php file? by Nik
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |