Using the examples from the CGI::Session::Auth::DBI and CGI::Session::Auth pages, I have attempted to implement the _login function with no success. I'm using Windows 7 and Apache 2.
#!/usr/bin/perl -w
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI;
use CGI::Session;
use CGI::Session::Auth::DBI;
my $cgi = new CGI;
# using '....
How do I write a Perl Script to read a CSV file first column and Update Oracle table?
cheers
...
I'm gradually Moose-ifying some code that reads lines from a pipe delimited, splits each and assigns adds them to a hash using a hash slice.
I've turned the hash into a Moose class but now I have no idea how to quickly assign the fields from the file to the attributes of the class (if at all).
I know I can quite easily just do:
my $li...
Hi, How to detect if there is ( = ) sign in current line? thank you.
$_ = $currentLine;
if (Include =)
{
# do some thing
}
else
{
# do another thing
}
...
Hi,
I am learning the sample code from split function.
Sample code.
#!C:\Perl\bin\perl.exe
use strict;
use warnings;
my $info = "Caine:Michael:Actor:14, Leafy Drive";
my @personal = split(/:/, $info);
# @personal = ("Caine", "Michael", "Actor", "14, Leafy Drive");
If change the $info = "Caine Michael Actor /* info data */";
How to...
Often times I want to automate http queries. I currently use Java(and commons http client), but would probably prefer a scripting based approach. Something really quick and simple. Where I can set a header, go to a page and not worry about setting up the entire OO lifecycle, setting each header, calling up an html parser... I am looking ...
I am SharePoint Developer trying to get a Perl module to work with Subversion, but I think something is wrong with my syntax. I just need to get the username and password, pass it into the webservice, get a true/false and authenticate based on that information. Here is the code to the module in Perl:
package Apache2::AuthGetUser; #aut...
List-1 List-2
one one
two three
three three
four four
five six
six seven
eight eighttt
nine nine
Looking to output
one | one PASS
two | * FAIL MISSING
three | three PASS
* | three FAIL EXTRA
four | four PASS
five |...
I've just been using this code to check if a string is empty:
if ($str == "")
{
// ...
}
And also the same with the not equals operator...
if ($str != "")
{
// ...
}
This seems to work (I think), but I'm not sure it's the correct way, or if there are any unforeseen drawbacks. Something just doesn't feel right about it.
...
I have a function, binary_range_search, that is called like so:
my $brs_iterator = binary_range_search(
target => $range, # eg. [1, 200]
search => $ranges # eg. [ {start => 1, end => 1000},
); # {start => 500, end => 1500} ]
brs_iterator->() will ...
What's wrong with this eval statement in Perl? I'm trying to check that the XML is valid by catching any exceptions thrown from the parsing of the file with XML::LibXML:
use XML::LibXML;
my $parser = XML::LibXML->new(); #creates a new libXML object.
eval {
my $tree = $parser->parse_file($file) # parses the file contents i...
Hi, There is a sub to handle the Type and Value.
sub parse_type_value_specifier {
my $tvs = shift;
my ($type, $value) = $tvs =~ /<(\w+)\s+(.*?)>/;
return $type, $value;
}
It should suit for three formats below.
<B 0> - works, return $type = (B) and $value = (0)
<A[1..80] ""> - doesn't work, need return $type = A[1..80]...
What is the best way to find out if the scalar value is ASCII/UTF8 (text) or a binary data in Perl? Is this code right?:
if (is_utf8($scalar, 1) or ($scalar =~ m/\A [[:ascii:]]* \Z/xms)) {
# $scalar is a text
}
else {
# $scalar is a binary
}
Is there a better way?
...
Hi,
I have the following perl code :
use strict;
use warnings;
use Test::Cmd::Common;
my $path = "/something/not/available";
my $test = Test::Cmd::Common->new(string => 'File system operations');
eval{
$test->unlink("$path");
};
ok(!$@, "file unlike");
print "done.\n";
The $test->unlink() line will fail and throw exception....
If I run a Perl script from a command prompt (c:\windows\system32\cmd.exe), how can I exit the command prompt after the script finishes executing.
I tried system("exit 0") inside the Perl script but that doesn't exit the cmd prompt shell from where the Perl script is running.
I also tried exit; command in the Perl script, but that does...
How can I check if a Perl module is part of the core - i.e. it is part of the standard installation?
I'm looking for:
a command-line command:
a Perl subroutine/function to check within code
Thanks in advance.
Update
Perhaps I should re-write the question to be: "How can I tell what modules were originally provided with the specifi...
I have a table that has some Unicode in it. I know that the Unicode data is fine as it comes out as JSON on our webserver just fine. But for some reason the CSV that I'm generating is ending up mangled. Here's our current code:
my $csv = Text::CSV->new ({ eol => "\015\012" });
open my $fh, '>:encoding(utf8)', 'Foo.csv';
my $sth...
My XML file looks something like this:
<doc>
<RU1>
<conf>
<prop name="a" val="http://a.org/a.html>
</conf>
</RU1>
<RAU1>
<conf>
<prop name="a" val="http://a.org/a.html>
</conf>
</RAU1>
<RU2>
<conf>
<prop name="a" val="http://a.org...
I'm looking for a way to make Perl kill all firefox.exe processes on Win32, and not give an error if no process exists. I'm currently using:
system('taskkill /F /IM firefox.exe');
which throws up a big "ERROR: No such process found", when firefox wasn't present.
...
I'm trying to write a perl client program to connect to a Java server application (JDuplicate). I see that the java server uses The DataInput.readUTF and DataInput.writeUTF methods, which the JDuplicate website lists as "Java's modified UTF-8 protocol".
My test program is pretty simple, i'm trying to send client type data, which should...