perl

Can I display the output of MySQL using CGI?

HI, I have written a program in Perl using the DBI module. Can I display the output of MySQL using CGI? If so please help me. program: #!/usr/bin/perl -w use DBI; print "Content-type:text/html\n\n"; $db_handle = DBI->connect("dbi:mysql:database=CYP1B1;host=localhost:192.168.3.93;") or die "Couldn't connect to database: $DBI::e...

What's the differences between system and backticks and pipes in Perl?

Perl supports three ways (that I know of) of running external programs: system: system PROGRAM LIST as in: system "abc"; backticks as in: `abc`; running it through a pipe as in: open ABC, "abc|"; What are the differences between them? Here's what I know: You can use backticks and pipes to get the output of the command ...

How do I chomp a string if I have Perl 4?

I am writing a script on my personal machine which is connected to the remote server. I think the remote server has Perl 4.0 or lesser version installed and that is why it is unable to recognize the same. Is there an alternative to the chomp command? ...

Can I use ffmpeg from inside a Perl script without a system call?

I'd like to convert mp3's to lower bitrates, as well as possibly convert video to mp3 using Perl. I looked at the ffmpeg module but it doesn't appear that it supports converting files, the only example I saw was grabbing pictures out of a video stream. Is there a way to do this in Perl with out using system() to call ffmpeg? ...

How to call a Perl script from Python, piping input to it?

I'm hacking some support for DomainKeys and DKIM into an open source email marketing program, which uses a python script to send the actual emails via SMTP. I decided to go the quick and dirty route, and just write a perl script that accepts an email message from STDIN, signs it, then returns it signed. What I would like to do, is from ...

Why isn't Perl's tr/// doing what I want?

I am using Perl for a script that takes in input as two short strings of DNA. As an output, I concatenate the two strings strings then print the second string lined up over its copy at the end of the concatenated string. For example: if input string are AAAA and TTTTT then print: AAAAATTTTT TTTTT I know there are other ways to do...

How can I get Perl's Jabber::SimpleSend to work with Gmail chat?

I'm trying to write a simple Perl script to send an Instant Message. Jabber seemed like it might be the most conducive protocol. But the following script fails: #!/usr/bin/env perl use Jabber::SimpleSend qw(send_jabber_message); send_jabber_message('[email protected]', 'CENSORED', '[email protected]', ...

What's the difference between Perl's backticks, system, and exec?

Can someone please help me? In Perl, what is the difference between: exec "command"; and system("command"); and print `command`; Are there other ways to run shell commands too? ...

How do I create an object that returns different values in different scalar contexts?

I want to return a different value in string context and numeric context like $! does. I know I can find out whether I am in list or scalar context with wantarray, but is there any way in pure Perl to determine which scalar context I am in? I assume there is an answer in XS as well and I am willing to take that answer if there is no wa...

How should I generate a random alphanumeric initial password for new users?

We have to automatically import a large list of users with some data into a running system. For an initial password I want to update the list (csv format at the moment) with a random alphanumeric key (8 digits). When inserting it with a special routine (which needs a csv file), the password (in this case the alphanumeric key) is stored ...

How do I format number locale-specific in Perl?

I need to format numbers in my web application depending on user's chosen language, e.g. 1234.56 = "1.234,56" in German. Stuff like sprintf is currently out of question, since they depend on LC_NUMERIC (which is sensible for desktop applications IMHO) and I'd have to generate every locale on the server, which is a no-go. I would prefer u...

How do I check if more than one record has been returned from DBI query in Perl?

Hi, I searched for this on the site already but couldn't locate anything that answered my question. Which brings me to the details: I am querying database using a simple select query, realistically (given the scenario) it should never return more than about 5 to 6 records. I just want to check if more than one has been returned. And if...

How do I rename an exported function in Perl?

I have some Perl modules which exports various functions. (We haven't used @EXPORT in new modules for some years, but have retained it for compatibility with old scripts.) I have renamed a number of functions and methods to change to a consistent naming policy, and thought that then adding a list of lines like *directory_error = ...

How do I check whether a Perl module is installed?

I'm writing a small Perl script that depends on some modules that might be available, so during the installation I would have to check if everythings there. I could just write use some::module and see if an error comes up, but a short message like "You need to install some::module" would be more helpful for endusers. I also could just ...

Is there a Perl module to convert c99 hex floating point notation to regular notation?

Is there a built-in library that I can use to convert c99 style floating point notation, example: 0x1.0p23f, to regular floating point numbers using Perl (and vice versa)? Thanks, ...

How do I do webtesting in Perl for pages that require JavaScript?

I have found these two modules that purport to be able to puppet string browsers, but I have no experience with them, but my current test suite uses WWW::Mechanize. Does anybody have any information about these modules, or other methods of testing pages from Perl that require JavaScript? To clarify, I am running my tests under Linux (U...

How do I pass a hash to a function in Perl?

I am having a lot of trouble. I have a function that takes a variable and an associative array, but I can't seem to get them to pass right. I think this has something to do with function declarations, however I can't figure out how they work in Perl. Does anyone know a good reference for this and how to accomplish what I need? I should a...

How can I log in to YouTube using Perl?

I am trying to write a Perl script to connect to me YouTube account but it doesnt seem to work. Basically I just want to connect to my account but apparently it is not working. I don't even have an idea on how I could debug this! Maybe it is something related to https protocol? Please enlighten me! Thanks in advance. use HTTP::Request:...

How do I run test scripts from TestTrack Test Case Manager in Linux?

I use Seapine's TestTrack Test Case Manager (TCM) under Linux and thus far have been unable to figure out how to use its ability to kick off our Perl test scripts and save the resulting data into a test run. Could someone provide me with a config, or example? ...

Why does Perl's Inline::C sort 4.0e-5 after 4.4e-5?

I built a Perl Inline::C module, but there is some oddity with the sorting. Does anyone know why it would sort like this? Why is the 4.0e-5 is not first? my $ref = [ 5.0e-5,4.2e-5,4.3e-5,4.4e-5,4.4e-5,4.2e-5,4.2e-5,4.0e-5]; use Inline C => <<'END_OF_C_CODE'; void test(SV* sv, ...) { I32 i; I32 arrayLen; AV* data; float ret...