hi
i am not getting what exactly bless function do in perl explanation in perldoc is not very clear i tried to search on google but i am getting confused or rather not getting at all. can anybody explain in short what it does in following example as well as in general ?
The bless() function turns a vanilla reference (that can be virtually any type of reference, although hash reference is used most of the time) into an object. Without bless(), you are not doing object-oriented programming in Perl.
The first line captures the package name. If one calls
(1) The package name "Some::Package" will be passed as the first argument if the arrow -> is used. I forgot exactly which manpage mentioned this, but it should be there.
(2) You just create a reference type that holds the model of the object. However, the object itself has not been created yet.
(3) This is what creates the object. The reference (model) is associated with the given package name, so making the resulting object an instance of that package. (In OOP, objects are instances of a package/class/module).
It looks bizarre, but that's the way Perl objects work.
$mystring = "name:blk:house::";
print "$mystring\n";
@s_format = split(/:/, $mystring);
for ($i=0; $i <= $#s_format; $i++) {
print "index is $i,field is $s_format";
print "\n";
}
$size = $#s_format + 1;
print "total size of array is $size\n";
i am expecting my size to be 5, why is it... (5 Replies)
Hi,
here is my perl script.This script creates an array and is sorting it using the in-built sort function in perl.
#!/usr/local/bin/perl
my number=6;
my @num_arr=(1,2,3,4,5);
my @array=(23,"$number","Hello",2.345,@num_arr);
#printing the array
print... (2 Replies)
hi
i came across one program which uses some method to calculate file permissions using lstat in perl and i am not getting how its doing that i am pasting the code below ...
$ > cat b.pl
use Fcntl':mode';
my... (0 Replies)
Hi,
Can any one please let me know, how to join the lines in a file, but based one a condition.
There is a file, where few lines start with a date stamp. and few do not.
I wanted to join the lines till I find a date stamp. If found date its should in a newline.
Please help me.
... (5 Replies)
Hi,
I am using perl with some EDA tool. There is an API function that can be iterate.
I try to check the ref and get that it is a string. I assume that it is a hash
sub aaa {
my $obj = shift;
$name = $obj->name;
print ref $obj,"\n";
foreach my $var(keys %{$obj}) {
my... (0 Replies)
Help Please perl Gurus,
I am trying to add ungrouped passengers in a group and I creating a script however it fails on first step only I tried all the options it returns following error.
syntax error at junki line 4, near "open "
Execution of junki aborted due to compilation errors. ... (2 Replies)
my @d =split('\|', $_);
west|ACH|3|Y|LuV|N||N||
Qt|UWST|57|Y|LSV|Y|Bng|N|KT|
It Returns d as 8 for First Line, and 9 as for Second Line . I want to Process Both the Files, How to Handle It. (3 Replies)
Dear all,
I find a perl script that contains the following codes. Does anybody know the meaning of codes highlight.
.....
@field = parse_csv($file);
chomp(@field);
........
........
sub parse_csv {
my $text = shift;
my @new = ();
push( @new, $+ ) while $text =~ m{... (9 Replies)
I am working on converting shell to Perl script. In shell we have built in function
trap
Do you know alternative in Perl or actually we don't need it?
Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
LEARN ABOUT DEBIAN
http::exception::3xx
HTTP::Exception::3XX(3pm) User Contributed Perl Documentation HTTP::Exception::3XX(3pm)NAME
HTTP::Exception::3XX - Base Class for 3XX (redirect) Exceptions
VERSION
0.04001
SYNOPSIS
use HTTP::Exception;
# all are exactly the same
HTTP::Exception->throw(301, location => 'google.com');
HTTP::Exception::301->throw(location => 'google.com');
HTTP::Exception::MOVED_PERMANENTLY->throw(location => 'google.com');
# and in your favourite Webframework
eval { ... }
if (my $e = HTTP::Exception::301->caught) {
my $self->req->redirect($e->location);
}
DESCRIPTION
This package is the base class for all 3XX (redirect) Exceptions. This makes adding features for a range of exceptions easier.
DON'T USE THIS PACKAGE DIRECTLY. 'use HTTP::Exception' does this for you.
ADDITIONAL FIELDS
Fields, that 3XX-Exceptions provide over HTTP::Exceptions.
location
Indicates, where the browser is beeing redirected to.
AUTHOR
Thomas Mueller, "<tmueller at cpan.org>"
BUGS
Please report any bugs or feature requests to "bug-http-exception at rt.cpan.org", or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTTP-Exception <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTTP-Exception>. I will be
notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc HTTP::Exception::Base
You can also look for information at:
o RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTTP-Exception <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTTP-Exception>
o AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/HTTP-Exception <http://annocpan.org/dist/HTTP-Exception>
o CPAN Ratings
http://cpanratings.perl.org/d/HTTP-Exception <http://cpanratings.perl.org/d/HTTP-Exception>
o Search CPAN
https://metacpan.org/release/HTTP-Exception <https://metacpan.org/release/HTTP-Exception>
LICENSE AND COPYRIGHT
Copyright 2010 Thomas Mueller.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as
published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
perl v5.14.2 2012-02-24 HTTP::Exception::3XX(3pm)