Tuesday 16 January 2024

Login System using perl catalyst MVC



1.install the required Below dependencies:

cpanm --installdeps .

Read more »

Labels:

Tuesday 22 October 2019

place and plays @_ in perl?

Method 1:

sub Addition{ $a=\@_; ($a,$b,$c)=@$a; $sum=$a+$b+$c; } Addtion(10, 20, 30); print $sum; #60



Read more »

Labels:

Saturday 11 March 2023

How to Build an Authentication API with JWT Token in Perl

Hi, In many web applications, user authentication is a critical feature that allows users to securely log in and access their data. One common approach to implementing authentication is to use JSON Web Tokens (JWT), which are a type of token-based authentication that can be used across multiple domains and platforms.

In this tutorial, we will show you how to build an authentication API with JWT token in Perl. We will be using the Mojolicious web framework, which is a powerful and flexible framework that makes it easy to build web applications in Perl.

Read more »

Labels: , , ,

Friday 1 November 2019

perl - find missing numbers in array

Method 1:

@a = (1,3,4,6); @c = map $a[$_-1]+1..$a[$_]-1, 1..@a-1; print join(" ", @c);




Read more »

Labels:

Wednesday 16 August 2023

Creating a Simple Blog Application in Perl

 create simple blog application that allows users to create, read, update, and delete (CRUD) blog posts. The application uses the Perl Catalyst MVC framework, DBIx::Class ORM for interacting with the database, and provides both REST and GraphQL APIs for accessing the data. The database can be  PostgreSQL.

Read more »

Labels:

Friday 11 December 2020

Perl - securing web services using OAuth 2.0


Hi, This program is a simple OAuth 2.0 authentication and authorization implementation using the Mojolicious web framework in Perl. It allows a user to log in and authorize a client application to access protected resources.

The program defines the necessary endpoints for authentication and authorization using the get method from the Mojolicious::Lite module. The $auth_endpoint and $token_endpoint variables define the authentication and token endpoints for the OAuth 2.0 provider. The $client_id, $client_secret, $redirect_uri, and $scope variables define the client credentials and scope for the OAuth 2.0 client.

Read more »

Labels:

Friday 4 October 2019

how many types available for getting string variable length in perl?

Method 1:

my $c = map $_, $h =~ /(.)/g;


Method 2:

my $c = split '', $h;


Method 3:

my $count = () = "hello" =~ /./g;


Method 4:

print length $h;


Method 5:

$cnt = "hello" =~ tr/[a-z][A-Z][0-9]//;


Method 6:

$h='hello';
my $v=$h=~ s/[a-z]//g;


Method 7:

print  @_ = push(@_, map $_, (split '', 'hellgo'));


Method 8:

print  @_ = push(@_, grep $_, (split '', 'hellgo'));


Method 9:

print push(@_, grep $_, "hello" =~ /./g);


Method 10:

print push(@_, map $_, "hello" =~ /./g);


Method 11:

print push(@_, grep $_, reverse "hello" =~ /./g);


Method 12:

print push(@_, map $_, reverse "hello" =~ /./g);


Method 13:

print push(@_, map $_, (split '', 'hellgo'));


Method 14:


my $c = grep/./, (reverse split '', 'hello');
print $c;


Method 15:

my $c = map $_, (reverse split '', 'hello');
print $c;


Method 16:

my $c = map $_, (reverse "hello" =~ /./g);
print $c;


Method 17:

my $c = grep/./, (reverse "hello" =~ /./g);
print $c;


Method 18:

my $c = map $_, (reverse split '', 'hello');
print $c;


Method 19:

my $c = grep/./, (reverse split '', 'hello');
print $c;


Method 20:

print scalar map $_, 'hello' =~ /(.)/g;


Method 21:

print scalar grep/./,'helloh' =~ /(.)/g;


Method 22:

print scalar  map $_, (reverse "hello" =~ /./g);


Method 23:

print scalar  map $_, (reverse split '', 'hello');


Method 24:

print scalar  map $_, (split '', 'hello');


Method 25:

print $r = @_= map $_, (split '', 'hello');


Method 26:

print $r = @_= grep $_, (split '', 'hello');


Method 27:

print $r = @_= grep $_, (reverse "hello" =~ /./g);


Method 28:

print $r = @_= grep/./,'helloh' =~ /(.)/g


Method 29:

print $r = @_= map  $_, (reverse "hello" =~ /./g);


Method 30:

print $r = @_= map/./,'helloh' =~ /(.)/g


Method 31:

print $r = @_= map $_, (split '', 'hello');


Method 32:

print $r = @_= grep $_, (split '', 'hello');


Method 33:

print $r = @_= grep $_, (reverse "hello" =~ /./g);


Method 34:

print $r = @_= grep/./,'helloh' =~ /(.)/g


Method 35:

print $r = @_= map  $_, (reverse "hello" =~ /./g);


Method 36:

print $r = @_= map/./,'helloh' =~ /(.)/g


Method 37:

print scalar  map $_, (reverse split '', 'hello');


Method 38:

print length reverse  grep/./,'helloh' =~ /(.)/g;


Method 39:

print length reverse  map $_,'helloh' =~ /(.)/g;


Method 40:

print grep/./, (reverse "hello" =~ tr/[a-z][A-Z][0-9]//);


Method 41:

print map $_, (reverse "hello" =~ tr/[a-z][A-Z][0-9]// );




For More Methods Reach Me:@ letscrackperlinterviewblogspot@gmail.com  

Labels: , , , , ,

Wednesday 9 December 2020

securing Perl web services using token-based authentication and authorization

Hi, Today program is a simple authentication and authorization example using Mojolicious, a lightweight web framework for Perl. The program sets up a login route for users to authenticate with a username and password. If the credentials are correct, the server generates a token by concatenating the server's secret key and the current time. The token is then stored in a session and returned to the user. The token is later used to authorize access to protected routes under '/api'. When a user tries to access the example route, the server checks if the token stored in the session matches the token generated earlier. If the tokens match, the user is authorized to access the resource, and the server returns the example data in JSON format. If the tokens don't match, the server returns an error message and a 403 Forbidden status code.

Read more »

Labels: , ,