Hello i have made i perl module called MyCounter.pl which is supposed to add +1 to every page counter depending on the perl page that calls the module. Thai is the following code:
package 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;
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 use
use MyCounter; #i declare the usage of MyCounter .... .... $counter = counter( $0, $db, $host ); #i call my module
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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.