Hello monks just another question for you about Tie::File.
I'm writing a program for a flat database and i made a little module.
It includes Tie::File module.
The program works well if it is a command line executable but it fails if it is a CGI because it can't tie my file and the $Card reference doesn't contain anything...
Any ideas?
the code in CGI
use CGI; use Gnome::Card; my $q = new CGI; print $q -> header("text/html"), $q -> start_html(-'title'=>"Example",), $q -> h1("Programma di gestione remota GnomeCard"); my $filecard="../GnomeCard.gcrd"; my $Card=Leggi($filecard); print "$Card->[2] is good.. \n"; print $q -> end_html();
the code in module Gnome::Card
sub Leggi{ my @Card; my $filecard=shift; tie @Card, 'Tie::File', $filecard; ... return \@Card; }
PS: GnomeCard is the module that i wrote
PS: The module is propely installed
PS: i've the privileges in reading file and if i put this code in CGI it prints all rows:
open FILE, "<$filecard"; while(<FILE>) {print $_,"<br>";}

-­--
os: Linux Mandrake 9.0


In reply to Tie::File and CGI by nathanvit

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.