Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi.. im learning web service, few days back i found a site to implement simple rest service.(Restfull) in there library.cgi working and when i try to add book using book script it gives the error "Global symbol "$file" requires explicit package name at ./book line 68.". can any one suggest me to resolve this or any basic tutorial with Perl.. i gone through some modules but it requires mod_perl..can any one give me simple server side and client side script for practice..

Replies are listed 'Best First'.
Re: Basic rest service help
by Anonymous Monk on Jan 24, 2011 at 09:06 UTC
    read perlintro, and use diagnostics;, then fix the typo
    # This is a helper to slurp up files, I could have just used File::Slu +rp sub slurp($) { my $filename = shift; # Slurp up the contents of the given filename open my $slurpy, '<', $file or die "Cannot open $file: $!"; return do { local $/; <$slurpy> }; }
    $filename is not $file

      hi thanks for your response... i did correct the mistake. while creating the file(./book create treasury.yml) it gives "Cannot open treasury.yml: No such file or directory at ./book line 68." when i create a file with treasury.yml and run it gives "ERROR I Only Do Hashes: The submitted YAML data is not a HASH." .. what is the correct way to do this...

        what is the correct way to do this...

        As described in the article? What exactly did you do?

Re: Basic rest service help
by Anonymous Monk on Jan 24, 2011 at 11:31 UTC

    hi its working fine..really thank you so much for ur effort.