Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6920307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:07:51+00:00 2026-05-27T10:07:51+00:00

So, I got a PERL script I am trying to run, it start like

  • 0

So, I got a PERL script I am trying to run, it start like this:

use strict;
use a;

use CGI 'param';
use URI::Escape;
use HTML::FromText 'text2html';
use XML::Simple;
use LWP::UserAgent;
use Data::Dumper;
use URI::Escape;
use DBI;
use Tie::DBI;
use Digest::MD5 'md5_hex';
use MIME::Base64;
use Encode;

my $r = shift; $r->content_type("text/html; charset=utf-8"); my $tmp = a::tmp();

When it get’s to the part where content_type() function is called, it fails with this error message:

Can't call method "content_type" on an undefined value at script.pl line 18.

Any ideas? I am kinda PERL newbie.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:07:51+00:00Added an answer on May 27, 2026 at 10:07 am

    If $r is coming from @ARGV, it won’t have a content_type method.

    You could potentially bless $r into some package, but that’s surely not what you’re intending to do, here.

    I’m guessing that you want to obtain a CGI parameter, probably a POSTed upload file? So you want $r to be a CGI object, not a parameter. You’d start with

     my $r = CGI->new;
    

    But, then, I refer you to the very fine manual for CGI, http://perldoc.perl.org/CGI.html or perldoc CGI from the shell.

    (To expand a bit:)

    In Perl, a $scalar var holds “any one thing.” Things coming in from the command-line are generally strings (maybe numbers, on a good day); that’s what shift would get at the top level. (The special variable @ARGV contains command-line parameters passed in to your program.)

    “One thing” can also be a reference to an object. In Perl’s Object Oriented model, the methods of a package (“class”) are tied to that reference using bless. That’s usually handled for you, though; the special subroutine (aka function, method) CGI::new will create a new CGI object with some state data (things like form fields’ values), and bless it into the CGI package.

    The -> notation going to a function call will only work if your variable contains a blessed reference. You can “ask” what kind of a reference you have in a variable using ref; you’ll get the name of its package (aka class). ($foo = []; bless $foo => 'Some::Package'; print ref $foo; => Some::Package)

    — But, again, for your specific case, check out some of the examples in the CGI module’s manual 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this simple Perl script: #! /usr/bin/perl -w use strict; use Data::Dumper; my
I am trying to use wkhtmltopdf to generate pdfs. I've got a perl script
I'm trying to run this Perl script but it is not running as required.
I've got a Perl script that needs to execute another Perl script. This second
Let's say I've got a shell script called print_error.sh looking like this: #!/usr/bin/bash echo
Perl Question . I'm trying to get this script running in a debugger. I've
I've got a perl CGI script running on an Apache server. The script is,
I've got a perl script with something like the following: \blah\@$string;blah\ But I'm not
I've got a perl script: run.pl that's been called by cron every minute. The
I've got a Perl script I'm using for running a file processing tool which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.